On 12/20/18 7:23 AM, Thorsten Leemhuis wrote: > Hi! Am 17.12.18 um 22:06 schrieb Randy Dunlap: >> On 12/17/18 10:24 AM, Jonathan Corbet wrote: >>> Here's an idea if you feel like improving this: rather than putting an >>> inscrutable program inline, add a taint_status script to scripts/ that >>> prints out the status in fully human-readable form, with the explanation >>> for every set bit. >> And some people prefer not adding tools that use python, perl, etc. > > Yeah, I know :-/ On twitter @apexo (thx!) suggested these two: > > dc -e"[00000000000000]n2o$(cat /proc/sys/kernel/tainted)p"|fold > -w1|tac|nl| grep -m 18 '.' > > (echo -n 000000000000000;(echo obase=2;cat > /proc/sys/kernel/tainted)|bc)|fold -w1|tac|nl| grep -m 18 '.' > > But it needs bc, which often is not installed by default :-/ Any as you > mentioned already: using Perl ( > > perl -e 'printf("%016b\n",<STDIN>)' < /proc/sys/kernel/tainted |fold > -w1|tac|nl > > ) also has it downsides. Having something that works in plain bash/sh > would be great... > > Nevertheless: I'm still inclined to put a one liner decode command into > tainted-kernels.rst so people can decode the file easily even if they do > not have attached script at hand. > >> E.g., I use this shell script (named 'chktaint', which could probably >> be done better): > > Many thx. Find a slightly improved version attached that directly prints > the reason. I assume that's more like what Jonathan had in mind. The > script now is also capable of decoding a value retrieved from > /proc/sys/kernel/tainted on another system. Thorsten: - drop the trailing spaces on multiple lines - s/follwing/following/ thanks. -- ~Randy