[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nmh-workers] I'm confused
From: |
Lyndon Nerenberg |
Subject: |
Re: [Nmh-workers] I'm confused |
Date: |
Fri, 14 Sep 2012 12:10:59 -0700 |
On 2012-09-14, at 11:26 AM, Ralph Corderoy wrote:
> It seems the code is attempting to force $SHELL to expand attach's
> parameters and not plain old /bin/sh run by the popen(3) it uses. So
> when I do
>
> What now? at `seq 1 5`
> ls: cannot access 1: No such file or directory
> /bin/bash: line 1: 2: command not found
> /bin/bash: line 3: 4: command not found
> /bin/bash: line 4: 5: command not found
>
> What now?
>
> what's happening is
>
> execve("/bin/sh",
> ["sh", "-c", "$SHELL -c \" cd /tmp;ls `seq 1 5`\""], ...) = 0
> execve("/usr/bin/seq",
> ["seq", "1", "5"], ...) = 0
> execve("/bin/bash",
> ["/bin/bash", "-c", " cd /tmp;ls 1\n2\n3\n4\n5"], ...) = 0
> execve("/bin/ls",
> ["ls", "1"], ...) = 0
>
> and bash then goes on to try and run `2', `3', ...
> It's undergoing double interpretation.
I think this is all making an excellent argument for why all this built-in
magic should be pushed to external programs, where the behaviour will be
1) predictable, and
2) customizable by the end user (e.g a profile element to provide an
alternative program to run).
--lyndon