[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: init_buffer PWD fix

From: 永野圭一郎
Subject: Re: init_buffer PWD fix
Date: Mon, 22 Apr 2002 15:49:00 +0900
User-agent: Wanderlust/2.9.9 (Unchained Melody) EMY/1.13.9 (Art is long, life is short) LIMIT/1.14.7 (Fujiidera) APEL/10.3 Emacs/21.2.50 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI)

At Mon, 22 Apr 2002 10:03:22 +0300 (IDT),
Eli Zaretskii wrote:
> > init_buffer uses environmental variable PWD to identify current
> > working directory.  I think we should not use it on Windows.  On
> > Windows with Cygwin, PWD is unreliable and confusing, because
> > 
> > * Cygwin bash treats it
> > * Cygwin sh (ash) doesnot
> > * to say nothing of command.com, cmd.exe, nmake.exe and so on
> Sorry, I don't understand the problem.  command.com. cmd.exe etc. don't 
> set PWD, so the current Emacs code should DTRT.  I don't know about ash; 
> are you saying that it sets PWD to the wrong value?

No.  Cygwin sh (ash) is a lightweight Bourne shell, which does not
update PWD even when it does chdir.  Child processes inherit
environmental variables from their parent processes.  So when you
invoke ash from bash, and do 'cd' in ash, then you have an old and now
wrong PWD.  Same problems happen when you invoke command.com, cmd.exe,
nmake.exe from the bash shell.

> It's impossible to evaluate your suggestion without understanding the 
> details.  Please describe those details.  Thanks in advance.


bash$ printenv PWD              # in bash...
/home                           # now i'm here
bash$ cd work                   # chdir to work...
bash$ printenv PWD              # and PWD is updated
/home/work                      # it's ok
bash$ sh                        # invoke sh (ash)...
sh$ cd ..                       # and chdir to /home...
sh$ printenv PWD                # how about the PWD?
/home/work                      # Oh God!

Same problems happen quite often when you 'make' Emacs Lisp products
which have chdir in their 'Makefile's.

Keiichiro Nagano

reply via email to

[Prev in Thread] Current Thread [Next in Thread]