[Fedora-livecd-list] [PATCH] Fix unquoted $(cat ...) in mayflower's big here-doc,
Douglas McClendon
dmc.fedora at filteredperception.org
Tue Nov 6 22:01:50 UTC 2007
Jim Meyering wrote:
> Hi,
>
> I noticed that the following part of the big here-document
> in creator/mayflower was not backslash-escaped (along with the
> following two lines):
FWIW, In my own as yet unpublished tool, I keep the init as a separate
file even. I.e. I also haven't seen a real need to do any expansion.
Though I also effectively pass the livecd label on the kernel command
line, so as to achieve the functionality in that last filesystem layout
patch which wasn't applied.
-dmc
>
> cat > init <<EOF
> ...
> if [ -f /etc/fstab ] ; then
> root=$(cat /etc/fstab | while read d m f o r; do if [ "$m" == "/" ] ; then echo $d; fi; done)
>
> So it would end up generating hard-coded bits like this:
>
> if [ -f /etc/fstab ] ; then
> root=dm_multipath
>
> [dm_mulipath came from an earlier loop where $m iterated
> through module names]
>
> At first I just fixed that by backslash-quoting things,
> but then I realized that nothing in that entire here document
> required expansion, so I've attached a better patch.
>
> The patch looks big, but it's largely mechanical:
> It uses <<'EOF' rather than <<EOF, which saves you the readability
> and maintenance hassle of backslash-escaping all of the "$" and "`"
> in the "init" here-doc.
>
>
>
> ------------------------------------------------------------------------
>
> --
> Fedora-livecd-list mailing list
> Fedora-livecd-list at redhat.com
> https://www.redhat.com/mailman/listinfo/fedora-livecd-list
More information about the livecd
mailing list