Date:        Wed, 30 Jul 2025 09:31:52 -0600
    From:        Stan Marsh <gaze...@xmission.com>
    Message-ID:  <e1uh8mw-0000000eygt-0...@shell.xmission.com>

  | I wonder why "" was previously special-cased.

Once upon a time, chdir("") would have acted the same as chdir(".")
because in the kernel, the pathname lookup would see that this is
a relative path (doesn't start with '/') so the path lookup starts
at "." then it would extract the next pathname segment - but as there
isn't one, the pathname given has ended.   We're currently at "."
when the search ends, all good, use that.

When kernels were changed to stop acting like that, and treat "" as
an invalid pathname, I assume (it was in a period I was not paying
much attention to anything unix related - mid/late 1990's) that shell
authors simply decided to retain the status quo with cd "" and make
it stay acting the same as cd .

The similar code in the NetBSD shell was added in 1996 - copying code
that was already in the FreeBSD shell of the time.   I haven't removed
that from the NetBSD shell yet (FreeBSD did, earlier this month) but
it will probably happen.

kre


Reply via email to