emacs-devel
[Top][All Lists]
Advanced

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

Re: init_buffer PWD fix


From: Paul Eggert
Subject: Re: init_buffer PWD fix
Date: Wed, 24 Apr 2002 12:19:03 -0700 (PDT)

> From: MIYASHITA Hisashi(=?ISO-2022-JP?B?GyRCNVwyPBsoQiAbJEI+MBsoQjpISU1J?=)
>  <address@hidden>
> Date: Thu, 25 Apr 2002 02:13:30 +0900

> I can imagin many bad situations.  Suppose the following
> situation as an example.
> 
> (1) sh or tcsh set "PWD" and the current directory to "c:/PROGRA~1"

This should happen only if either:

 A) the user types "cd c:/PROGRA~1"; or
 B) getcwd returns "c:/PROGRA~1" when sh starts up.

In case A), the user has indicated a preference for the name "c:/PROGRA~1",
so that is a better name for Emacs to use.

In case B), there's no difference between using PWD and using getcwd,
so there's no problem.


> On Windows, however, it's not only useless but also harmful, I think.

I don't see any extra harm in Windows.  The situation is similar to
that on Unix.

The Unix convention is that PWD is the preferred name for the working
directory.  Most Unix shells obey this convention.  A few older shells
don't, and in that case the user gets a name other than the preferred
name; but the name still works so it's not a major problem.

Windows seems quite similar here, once we fix the bug in w32.c.


> The above case is an example to affirm relying on "PWD" by obscure
> convension is maybe harmful.

It's not an obscure convention; it's in the POSIX standard.

All other things being equal, it's better for w32.c to provide POSIX
behavior; that isolates the Windows-specific stuff into w32.c instead
of requiring Windows-specific changes to the rest of the code.  eliz
has proposed a fix along those lines, and this seems preferable to me
as well.


> From: MIYASHITA Hisashi(=?ISO-2022-JP?B?GyRCNVwyPBsoQiAbJEI+MBsoQjpISU1J?=)
>  <address@hidden>
> Date: Thu, 25 Apr 2002 03:25:57 +0900
> 
> But "PWD" is NOT cared by almost all of the Windows application.
> On the contrary, Get/SetCurrentDirectory() is always cared.

This is like Unix.  On Unix, most applications don't use $PWD; they
use the working directory.  The only applications that set and use
$PWD are those that care about using a "nice" name for the working
directory.

The situations seem to be analogous.  In both systems, you can
have multiple names for the same directory (because of symbolic
links, or file name mangling, or backslashifying, or whatever).
It's nice to use the user's preferred name for a directory even
if it is not canonical, and $PWD is the standard way to do this.



reply via email to

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