[Bug 3091] Nonportable tool usage in scripts

Denys Vlasenko vda.linux at googlemail.com
Thu Feb 10 08:33:32 UTC 2011


On Thu, Feb 10, 2011 at 8:58 AM, Rich Felker <dalias at aerifal.cx> wrote:
> On Wed, Feb 09, 2011 at 12:26:41PM +0100, Ralf Friedl wrote:
>> Denys Vlasenko wrote:
>> >On Wednesday 09 February 2011 00:56, Rich Felker wrote:
>> >>Oh, sorry. In scripts/mkconfigs, there are two occurrances of:
>> >>
>> >>grep '^#\? \?CONFIG_' "$config" \
>> >>
>> >>they should read:
>> >>
>> >>egrep '^#? ?CONFIG_' "$config" \
>> >
>> >I see that this '?' thing is a can of worms.
>> >I propose to sidestep it entirely:
>> >
>> >--- a/scripts/mkconfigs
>> >+++ b/scripts/mkconfigs
>> >@@ -42,7 +42,7 @@ echo "\
>> >  */
>> > static const char bbconfig_config[] ALIGN1 ="
>> >
>> >-grep '^#\? \?CONFIG_' "$config" \
>> >+grep -e '^# CONFIG_' -e '^CONFIG_' "$config" \
>> > | sed -e 's/\"/\\\"/g' -e 's/^/"/' -e 's/$/\\n"/'
>> >
>> > echo ";"
>> Why not omit the grep completely, as sed is used anyway?
>>
>> sed -rne 's/(^#? ?CONFIG_.*)$/"\1\\n"/gp' "$config"
>
> While BusyBox supports it, the -r option to sed is nonstandard, so
> little is improved. If you want to go this route, use:
>
> sed -ne 's/\(^#\{0,1\} \{0,1\}CONFIG_.*\)$/"\1\\n"/gp' "$config"
>
> But really I don't care which solution is applied; I'd just like to
> see _something_ correct done so I don't have to keep patching around
> the issue.

Current git should be fixed already. Ping me if it isn't.
-- 
vda


More information about the busybox mailing list