zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: zsh-workers@math.gatech.edu
Subject: PATCH: 3.1.5-pws-3: Namedir behavior of PWD is still strange
Date: Mon, 14 Dec 1998 20:31:18 -0800	[thread overview]
Message-ID: <981214203118.ZM32726@candle.brasslantern.com> (raw)

This is with 3.1.5-pws-3, run as zsh -f:

zagzig% echo ~PWD 
/usr/local/src/zsh/zsh-3.1.5-work/Src
zagzig% dirs
~PWD
zagzig% pushd work build
/usr/local/src/zsh/zsh-3.1.5-build/Src ~PWD

(Whups, the dirtable entry for PWD didn't change when PWD did.  Should
be "~PWD /usr/local/src/zsh/zsh-3.1.5-work/Src" if anything.)

I'm beginning to question my own prior conclusion, and to believe that
PWD and OLDPWD should simply *never* be named directories, whether or not
such naming was explicitly requested.  Why would anyone ever *intend* to
cause the following?

zagzig% dirs
~PWD ~OLDPWD

The following patch causes the dirtable to be kept up to date once an entry
is in it, even for PWD.  However, we should discuss again what is the most
desirable behavior.  Maybe the right thing is to permit PWD and OLDPWD to
be named directories, but never use them when displaying abbreviated forms?

Index: Src/utils.c
===================================================================
--- utils.c	1998/12/11 12:09:51	1.7
+++ utils.c	1998/12/15 04:02:28
@@ -510,16 +510,13 @@
     if ((flags & ND_USERNAME) && nameddirtab->getnode2(nameddirtab, s))
 	return;
 
-    /* Never hash PWD unless it was explicitly requested */
-    if (!always && !strcmp(s, "PWD"))
-	return;
-
     /* Normal parameter assignments generate calls to this function, *
      * with always==0.  Unless the AUTO_NAME_DIRS option is set, we  *
      * don't let such assignments actually create directory names.   *
      * Instead, a reference to the parameter as a directory name can *
-     * cause the actual creation of the hash table entry.            */
-    if (!always && unset(AUTONAMEDIRS) &&
+     * cause the actual creation of the hash table entry. Never hash *
+     * PWD unless it was explicitly requested (or already hashed).   */
+    if (!always && (unset(AUTONAMEDIRS) || !strcmp(s, "PWD")) &&
 	    !nameddirtab->getnode2(nameddirtab, s))
 	return;
 

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


             reply	other threads:[~1998-12-15  4:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-15  4:31 Bart Schaefer [this message]
1999-02-02  9:31 ` PATCH: 3.1.5-pws-6: named directories again Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=981214203118.ZM32726@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).