[PATCH] Tweaks to build process for embedded scripts

Kang-Che Sung explorer09 at gmail.com
Mon Nov 19 09:49:57 UTC 2018


On Mon, Nov 19, 2018 at 5:43 PM Ron Yorston <rmy at pobox.com> wrote:
>
> Denys Vlasenko wrote:
> >On Sun, Nov 18, 2018 at 10:06 AM Ron Yorston <rmy at pobox.com> wrote:
> >> - Strip leading comments and blank lines from embedded scripts before
> >>   compressing them.  Removing all comments would be nice but is hard.
> >
> >Well, this last item can mangle scripts. Let's not do this.
>
> What's the concern?
>
> The awk script that removes the lines is:
>
>     /^#/ { if (!found) next; }
>     /^$/ { if (!found) next; }
>     { found=1; print; }
>
> It's pretty conservative in what it deletes.  As soon as it finds a
> line that doesn't match its definition of a comment it copies the
> rest of the script verbatim.
>
> It would break scripts that use a shebang line to run a different
> interpreter but they aren't supported in this context anyway.

Script stripping should be optional, for at least two reasons:
1. It's beyond the scope of the script embedding feature, and it would better
be implemented and maintained as a separate tool.
2. Vendor may sign the scripts or publish their hashes or do something with
them so that every bit of the script must remain intact.


More information about the busybox mailing list