On Sun, Jul 21, 2013 at 3:19 PM, Matthias Kilian <k...@outback.escape.de> wrote:
> On Mon, Jul 22, 2013 at 12:02:30AM +0200, Jérémie Courrèges-Anglas wrote:
>> Matthias Kilian <k...@outback.escape.de> writes:
>> > On Sun, Jul 21, 2013 at 10:51:17PM +0200, Joerg Sonnenberger wrote:
>> >> On Sun, Jul 21, 2013 at 10:01:33PM +0200, Alexander Hall wrote:
>> >> > I for one don't see a general interest in knowing ones parents
>> >> > potentially faked wd.

I cut my UNIX teeth on systems where home directories were
automounted.  Having programs use
     /home/usersb/17/guenther/whatever
instead of
    /tmp_mnt/nfs3.acc.stolaf.edu/usersb/17/guenther/whatever

was a glorious thing.  It was especially annoying when using one of
the older systems and some program wrote a /tmp_mnt/etc path into a
state file.  Die die die die...


>> >> You can find out your wd by saner means.
>> >>
>> >> There is no way to find the logical path without help from the shell.
>> >
>> > But if anything relies on the "logical" path, isn't something broken?

No, not if it verifies that it resolves to your currently directory
before using it.

That's where the problems are: code that just assumes $PWD is correct
without testing.  Scanning our base, I see that ksh, egcc, libiberty,
and perl Cwd module handle this correctly.  'make' is close: it's
missing the pwd[0]=='/' check.  lynx just trusts it and is therefore
buggy.  csh checks it, but the code uses an uninitialized variable if
HOME isn't also set to a non-empty value.  Oh, and the standalone
/bin/pwd should be replaced with a shell script.


>> I do agree that relying on ksh's magic is at best weird (I can't see
>> a real use case right now).  But the fact is that all shells I've tested
>> (bash, ksh93, dash) do export PWD by default (ok, not ksh88...).
>> Do we really ant to be different from almost other shells?
>
> Until somebody explains why exporting PWD by default is superior
> to *not* exporting it, I prefer our shell to be different, yes.
>
> I already think that the PWD magic on shell startup is very dubious,
> but hey, it's POSIX, so it must be good.

POSIX has done the wrong thing in places, but PWD isn't one of them.


> cd /some/where/with/a/symlink/in/it
> run some script making assumptions about the "logical path"
> boom

What assumptions or "boom" do you have in mind?


> (yes, that script would be wrong, but if every shell exports PWD
> by default, nobody will notice that the script is wrong)

I can't figure out what you have in mind for this.


Philip Guenther

Reply via email to