Re: [Nmh-workers] More than one parameters in .mh_profile

2012-05-30 Thread Aleksander Matuszak
Ken Hornstein writes:

 I need moreproc to be less -force but show (nmh-1.3) refuses
 this.
 
 Yeah, I guess what happens there is mhl (or whatever) is trying to
 exec(less -force).  Which as you've noted doesn't work.
 
 Other people have complained about this as well.  But in this case you
 could just set the environment variable LESS to f, right?
 

Not quite. In fact I need -force only in show, to enforce
silently displaying incompatibile charsets.

 Workaround is to make the shell script like vim-mail which is in
 fact call to vim  -c :set ft=mail .
 
 Is it possible to do such thigs simpler?
 
 Right now ... no.  To start, I have no idea how this interface should
 look like.  Suggestions here are welcome; code is even more welcome :-)


It does not seem too difficult to implement function which splits
any string into separate pieces and prepend them to exec*
parameters. But discussion shows that fundamental question is
rather: should it be passed to the shell (and gives chance to use
!$ or some such) or replace the shell job and interpret string inside
the code?

Finally, I think it is not worth to solve it now.

   max


___
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers


Re: [Nmh-workers] More than one parameters in .mh_profile

2012-05-30 Thread David Levine
Paul wrote:

 p.s. incidentally, mh-profile.5 mentions $SHELL only in the context
 of bbl, which no longer exists.

Already fixed, prior to the 1.5 branch.

David

___
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers


Re: [Nmh-workers] More than one parameters in .mh_profile

2012-05-30 Thread Paul Fox
david wrote:
  Paul wrote:
  
   p.s. incidentally, mh-profile.5 mentions $SHELL only in the context
   of bbl, which no longer exists.
  
  Already fixed, prior to the 1.5 branch.

oops.  i was looking at the .5 file, not the .man, and it was out of date.

