<p><br>
On Apr 14, 2011 5:28 PM, "Thomas Bächler" <<a href="mailto:thomas@archlinux.org">thomas@archlinux.org</a>> wrote:<br>
><br>
> Am 14.04.2011 23:09, schrieb Dave Reisner:<br>
> >> I tested it better than 0.6.10 and it seems okay. Can<br>
> >> someone please proof-read this and tell me if it is<br>
> >> good?<br>
> ><br>
> > Sandbox testing says this doesn't work. I feed in a file containing:<br>
> ><br>
> >   root=/dev/sda video="din:10 foo bar baz" quiet ro<br>
> ><br>
> > and after parsing, i echo "root=$root" and "video=$video". i get...<br>
> ><br>
> >   video="din:10 foo bar baz<br>
> >   root=/dev/sda<br>
><br>
> Oh yeah, I forgot one line, fixed it (I'll send a v2 in a second).<br>
><br>
> > I posted what I thought was a valid solution on FS#23467 from stack<br>
> > overflow that seems to be a lot more sane and _much_ more maintainable.<br>
> > For those who weren't following the report, I suggested that we use the<br>
> > same fallback as /etc/fstab, which says to encode spaces with octal<br>
> > sequences. These can then be decoded using printf's %b flag. It requires<br>
> > only a simple change to the current parse_cmdline function.<br>
><br>
> I really don't understand what you mean (or how it would help). What you<br>
> mentioned doesn't solve the initial problem of finding out which spaces<br>
> separate arguments and which spaces are inside quoted strings.<br>
></p>
<p>It absolutely does because it eliminates spaces within variables, e.g. video=foo\040bar root=…</p>
<p>The whole point is that quotes aren't used. fstab sets precedent here so its not some wild and whacky new thing being introduced. </p>
<p>> > I also never got a response as to where you're seeing pollution from<br>
> > using export over eval.<br>
><br>
> 'export' exports variables to the environment and they are passed on<br>
> when forking. These variables are for internal purposes in mkinitcpio<br>
> and don't belong into other applications. As a simple example, I had<br>
> 'udevd_running=1' set in my environment during initscripts, which<br>
> certainly shouldn't be there. (This wasn't on the command line, but in<br>
> another place in mkinitcpio where things where exported when they<br>
> shouldn't be).<br>
><br>
> The right way would be something like bash's 'declare', but ash doesn't<br>
> have that.</p>
<p>Right. I understand what export does. It also wouldn't be hard to cleanse the environment since we know exactly what we're parsing. Having those cars during sysinit?  Not the worst thing in the world. Exported to a user's shell? That's a real issue.</p>

<p>> > Sorry, but eval sucks hard and I've put a lot of<br>
> > effort into _removing_ it from wherever I can in Arch code. It's<br>
> > _rarely_ used properly.<br>
><br>
> If you check carefully, I use eval right here. There is nothing in the<br>
> eval'ed strings that should cause trouble.<br>
><br>
We'll have to agree to disagree here. The problem is that you can't know what eval is executing in this case because its unbounded and unchecked input.</p>
<p>d</p>