[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nmh-workers] I'm confused
From: |
Ralph Corderoy |
Subject: |
Re: [Nmh-workers] I'm confused |
Date: |
Sat, 15 Sep 2012 00:02:12 +0100 |
Hi Ken,
> I look at this and I can't help thinking that's the wrong answer;
> getting shell quoting is hard enough, but having to double-quote it?
> That just seems like a mistake to me.
Well, it's sh it needs quoting from, not $SHELL, so it is known what
needs quoting, unlike the unknown quoting rules of $SHELL.
> Also, depending on "ls" output to get a list of files seems like
> that's fraught with problems as well.
Agreed, one can concoct awkward filenames that break the \n termination.
Perhaps this could be avoided using
printf '%s\0' ...
to have $SHELL expand ... into words which then aren't re-evaluated
before being passed to printf(1), whether built-in or external. It
gives NUL termination.
Another, correct?, fix that keeps the user's $SHELL involved is to not
use popen(3) which wraps with /bin/sh but do its work ourselves. IIRC
that's what vim does with, e.g., `:ar'.
> I have an alternative suggestion: we ditch this code entirely and go
> to using glob(3). I mean, that's 90% of what people really want
> anyway, right?
It would do and not be much of a surprise to most users.
> Expecting full-level shell interpretation at the WhatNow? prompt just
> seems wrong.
I'm in the "WhatNow? prompt just seems wrong" camp. :-)
> Also, since the attach command is actually implemented using anno(1)
> functions, it seems like we should make a real "attach" command that
> can be used from the shell. That would just call the right anno
> function, of course.
Sounds good.
Cheers, Ralph.