nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] I'm confused

2012-09-14 13:46:31
Ken Hornstein writes:
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

OK, well, this stuff did fine for years.  Guess those shortcut hacks are
coming back to haunt me.

glob won't work because it doesn't do tilde expansion but wordexp does.
Having a real attach command would give Norm a place for documentation.

Jon

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>