[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#559344: kldutils: bashism used in /etc/init.d/module-init-tools

Hanno Hecker dixit:

>    modules="`shopt -s nullglob ; cat /etc/modules /etc/modules.d/* \
>         | sed -e \"s/#.*//g\" -e \"/^\( \|\t\)*$/d\" `"

This is even worse, as "...`..."..."...`..." (with or without inner
quotes) is always wrong and not portable, however $(...) is guaranteed
by POSIX which then is guaranteed by Policy 10.4. There is also an
unescaped dollar sign that probably is removed by the shell, and I'm
not too sure \t is expanded either.

I propose: (untested at the moment though)

modules="$(cat /etc/modules /etc/modules.d/* 2>/dev/null | \
    sed -e 's/#.*//g' -e '/^[	 ]*$/d')"
                             ^  ^-> space
                             +----> tab

>-- debsums errors found:
>Your vendor has not defined Fcntl macro O_NOATIME, used at /usr/bin/debsums line 277.


Sometimes they [people] care too much: pretty printers [and syntax highligh-
ting, d.A.] mechanically produce pretty output that accentuates irrelevant
detail in the program, which is as sensible as putting all the prepositions
in English text in bold font.	-- Rob Pike in "Notes on Programming in C"

Reply to: