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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 10854 invoked from network); 1 Dec 2023 03:12:07 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 1 Dec 2023 03:12:07 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1701400327; b=Qbblr20e9dl32n2sS0FSz4kpQtpzSbDG4nDsHnhhHIlj9jSsZ4UMr29f+NFytFHxrGjgWcQuS9 8OZboRdPjIMStL1TBU8vBIeDlg9oYX2Y048IttQka+CuWwMRVcBdlznwaXp4QMUTCq/kbW5HpZ jBif4MTZMPXa3netwEVgTS1M8eiY2LC/W1n7CsQjnftkrSGVYFzM+LmIqJf+oV77au8xtygjrj FH6+KP+2OxdmSnz0QI28TFmN34wm6xxd04dqQc98U0Mws/o7U4ODenQv/yEx7ghL6IL2Kn2r1N OxQmWmSL7icdCCvzf2fQYYWra56tw/rqenLwnU/RgXEhlw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-40134.protonmail.ch) smtp.remote-ip=185.70.40.134; dkim=pass header.d=protonmail.com header.s=protonmail3 header.a=rsa-sha256; dmarc=pass header.from=protonmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1701400327; bh=YNS4y3449enyfc9/F5m2xvme/qFt0XQoFCh54i/gARE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:MIME-Version:Message-ID:Subject:From:To:Date: DKIM-Signature:DKIM-Signature; b=OCXJDlqGRnHhX/rbtXP7DI5IaPF72hBPUX9WvPT4MCGuKY1Kw0Em2c7Ubor44N5hF6IoW4SQlv eSvnzj//thBd6/q2MkBOmSkBAlfUC1hcI2bDmsn1D1+O++rG6OlvdjxbBw+90zhwxBOcjEtT8b /K4/jwuAl/lg3o9LLOVgHpDUF2ZzMRwR5JqAPYlusxdVgII9/s2RSPN3uBly8h0BZrVwPKSvVJ 8+wN99SnoYQhq5VW6dq5kV4mZJXONL4Yf6+7Wu4Wy7of3aJRr6lheJWnidDFQNccA2FZi0ZWTY K8t4bVjTOiIKppxqHDOYjK+D+p/abc88gbEWLaMplPiYxQ==; 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:MIME-Version:Message-ID: Subject:From:To:Date:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=fZoqEU336FGTzeAC4xmMhHpuVTt5O8GFYmkOkVAUt3w=; b=BE6nWJjtyGtkMZRuB/JboLNF/h inE9MqH/rbGgdUccTeKDn5c5h8aWCYNCAC5YS0aKwz0rfSTfIfiUidTFrcC1N1uGibHQFGG7vbx/n YZJxYSYAAYO8PcBA4WjoBBZpKzld3SWnlQltX2w8t1cbWtG2+7ojWzv7BZRqDdXqUPKGZpoUU/NEO DUs+vAexEAdWfuaKUAoYOfsDlo1BaHt/z4gKm3hnRCQ5l28W6idjooYo6r+ixTKiKs8WN1iMqXIMq 5mwAKTlgbFYPKvtBjilBHuNDCtrSWz1bagwSp3GRc2GaVkjOqy83ujJ9i8BnTeVi/kdn87RMhGdE8 CuIDbzKA==; Received: by zero.zsh.org with local id 1r8twk-000Dsy-13; Fri, 01 Dec 2023 03:12:06 +0000 Authentication-Results: zsh.org; iprev=pass (mail-40134.protonmail.ch) smtp.remote-ip=185.70.40.134; dkim=pass header.d=protonmail.com header.s=protonmail3 header.a=rsa-sha256; dmarc=pass header.from=protonmail.com; arc=none Received: from mail-40134.protonmail.ch ([185.70.40.134]:55165) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1r8twQ-000Db8-7C; Fri, 01 Dec 2023 03:11:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1701400304; x=1701659504; bh=fZoqEU336FGTzeAC4xmMhHpuVTt5O8GFYmkOkVAUt3w=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=o+8lBn7Cp69e8IYbDaf1eZ0jim6ei0X4SY6px/AY5vIsOM9K+0oa7RmRfV95Ep7eI 5nlErpfLP8wbNNSBDC7Mqt7hZ2v9Z8gf+tjAG/m31ezwTAE2cl+dkztzV78+Y1BS93 FnQLeHGUNWhJ19P7ifTQCwughYBkp7zUeuJsqLKjm+IYtCHpfeO0Ny54SYudnToKO4 5ctIPprcL16d1mPgeL+LGCdENd9AgSHtPhTu2bhB/aZUtc6frcmSUt2dqn511aVVld FMT0Y+06I7EFIkBsNBeUATIjDhCv3PJ392WopfGKmnSr7ZmYBpJ19/oisL3U0MSgOl mVsWBSV817b/w== Date: Fri, 01 Dec 2023 03:11:27 +0000 To: "zsh-workers@zsh.org" From: Julian Prein Subject: [PATCH] cd: Append 2nd argument to CWD if 1st is empty Message-ID: Feedback-ID: 54984029:user:proton MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha512; boundary="------81cb515eba8ebda7b1e7c5593e0b44265cfd28952d81eb180785a70d72323024"; charset=utf-8 X-Seq: 52346 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: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------81cb515eba8ebda7b1e7c5593e0b44265cfd28952d81eb180785a70d72323024 Content-Type: multipart/mixed;boundary=---------------------a1c23e30f55f76b9f787388f206b7b72 -----------------------a1c23e30f55f76b9f787388f206b7b72 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain;charset=utf-8 Hello, Since this could break some scripts relying on that behavior, the change c= ould also be put behind an option that is off by default. I first wanted to hea= r what the general opinion on this change is, but would happily send a v2, if requested. Thanks, Julian >From fdc9b7401d10d37a927394e782071af933469a20 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Thu, 30 Nov 2023 19:12:33 +0100 Subject: [PATCH] cd: Append 2nd argument to CWD if 1st is empty In cd's second form: cd [ -qsLP ] old new Currently when old is empty, cd will prepend new to the name of the current directory. As this has very limited use cases (e.g. `cd '' /proc` when in `/sys/...`), change the behaviour of cd to **append** new instead. --- Doc/Zsh/builtins.yo | 3 ++- Src/builtin.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo index 8f310f6cf591..8694298aaeac 100644 --- a/Doc/Zsh/builtins.yo +++ b/Doc/Zsh/builtins.yo @@ -287,7 +287,8 @@ directory hash table. = The second form of tt(cd) substitutes the string var(new) for the string var(old) in the name of the current directory, -and tries to change to this new directory. +and tries to change to this new directory. If var(old) is empty, var(new) +is appended to the name of the current directory. = The third form of tt(cd) extracts an entry from the directory stack, and changes to that directory. An argument of the form diff --git a/Src/builtin.c b/Src/builtin.c index 9e08a1dbce99..dad9ff745a5c 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -921,6 +921,8 @@ cd_get_dest(char *nam, char **argv, int hard, int func= ) } len1 =3D strlen(argv[0]); len2 =3D strlen(argv[1]); + if (!len1) + u =3D pwd + strlen(pwd); len3 =3D u - pwd; d =3D (char *)zalloc(len3 + len2 + strlen(u + len1) + 1); strncpy(d, pwd, len3); -- = 2.42.1 -----------------------a1c23e30f55f76b9f787388f206b7b72-- --------81cb515eba8ebda7b1e7c5593e0b44265cfd28952d81eb180785a70d72323024 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: ProtonMail wnUEARYKACcFgmVpTsMJkJQFY2+kqM8BFiEEVCxBZZsdvnfOhfUQlAVjb6So zwEAAD7CAPoCELpeWWF8i80zq5zF8qLtTaU0ve+w19cIVokcz2wpXgD/ae1u 6uLI6Po7azV1e+Re7tWYkIw1bbBZsJM9ocqI/gM= =qOa/ -----END PGP SIGNATURE----- --------81cb515eba8ebda7b1e7c5593e0b44265cfd28952d81eb180785a70d72323024--