zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: Prompt dir expansion after removing cwd's parent
Date: Wed, 8 Jun 2022 10:41:59 +0100 (BST)	[thread overview]
Message-ID: <1644026654.700770.1654681319674@mail2.virginmedia.com> (raw)
In-Reply-To: <20220608091426.GA15730@tarpaulin.shahaf.local2>

> On 08 June 2022 at 10:14 Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> 
> 
> With 5.9:
> 
>      1	% cd /tmp
>      2	% PS1='%~%# '
>      3	/tmp% mkdir foo foo/bar 
>      4	/tmp% cd foo/bar
>      5	/tmp/foo/bar% rm -rf /tmp/foo
>      6	/tmp/foo/bar% cd ..
>      7	/tmp/foo/bar% cd ..
>      8	/tmp% 
> 
> The prompts on lines 6 and 7 are wrong.
> 
> Ideally I'd like to see some indication that cwd has been deleted, or
> that a path to cwd couldn't be determined, etc..  Definitely not some
> apprently-valid path that points to something else than cwd.

It looks like prompts currently just passively look at the internal pwd
variable, so make no kind of checks of the environment of any sort.
Presumably a getcwd() is needed each time the prompt is updated.
We also need to decide how to signal this.

However, it looks like this has wider ramifications as it appears
"pwd" and "pwd -P" both just shrug their shoulders and return
the last known current directory in this case.  For both, bash gives
the more logical

pwd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

pws


  reply	other threads:[~2022-06-08  9:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08  9:14 Daniel Shahaf
2022-06-08  9:41 ` Peter Stephenson [this message]
2022-06-08 16:15   ` Bart Schaefer
2022-06-09  1:10     ` Bart Schaefer

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=1644026654.700770.1654681319674@mail2.virginmedia.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.org \
    /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).