zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: kyle@laker.email
Cc: zsh-workers@zsh.org
Subject: Re: `pwd -P` with systemd-homed causes inconsistent cwd state
Date: Fri, 20 Oct 2023 21:05:43 -0700	[thread overview]
Message-ID: <CAH+w=7YepkrZ1EYkovCvH-Qib4LCqFMGaw+j3EG8Cn3bTaE+XQ@mail.gmail.com> (raw)
In-Reply-To: <f31c3d78-11de-4aac-81d7-c061916a9108@laker.email>

On Fri, Oct 20, 2023 at 8:18 PM Kyle Laker <kyle@laker.email> wrote:
>
> I have found a strange behavior with ZSH when working with
> systemd-homed. After running `pwd -P` within my home directory, it seems
> as if the current working directory effectively changes to `/`. I am
> currently using ZSH 5.9 and systemd 254.
>
> systemd-homed is configured using a BTRFS subvolume.

This sounds like it must be the same issue as workers/52213 which also
involves doing operations on BTRFS mounts.

> What is unexpected is that after running
> `pwd -P` all other subprocesses act as if the `cwd` is `/`

When you run `pwd -P`, zsh invokes the getcwd() system call and prints
whatever it returns.  That's literally all it does.  So, although I
don't have BTRFS to test with, this looks from here like a problem
with getcwd() internally changing the process current directory to the
root when crossing a BTRFS link.  That would be invisible to $PWD and
therefore to the pwd command (without -P).

There are some cases where zsh itself would change the current
directory, e.g., if the parent of the current directory is removed
from the filesystem and a few other "catastrophic failure" cases, but
zsh would display a warning message in those circumstances and in your
example its happening silently ... another clue that whatever it is,
is behind zsh's back, so to speak.


  reply	other threads:[~2023-10-21  4:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-21  3:18 Kyle Laker
2023-10-21  4:05 ` Bart Schaefer [this message]
2023-10-21 16:26   ` Kyle Laker
2023-10-22 18:59     ` Bart Schaefer
2023-10-31  3:46       ` [PATCH] " Bart Schaefer
2023-11-02  2:54         ` Kyle Laker
2023-11-03  4:28           ` Bart Schaefer
2023-11-05 14:16             ` Kyle Laker
2023-11-05 16:17               ` Bart Schaefer
2023-11-05 21:10                 ` Bart Schaefer
2023-11-20 22:23                   ` Jan Alexander Steffens (heftig)
2023-11-23 17:53                     ` 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='CAH+w=7YepkrZ1EYkovCvH-Qib4LCqFMGaw+j3EG8Cn3bTaE+XQ@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=kyle@laker.email \
    --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).