Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Re: `pwd -P` with systemd-homed causes inconsistent cwd state
- X-seq: zsh-workers 52274
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Kyle Laker <kyle@laker.email>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] Re: `pwd -P` with systemd-homed causes inconsistent cwd state
- Date: Sun, 5 Nov 2023 08:17:06 -0800
- Archived-at: <https://zsh.org/workers/52274>
- In-reply-to: <bc503217-55c8-4577-84b7-19853fa45d03@laker.email>
- List-id: <zsh-workers.zsh.org>
- References: <f31c3d78-11de-4aac-81d7-c061916a9108@laker.email> <CAH+w=7YepkrZ1EYkovCvH-Qib4LCqFMGaw+j3EG8Cn3bTaE+XQ@mail.gmail.com> <e3adbc41-1cba-46d7-99a7-552a14882c59@laker.email> <CAH+w=7YYuFa71r4c3XKZgrgsMEy9_ifQeMjYMBsOGQtM0qEhJQ@mail.gmail.com> <CAH+w=7bcBOGxYzVYSxaNu_8hEE2mtL7GS0vbAjWfQrYs2R1juA@mail.gmail.com> <6f0cc0e8-665f-4c90-ba6e-6180ebcf9d60@laker.email> <CAH+w=7YtPvL6odikmzyUg067DFd3cMhP-X1BwyTOkG7qO8x5vg@mail.gmail.com> <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() ...).
Messages sorted by:
Reverse Date,
Date,
Thread,
Author