[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nmh-workers] I'm confused
From: |
Ken Hornstein |
Subject: |
Re: [Nmh-workers] I'm confused |
Date: |
Fri, 14 Sep 2012 14:41:09 -0400 |
>what's happening is
>
> execve("/bin/sh",
> ["sh", "-c", "$SHELL -c \" cd /tmp;ls `seq 1 5`\""], ...) = 0
Yeah, I was actually thinking to myself when looking at that code, "Hey,
doesn't our popen() use sh -c?"
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. Also, depending on "ls" output to get a list
of files seems like that's fraught with problems as well. I suspect that's
why Norm is getting a blank Nmh-Attachment header; there's a blank line
being output somewhere by his version of ls.
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? Expecting full-level shell interpretation at the
WhatNow? prompt just seems wrong. 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.
--Ken