paul
=-
 paul fox, p...@foxharp.boston.ma.us (arlington, ma, where it's 69.1 degrees)

___
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers


Re: [Nmh-workers] More than one parameters in .mh_profile

2012-05-30 Thread Ralph Corderoy
Hi Paul,

 i think passing any moreproc entry that contains whitespace to
 /bin/sh -c '%s', and documenting it as such, would be fine.

IOW, system(3).

 processes aren't nearly as expensive as they used to be.

I think Perl goes to lengths to avoid it because you may be doing a lot
of them.  With nmh, it's going to be one or two per human action?

Cheers, Ralph.

___
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers


Re: [Nmh-workers] More than one parameters in .mh_profile

2012-05-30 Thread Ken Hornstein
To answer a bunch of emails on this topic:

Ralph Corderoy says:
No `#'?  How about just always send to the user's shell from the
password entry with a -c, as distinct from /bin/sh.

I guess I wasn't thinking of #, but if perl doesn't check for it it makes
me think it's not really useful to check for it (I mean, really, what
are you trying to do there?)  Also, I think I'm with others ... what
is the advantage to using the user's shell here?  Like Jerrad Pierce
said, /bin/sh seems to be the LCD here.

(As an aside ... didn't know there was a shell called Zoidberg!  Hah!)

Valdis Kletniecks says:
The problem is that some people (at least in the Elder TImes) would have
their login shell set to /bin/csh but they'd want their scripty things done in
/bin/sh.  (I used to do that myself, way back when csh had ! history and sh
didn't until it became bash).

Does anybody still do that?

Yeah, I still do that (and I guess I'm not the only one).

Paul Vixie says:
for that we have getenv('SHELL'), which is far more closely related to
the user's preferred command language than either their login shell or
the posix standard are going to be.

Is it?  I always thought SHELL was set by the shell itself.  My SHELL
is /bin/tcsh, but I prefer to write in /bin/sh.

Lyndon Nerenberg says:
This conversation is cool.  It reminds me of a phone call I had with
somebody in the pit at ATT tech support, arguing about why they could
never drop '^' as the pipeline separator in their SVR1 /bin/sh.  The
lad was absolutely convinced '|' was an expression of the new heretics,
and would not stand past the next corporate quarter.

Man, I had to look that up ... SVR1 came out in 1983 :-)  And I can
barely find any mention of ^ as the pipeline separator character.

Aleksander Matuszak says:
It does not seem too difficult to implement function which splits
any string into separate pieces and prepend them to exec*
parameters. But discussion shows that fundamental question is
rather: should it be passed to the shell (and gives chance to use
!$ or some such) or replace the shell job and interpret string inside
the code?

Well, the problem is that one of the examples you posted wouldn't work
with simple space splitting; we'd need to interpret quotes.  Then we'd
need to specify how to escape quotes, then we'd want complete backslash
escape support  it just gets awful quickly.  If we can say, it's
run under /bin/sh -c then that lets people use the Bourne shell syntax
which is actually standardized.

Paul Fox says:
summary:  i think passing any moreproc entry that contains whitespace
to /bin/sh -c '%s', and documenting it as such, would be fine. 
processes aren't nearly as expensive as they used to be

I'll probably work on it in a few weeks ... I might just do the
space-splitting anyway since the code has mostly been written.

Ralph Corderoy says:
IOW, system(3).

Not exactly.  In the case of moreproc it's actually a popen clone (m_popen).
In the case of Editor it's closer to system(), but some extra stuff happens
after the fork and before the exec(), so we can't just use system().

--Ken

___
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers


Re: [Nmh-workers] More than one parameters in .mh_profile

2012-05-29 Thread Ralph Corderoy
Hi Ken,

 for (s = cmd; *s; s++) {
 if (*s != ' '  !isALPHA(*s) 
 strchr($*(){}[]'\;\\|?~`\n,*s)) {
 
 Seems like that's a pretty good list; if we see one of those
 characters, it gets sent to /bin/sh -c.  Otherwise we split and do it
 ourselves.

No `#'?  How about just always send to the user's shell from the
password entry with a -c, as distinct from /bin/sh.

Cheers, Ralph.

___
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers


Re: [Nmh-workers] More than one parameters in .mh_profile

2012-05-29 Thread valdis . kletnieks
On Tue, 29 May 2012 10:01:22 +0100, Ralph Corderoy said:

 No `#'?  How about just always send to the user's shell from the
 password entry with a -c, as distinct from /bin/sh.

The problem is that some people (at least in the Elder TImes) would have
their login shell set to /bin/csh but they'd want their scripty things done in
/bin/sh.  (I used to do that myself, way back when csh had ! history and sh
didn't until it became bash).

Does anybody still do that?


pgpaKWgRbbZgX.pgp
Description: PGP signature
___
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers


Re: [Nmh-workers] More than one parameters in .mh_profile

2012-05-29 Thread Kevin Cosgrove

On 29 May 2012 at 8:00, valdis.kletni...@vt.edu wrote:

 On Tue, 29 May 2012 10:01:22 +0100, Ralph Corderoy said:
 
  No `#'?  How about just always send to the user's shell from the
  password entry with a -c, as distinct from /bin/sh.
 
 The problem is that some people (at least in the Elder TImes) would have
 their login shell set to /bin/csh but they'd want their scripty things done in
 /bin/sh.  (I used to do that myself, way back when csh had ! history and sh
 didn't until it became bash).
 
 Does anybody still do that?

Why yes, my login shell is /bin/tcsh and I program in sh, bash, perl.

bash has made huge strides since I ran csh, and one day I hope to 
switch over and have only one shell to worry about.

Cheerio...

--
Kevin



___
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers


Re: [Nmh-workers] More than one parameters in .mh_profile

2012-05-29 Thread Ralph Corderoy
Hi Valdis,

  No `#'?  How about just always send to the user's shell from the
  password entry with a -c, as distinct from /bin/sh.
 
 The problem is that some people (at least in the Elder TImes) would
 have their login shell set to /bin/csh but they'd want their scripty
 things done in /bin/sh.  (I used to do that myself, way back when csh
 had ! history and sh didn't until it became bash).

Me too.  Wasn't the method then to have sh scripts start with non-#,
e.g. colon, and then csh/tcsh would spot that and run them under sh?
All pre-#!, of course.

(I was a csh, then tcsh user for many years.  Finally moving to bash as
it gave !-history and `set -o vi' command-line editing.)

Cheers, Ralph.

___
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers


Re: [Nmh-workers] More than one parameters in .mh_profile

2012-05-29 Thread Tethys

valdis.kletni...@vt.edu writes:

 No `#'?  How about just always send to the user's shell from the
 password entry with a -c, as distinct from /bin/sh.

The problem is that some people (at least in the Elder TImes) would have
their login shell set to /bin/csh but they'd want their scripty things
done in /bin/sh.

In which case, couldn't they just do sh -c whatever as the thing that
would get passed to their login shell (i.e., csh)? It's a bit clumsy,
but it should work for the few people that are in that situation.

Tet

___
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers


Re: [Nmh-workers] More than one parameters in .mh_profile

2012-05-29 Thread Jerrad Pierce
In which case, couldn't they just do sh -c whatever as the thing that
would get passed to their login shell (i.e., csh)? It's a bit clumsy,
but it should work for the few people that are in that situation.
Why do you want to use the user shell exactly?

Yes, the user might be more familiar with its syntax,
but it seems rather common in situations like this to
go with the LCD and leave it at /bin/sh. This could also
make support easier since it ought to narrow the options
for surprises e.g; someone forgets to mention that their
shell is actually zoidberg or some other esoteric thing.

___
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers


Re: [Nmh-workers] More than one parameters in .mh_profile

2012-05-29 Thread Paul Vixie
On 2012-05-29 2:46 PM, Kevin Cosgrove wrote:
 On 29 May 2012 at 8:00, valdis.kletni...@vt.edu wrote:

 ...

 Does anybody still do that?
 Why yes, my login shell is /bin/tcsh and I program in sh, bash, perl.

me too, give or take a conditional exec tcsh in my .cshrc file.


___
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers


Re: [Nmh-workers] More than one parameters in .mh_profile

2012-05-29 Thread Lyndon Nerenberg

On 2012-05-29, at 7:19 PM, Paul Vixie wrote:

 for that we have getenv('SHELL'), which is far more closely related to
 the user's preferred command language than either their login shell or
 the posix standard are going to be.

This conversation is cool.  It reminds me of a phone call I had with somebody 
in the
pit at ATT tech support, arguing about why they could never drop '^' as the 
pipeline separator in their SVR1 /bin/sh.  The lad was absolutely convinced 
'|' was an expression of the new heretics, and would not stand past the next 
corporate quarter.

And then there was the Wollongong, followed by Lachman, TCP stack.

What does this have to do with nmh?  Nothing, really.  I was running MH on an 
assortment of Sun 3/* gear while I desperately tried to evict the undead 3B4000 
from the shop.  MH helped in the effort ;-)
___
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers


Re: [Nmh-workers] More than one parameters in .mh_profile

2012-05-28 Thread Ken Hornstein
I need moreproc to be less -force but show (nmh-1.3) refuses
this.

Yeah, I guess what happens there is mhl (or whatever) is trying to
exec(less -force).  Which as you've noted doesn't work.

Other people have complained about this as well.  But in this case you
could just set the environment variable LESS to f, right?

Workaround is to make the shell script like vim-mail which is in
fact call to vim  -c :set ft=mail .

Is it possible to do such thigs simpler?

Right now ... no.  To start, I have no idea how this interface should
look like.  Suggestions here are welcome; code is even more welcome :-)

--Ken

___
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers


Re: [Nmh-workers] More than one parameters in .mh_profile

2012-05-28 Thread Ken Hornstein
Sure, it COULD do that.  Sounds like you're volunteering to write
the code; great! :-)
I hack perl, not C. I did quickly grep the perl code base for it though,
but being on a tablet at the moment could not dive too deeply.
nmh is non-GNU, but perl is dual-licensed under the Artistic License.

I take you haven't LOOKED at the perl source code lately?  Talk about
seeing how the sausage is being made; I will never complain about our
mess of ifdefs again.

But I'll save you the trouble.  Inside of Perl_do_exec3() the key lines
sems to be:

for (s = cmd; *s; s++) {
if (*s != ' '  !isALPHA(*s) 
strchr($*(){}[]'\;\\|?~`\n,*s)) {

Seems like that's a pretty good list; if we see one of those characters,
it gets sent to /bin/sh -c.  Otherwise we split and do it ourselves.  Would
that make people happy?

--Ken

___
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers


Re: [Nmh-workers] More than one parameters in .mh_profile

2012-05-28 Thread Jerrad Pierce
Could nmh not do with such parameters what perl does for
system()/exec(), auto-splitting the string? In the off
chance that someone's installed binaries in a path with
a space they can escape the space, same as they would in
a shell...

___
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers


Re: [Nmh-workers] More than one parameters in .mh_profile

2012-05-28 Thread Ken Hornstein
Could nmh not do with such parameters what perl does for
system()/exec(), auto-splitting the string? In the off
chance that someone's installed binaries in a path with
a space they can escape the space, same as they would in
a shell...

Sure, it COULD do that.  Sounds like you're volunteering to write
the code; great! :-)

In all seriousness ... yeah, that's probably close to an ideal solution,
but it gets complicated quickly in terms of handling quoting (see the
vim example posted earlier).  AFAICT there's no library function to handle
shell-style quoting.

Actually ... I see that what perl does is check for shell metacharacters;
if they exist, then the whole thing gets passed off to sh -c.
Otherwise it's space-splitted and passed directly to execvp().  You
know ... that's actually not that much code to write and we already
have a space-splitting function (brkstring).  What do people think
of that as a solution?

--Ken

___
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers