From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1082 invoked from network); 5 Nov 2023 16:17:36 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 5 Nov 2023 16:17:36 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1699201056; b=VOfvsfvd+/N4pnxbNGdLyR4itv6dzrwePuHvV4VvEncZHhN2V2pgDK0rhpn4JyH1hjsQ1WL5ot Q9g8JNo+6CGgufcGzxDCWfm2Bap0bHDq2YkV9S8hn+qzRaodFMwY0lamtzvBWgF1P6NxbVpAc9 Mpi6VaZbIT1Csr5P/J9W2b/Rsg4opnvH8pLfhpfRS4ka7R4qIJVljMNyM2cAkz413OqqcRytAz EtuIOEqNMUvhstDV9KyxFu9q+gQ2FLukAEYuPBhqvcYw5ZSjgSwmhCbovmNE5PiWIDkI6VfDSy TEDwZI0/zOy8/qQD8N3YwJUfTwQCdm7f+XE4WcizINDCXA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ed1-f51.google.com) smtp.remote-ip=209.85.208.51; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1699201056; bh=H2lpVdr5oalfGsPEHsXes6aU4+ySqiMvVUbs4n+3XLo=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=cUDevN4tyafTHZk8gOVHMaQ560wmsOqQlbh2GLJcDdqSyQ+ts7FadXeSyJ5IW1oImVTIgj5x11 ucEHgCuv9aUboF1N7ZZjGUT8IRf2eJPf5oYDIk1klh3CxIGs6RlqJi81mWCClhcUsDlQOkQnDb Z7AZfq3jRAjBltfEhp/eP7/2rtcBIaM7zfHvJb+JT9rCS6tEedct3FRYcWKwM7N5QPTj+kpbAL klI6CVKeodMqndxRSvU2pa7xSB31i0LvLsFdd6RLTSY+QGioUX0cS7t/TIFm6pBBf5p+hoT++/ EZGrv6mcQgM3ujJHQAPfxda6RAI5CV1j/3afWQa2WOIFVA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=wIk00s1KzLlpl970/SMoC46564/7rtAQ/azDoit5hXg=; b=elioY4NB42O8LeXbn9FKZI11lV W5hsxSrVk/j7dJ6JVZrFdzAmejzo+rMOG3rdQ2wtQxZQmuYzEUfDQG2HhLnpf0zHXgSaa84Z6RoQz xctHIFGUg2qLXV9dcpqeSryWe4SN8+9zRjCKkECRSX6FDcCrx+8gwb3vAvUuwwsWGBlb32WpSWR60 ufDm1uYLxrFTOJEjOELsR184Mj2U1ZbReTg4EcIExccaJmjkQHLSgvQ7K1tkt6X8RzZwrfBg0R42a uuMcv9mm6EDSy65vSVy4IZ6wsY+n5hK90rOHKwN754q8lfYR8p8Mz8JxUBkw5ZX7w1XOODmU/tHlN 84zbHb3g==; Received: by zero.zsh.org with local id 1qzfoc-000InQ-96; Sun, 05 Nov 2023 16:17:34 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ed1-f51.google.com) smtp.remote-ip=209.85.208.51; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ed1-f51.google.com ([209.85.208.51]:56379) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1qzfoM-000IVM-1l; Sun, 05 Nov 2023 16:17:19 +0000 Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-52bd9ddb741so6067690a12.0 for ; Sun, 05 Nov 2023 08:17:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20230601.gappssmtp.com; s=20230601; t=1699201037; x=1699805837; darn=zsh.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=wIk00s1KzLlpl970/SMoC46564/7rtAQ/azDoit5hXg=; b=3IMiAX0Hopu62NQkAVb+D5cdH3qAo+3eoLyO7yG60kLw1jcTLbwmln+78t0o3XpCa4 6U1p3KbJxguKiAvk8lB0Gr8HJsxntlsJHmQy9+MxekoXt6vm47MryKtVjcj9re5ZvcsU JKqgWyRpzw5k4WlIIIMCXnt5pAF71+L/KWAhQ97Xfic6cf18pyDEMtQI+/iWXbljChNg C+Fc8KKKu7Wnf+s4azu9PhV844CmngFWvIljfkBsYWMsIrgx3Yshq8Xf/vHDgHRuZBUq gFyGsqH3k25SM1Yr5pFuHrnD11SUjDBBml6klEI5v4CBZFyd6yiFDAazUx9yaS5t2LAz KRIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699201037; x=1699805837; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wIk00s1KzLlpl970/SMoC46564/7rtAQ/azDoit5hXg=; b=kV8Zwjdf679Rbvx/2jR9AWrSUxEUre2j39GV6lyd1ky5gi+U1oxZg6KTcNeDAAfR0Y lpIoDwC2vk6opuhHwMVCyKEfdd6fhl4w7A5BzXL5cs9ES77sYJXMpxtxDAL4tZEWwfsN 4pjQSbrm55U2EsRZ16yp8cZSTJgM5ozGWHCidsT+pBwpo+rjYNm6fRZMdzoS0xJm98hT hpBm//4fO4QV/tBiVlKp60M5+iAE2DlisjPPozj8Dpegh8M7X6EMsWdDhZktQN9cVm7i 1QCa7rYhGA/g7OxvH7IMzgPE/UR4nQKqnI9JD3CrmtxaxuYdsYB208kJ2jjriVk/Lq5S rIaA== X-Gm-Message-State: AOJu0YzRoBYaU5RIZ2bK+MhYc32LgDF0P2cr38Kw04Iy5Xyysh/t33as YvJKduP+/oVCexo9xm+GrkIArB3yx2J4czdAuNj6ZjrC7VLeZUWoUdE= X-Google-Smtp-Source: AGHT+IEp3NsPmT3g07f8OX9hcNWwEPjlO8nZRMyZujyqmD9l62zIYO0riBIyp6gYa4IYwqzdkFqYTqjrzPkAohCwGZA= X-Received: by 2002:a17:907:4cd:b0:9c2:2d0a:320c with SMTP id vz13-20020a17090704cd00b009c22d0a320cmr7653192ejb.46.1699201037346; Sun, 05 Nov 2023 08:17:17 -0800 (PST) MIME-Version: 1.0 References: <6f0cc0e8-665f-4c90-ba6e-6180ebcf9d60@laker.email> In-Reply-To: From: Bart Schaefer Date: Sun, 5 Nov 2023 08:17:06 -0800 Message-ID: Subject: Re: [PATCH] Re: `pwd -P` with systemd-homed causes inconsistent cwd state To: Kyle Laker Cc: zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 52274 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On Sun, Nov 5, 2023 at 6:17=E2=80=AFAM Kyle Laker 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() ...).