zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Kyle Laker <kyle@laker.email>
Cc: zsh-workers@zsh.org
Subject: Re: [PATCH] Re: `pwd -P` with systemd-homed causes inconsistent cwd state
Date: Sun, 5 Nov 2023 08:17:06 -0800	[thread overview]
Message-ID: <CAH+w=7Zi3-HV3EUSommNJbrDQSd5H6aOttWjJ0DejyreGUeGGQ@mail.gmail.com> (raw)
In-Reply-To: <bc503217-55c8-4577-84b7-19853fa45d03@laker.email>

On Sun, Nov 5, 2023 at 6:17 AM Kyle Laker <kyle@laker.email> wrote:
>
> I've attached a patch that builds on yours.

Thanks.  I believe there's still some more that could be done here --
for example

+    if (!getcwd(buf, bufsiz)) {
+        if (d) {
+            return NULL;
+        }
+    } else {

The "if (d)" is extraneous here, we're just going to return NULL later
anyway.  That test implies that we'd later be attempting to use
fchdir() [via zchdir?] but in the failure case we won't.  I know you
carried this over from the previous code but it's extraneous there too
so we might as well fix it.

> The patch also removes
> `GETCWD_CALLS_MALLOC` because it was only used in that fallback case.

I think the reason for that may have been that a reason for failure is
that the buffer isn't large enough.  Rather than remove this, I think
it should actually be moved into zgetdir().

I'll put something together a bit later today, but in the meantime
would be interested in feedback from anyone else who has a better idea
how we arrived at this state (and possible what really is going on in
lchdir() ...).


  reply	other threads:[~2023-11-05 16:17 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
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 [this message]
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=7Zi3-HV3EUSommNJbrDQSd5H6aOttWjJ0DejyreGUeGGQ@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).