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, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 14676 invoked from network); 9 Feb 2022 17:17:37 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 9 Feb 2022 17:17:37 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1644427057; b=bjxycHFxoLL6pxbzQssw9JkDMP60/EuJDdn+FBJbApJ2/2wasAB7vV/XQDdZQO3jgd13Spe4yA qwbrSfb1p0lAeeguzufzuL59reVEwJDTk6XDXWF6B9OKytxe8q+mjB/ujGLCKuY7UmulgX0ISb BBjZedPg5NFQVoewJNwZohxSgf4WkZoiVxTFHooPd5jC/datjbwazCFGQEExqU6dS36luqos86 +IzDnvovvotIpUmMLe01MqtEKE/VqbslWxYjd/UPRLyHUmyQrXpn4WZnug7tfIQV8sE0pbFFfa jbrEZmsKTy87gN78yQWdFwAAcusT4zV2SCXuSFNfzOXFog==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-yb1-f179.google.com) smtp.remote-ip=209.85.219.179; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 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=1644427057; bh=xE/D9fjWndrqkvlIAMRaI0XyWx8fNn6MiQPoJmfOdDY=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=cA8Ij/RFb9zzPu68ay1BuPfixkyNziFsGqUTp2gHLrQfMkRtQ7cs/lfFfUc/579/Y8Uais7Rkx FAiye1yObWhEWuDon8AQo+XDCiCu892WB0yJ4ghzEMH8ACnuIsdhXfDilHuAfs7wx26dS2XCnI RjNN6oLssP5svN3uuub3xGygyqpOD2C2sQjJnD2mqNuFJ9wIjkeYCBgmuaNYXunpKLl+1uoc2b gvRlCXfczhO/ziqhyopo2HrWa997qSX9eATrhkK14nVwlJ6C3uD5sqNwtSl4ud4H1+dAn4u2GF egQJEtj+UanioXs04ZvXaiqg40szTlmuaLF0Ym09LGhc8A==; 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-Type:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=G8jbPNPTTR5qSg2Yg4r0NZ4COowcA80uh3/hqxFauJA=; b=PEPvNdgn+OP5EjyHauuvpYkdJD t4FKmO8UCEJOmJ7DEs2kebqaypdcKtflkXcqliYJsKHd1UZf6RbU+5D+DqbcksCGAN8YBPHjbXqLM F3oJ4uiHaoUO6TrCFytAn4KXV3cjuNFv4/sIZyN8X3Oh62oAhx7wS7W+FVeZN2w2yE9JpDi1uQhKg MphGtBwrRZyxClSxx8OXgXTKnpdz4IEhySd9iAvoRx+VaJh2y39gqR50J50AOOVOD3wXMYeZOc7eu avAHHcQg0eD2SkTntkx0w65XASlwqfItaVzV2HUpeXM93JlYtV1Y0G1Py9UlvxvfKli/2Ur8JwZom m+rFqgAg==; Received: from authenticated user by zero.zsh.org with local id 1nHqb3-0002Tm-9H; Wed, 09 Feb 2022 17:17:37 +0000 Authentication-Results: zsh.org; iprev=pass (mail-yb1-f179.google.com) smtp.remote-ip=209.85.219.179; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-yb1-f179.google.com ([209.85.219.179]:37660) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1nHqaQ-00028s-Is; Wed, 09 Feb 2022 17:16:59 +0000 Received: by mail-yb1-f179.google.com with SMTP id v47so7989770ybi.4 for ; Wed, 09 Feb 2022 09:16:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=G8jbPNPTTR5qSg2Yg4r0NZ4COowcA80uh3/hqxFauJA=; b=DDR05jfIsSIAtzppSlj5TSEWXZFEOkr/n4m3P+lunJRmDsd7s4cR3OOBNG0ZzIaE/I Hi0bB9qXlXdevNrgwhjbnuHe9Ls3ijWpRlZR023BWmZwpkOdJH6b126rqu/10B3FXFvB Jmj4pq7Vux+JgKUHT3znYq15J5wHbjWiUk3nM1jfJ6zg212TWxtK9O3abt/zusG0zh/Q BZMR+ik8dugxwogBsZGbuhkjhE0tJJFpPok2ezAuen9lqHU0J/1myb01+KBq3xjEa9H7 CWyI595CSSlAZUvXv68xx674OvsjhIDwicBPfBsvhQx9623gU3aDjr7Hj4f/DJFnnzpk QeBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=G8jbPNPTTR5qSg2Yg4r0NZ4COowcA80uh3/hqxFauJA=; b=VCCqgJ2TRPMmXfiBbY+quUDbiRsfQPOWGFFAMD9OYYgQ78xxNrLLD12QwXqAKgfrev I7opja6BwinSv0UX3bDfOyg3G0o6loAWM9BUfiHKzyrFnjjw7uJpwfAMN/iJVPqJzznl OofSiQA/KSkwl5gjoFF9CR6QPNt9mTSJAJCLs7Kwu9H58it7CpfKWfH5dlQcOrjATmT8 UwwU8rTIQDmJDoSsjTh/9qPYt5CXNkr3S8u8himsT2DZXQg1CZ3SBjt3ykCRPEYikYgG cCqWBaWIZCmmeYAUjUi83IZ9GOrkN3YPe3XDrwcPlKNxXQoOPXvi+1LoVPbXwYW1UGG6 DfIA== X-Gm-Message-State: AOAM530cwdPtvBjg7uiEMj1uZ1NZuW/OxerijuTvG5u/2Hujfh7sMCIA ZMXib1NZR9ZJ3iiz/tgjMmpDEsAXI7aUPzowWP7AGOdK2prYycdJ X-Google-Smtp-Source: ABdhPJy/OFNwy78SBfch12DnpRRN6jHDs5jH6pEdGXkU5oqZpdo0tSczblSE5bqn+z8Ha+1eGjnaIJvV6zTLjRbBpRc= X-Received: by 2002:a25:2f0d:: with SMTP id v13mr2874916ybv.323.1644427017028; Wed, 09 Feb 2022 09:16:57 -0800 (PST) MIME-Version: 1.0 References: <20220206174406.rirklyrkzlx6winw@chazelas.org> In-Reply-To: <20220206174406.rirklyrkzlx6winw@chazelas.org> From: Bart Schaefer Date: Wed, 9 Feb 2022 09:16:46 -0800 Message-ID: Subject: Re: can we have an option for cd to do a plain chdir() To: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 49748 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: I started looking at this myself a while back but couldn't find a way to untangle the function dependencies. They're oddly factored and other parts of the shell depend on some of the bits in the middle. For example ... On Sun, Feb 6, 2022 at 9:44 AM Stephane Chazelas wrote: > > $ strace -fe getcwd,readlink,chdir,fchdir zsh -c 'cd link' > readlink("/proc/self/fd/0", "/dev/pts/4", 4095) = 10 > chdir("/home/chazelas/link") = 0 > chdir("/home/chazelas/link") = 0 > +++ exited with 0 +++ > > Not sure why the two chdir()s there. I'm pretty sure that's because there's first a chdir() via cd_try_chdir() which might fail (e.g., searching cdpath), and then once the full path has been confirmed there's another chdir() to make sure the shell is actually in the directory that was found. It has long felt to me as though the whole thing could be simplified, but I set it aside after a few of my attempts broke various special-case semantics. I'm also not certain that Test/B01cd.ztst is comprehensive in terms of catching possible regressions.