[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] Attach and disposition

From: Ken Hornstein
Subject: Re: [Nmh-workers] Attach and disposition
Date: Tue, 22 Jul 2014 12:59:41 -0400

>If you insert a single quote before hitting tab, readline will
>quote the entire string.

Right, but I think we all agree that is terrible that you have to
know to do that.

>I think there's a limit on how much we want to do here.  Our
>quoting support is already messy enough.

So, I took a look at that.  It's mostly because of our use of popen().

popen() invokes it's command via "sh -c"; the single argument you pass it
ends up being executed as:

        argv[0]: /bin/sh 
        argv[1]: sh
        argv[2]: -c
        argv[3]: $ARGUMENT

We end up with:

        argv[0]: /bin/sh 
        argv[1]: sh
        argv[2]: -c
        argv[3]: $SHELL -c "ls -d -- $ARGUMENTS"

So yeah, double-quotes don't work because they're being eaten by the
double-quotes we're already using.  Also, this is kinda messed up
because of the multiple levels here, but I can kinda see how we got here.

Here's what I'm thinking: we should ditch popen() and have our own version
where we can feed in an argv[] vector to it, created with argsplit().
That should do all of the right things in terms of invoking the shell
if shell quoting is necessary; that would give us some consistent shell
quoting semantics.

>And I noticed that readline has its limits, too:  it won't list
>possible completions after passing the space.  It does from a bash
>shell prompt, though (maybe bash helps it out?).

We just have basic readline() support; we can do a lot more.  Bash (for
example) inserts the appropriate shell escapes when expanding a filename.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]