Question about running stripping process

Hi guys, I am actually trying to fin a good way to strip a file list.

I tried into a process, but the problem is if one stripping fail (for example because it’s a Dir), it stop the stripping. Have you got any suggestion to bypass this ? You need to keep in mind that I need performance, and I can’t pay the cost to use a process for every single file.

My software handle the use of the bit SUID if you wonder.

Actually my program is using this method, but most of the file are not stripped.

def stripFileListNoChroot(fileList : Array(String))

            requestedCommands = <<-CMD
            strip --strip-unneeded #{fileList.join("\" || true\nstrip --strip-unneeded \"")} || true
            CMD

            process = Process.run(requestedCommands, shell: true)

            rescue
end

This is actually a shell question isn’t it?

If you were not using shell: true you could make this faster by looping in crystal itself over the files and just not looking at the returned status.

OTOH, it seems that strip will just strip whatever files it can strip and do nothing about the others so you could just strip them all in one command:

> strip tartrazine-static-linux-arm64 tartrazine-static-linux-amd64 -v
copy from `tartrazine-static-linux-arm64' [elf64-little] to `styBkuZb' [elf64-little]
strip: Unable to recognise the format of the input file `tartrazine-static-linux-arm64'
copy from `tartrazine-static-linux-amd64' [elf64-x86-64] to `stlxUgxM' [elf64-x86-64]
1 Like

Sorry I realized finally that the problem I got was from somewhere else in my code, sorry for this. I am getting tired