nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] whatnow(1)'s cd Doesn't Affect it's mime.

2017-01-18 07:14:34
Hi Jon,

David wrote:
It's very unintuitive, well, wrong, that a `cd' command at a
command's prompt doesn't change the current working directory as
far as all other commands are concerned.  That's not how other
Unix commands that provide cd work.  If it can't be fixed then
whatnow(1) could do with pointing it out.

Well, yeah.

Well, since I'm responsible for this, I don't agree with you.  Yes, it
might be unintuitive if you're not familiar with UNIX, but it is how
it works.  If you type

      sh
      cd foo
      exit

you will not be in foo.  Whatnow is a subshell.

I have some familiarity with Unix.  ;-)

My complaint, and whatnow(1)'s behaviour, is, in normal sh terms, more
akin to

     1  $ pwd
     2  /
     3  $ mkdir foo
     4  $ date >foo/bar
     5  $ cd foo
     6  $ pwd
     7  /foo
     8  $ ls
     9  bar
    10  $ cat bar
    11  cat: bar: No such file or directory
    12  $ cat foo/bar
    13  2017-01-18 12:51:06 +0000 Wed

It's like a sh(1) that implements its built-in `cd' without calling
chdir(2), instead tracking cwd as a string to supplement other commands,
but only some of them.  Thus, 6 and 8 "lie" that we've chdir'd, yet 10's
cat, not one of the annointed commands, can't find bar and must instead
must give a path as if the cd didn't happen.  cat here is `mime' at the
whatnow prompt.

When implementing this, was there a reason whatnow doesn't implement
`cd' with chdir, as normal Unix commands that offer cd do, and instead
"fake" it for `pwd', `ls', and `attach', but not `mime', etc?

-- 
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy

_______________________________________________
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>