Le lundi 25 février 2008 à 18:21 +0100, Robert Millan a écrit : > On Sat, Feb 23, 2008 at 05:24:57AM -0800, Alban Browaeys wrote: > > diff -uNr grub2-1.96+20080219.orig/debian/grub-pc.postinst > > grub2-1.96+20080219/debian/grub-pc.postinst > > --- grub2-1.96+20080219.orig/debian/grub-pc.postinst 2008-02-23 > > 13:56:29.000000000 +0100 > > +++ grub2-1.96+20080219/debian/grub-pc.postinst 2008-02-23 > > 13:58:23.000000000 +0100 > > @@ -19,6 +19,7 @@ > > echo "Internal error in grub-pc package. Please file a bug > > report." >&2 > > exit 1 > > elif [ "$RET" != "" ] ; then > > + RET="$(printf '%s' "$RET" | sed 's|/|\\/|g')" > > sed -i /etc/default/grub -e > > "s/^\(GRUB_CMDLINE_LINUX\)=.*/\1=\"$RET\"/g" > > db_set grub-pc/linux_cmdline "" || true > > fi > > Is there any character we could use for the regexp instead of /, that is known > not to collide with any Linux cmdline options ? > > If it can be simplified this way, I'd prefer that instead.
Note that I know of . The kernel documentation has no statement in kernel-parameters.txt on this. Though "pipe" seems the safest bet if we want to avoid RET="$(printf '% s' "$RET" | sed 's|/|\\/|g')" (though is it that ugly ? I ported it from perl to c shell from the debconf escaping perl code , I use pipe only because I am escaping slashes and it is simpler this way but it does not prevent pipe from behing in). sed 's/\//\/\//g' would do too. -sed -i /etc/default/grub -e "s/^\(GRUB_CMDLINE_LINUX\)=.*/\1=\"$RET \"/g" +sed -i /etc/default/grub -e "s|^\(GRUB_CMDLINE_LINUX\)=.*|\1=\"$RET\"| g" would be the way if we decide that pipe are not to be handled. A comment stating this would be good above the code and maybe adding a line that detect if there is a pipe and send an error if so (maybe other kernels handled by grub on debian support pipe as argument freebsd, windows, hurd ?) Regards Alban