So, although I should be in break, also today I ended up doing some kind of work, a part updating the ALSA guide as I told before today, I’ve also taken a deeper look into my backlogs, and I found that I still had a few packages that needed to be fixed because they were stripping binaries.
As I was doing that, I wanted to provide a few useful pointers that might be not that obvious and I found interesting to know.
The first is a bash trick, or better a particular way to use bash that might come handy. Many people often use something like
for file in $(find . -type f); do stuff; done
I seen that used often also in ebuilds. Although it works, there are often better ways to do this (like using sed -i -e on multiple files instead of using a for to get file-by-file and use sed -e > tmpfile and so on). In those cases when the cycle is actually needed, there’s something that might come handy to know tho.
I found this myself when running the cycle that gets the list of files that are installed with stripped debug information (thing that makes my efforts to get the system fully debuggable useless :P). It was a for that used scanelf’s output, and it stuck waiting for scanelf to complete before starting looking at the files, probably because I was invoking a subshell with $().
If instead of doing that I do this:
scanelf -k '!.symtab' -F '#k%F' -qRB /usr/lib/debug
| while read file; do qfile -C ${file}; done
and thus use a pipe, I start getting output even if scanelf didn’t complete.
I know this might be obvious to seasoned bash coders, but it’s probably a neat trick to know for the newbies.
The other is not exactly a trick but an information that I should probably add to the backtraces guide. Some time ago I asked to solar about some files that didn’t get the debug info copied in /usr/lib/debug before strip. The problem was difficult to reproduce and he wasn’t actually sure what the cause was.
Well I can say now that the problem was either in GCC or in Binutils, as some packages like procps that had no debug information are now correctly copied. The same happened with some of the gcc’s libraries (although the c++ compiler still has debug information stripped). So if you ever see an “Invalid Operation” error from objcopy during stripping, you have to know that we probably can’t do much about that.