From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 3D31D254AA for ; Tue, 13 Feb 2024 12:49:48 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1707824988; b=kxzA0OViAq2h7LNJX2nUWi5VuC/OD70d+R5VOczjpLjClOrS7hGwvJ2oS1je9DaRwvYpp5cZZx aINFohKbTIL6xSJjTENfBwHrEHG3UYN/49PvanU2AANqCuKpBjN/ht3QopxZQgbqQMv5bQY18K 53gAwkq62MFqk7yVMQpvxaLPVXT1mF20YPg6+6L9ykXNWBfceRgUDT6Ua78dzpGuXswGX6x1Xr 3p4mfaK8s3HWz6Yccg2KHB8ezY+aELM0Y7zQiot48T1UgRGylOOPPfIILNFl+pvAOezBmseuRQ qbY7R58SpeOMZAirnlGFIdYB+/0/CvhLOHgHStCxEUaxPg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-oa1-f48.google.com) smtp.remote-ip=209.85.160.48; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1707824988; bh=CRGEISkj4ah/k1ny44XFtz/fWkYR27ub2BL75Ff86Os=; 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=XYOd7kk7dmQE8J9GnvwYtI0BsDrSBCNiGBylKTBld4cpzGIgWDcf8zs4x9A608nxcUi9wS1pMB +LEf/rdFCQQlSnNHItER7QEGe/nmZmqYPkY3SFNwESYMF4gXT/bYux+uyh+Av+RsrMH/X3OKL6 dB1yOh6gDm74F2Rf+xYW/fz62DUH4krU62E3zVRnbh9qdBEvn3ldf1rJSvnu16G6PgsD/oZV6h 2ufyA5xIg4kw1nKGZc28pW+0fg5MQYj0T2ixn3M4H9sFe/Q76ycW0JbXLYu3d/zYZr//uT1lYb FijPUqdpeQCzri4EHh8AR5v1tsImJg++a1gyzWie5ZdGeg==; 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=eSXqY54Le1xXkwdXWA35cB1TVAClw3MtvBM/x20Wk+A=; b=WQAkwNRXzoLNY11YT/2Zqawwhc 0eHlSczlQxFibHjySPFJQ2krpQwVi4XjEIENJ2FBps6kZN2ZkAFTP+/zRJJcR952oNc3yXOqljC5k WIGGZ4M3YRV7D1AqGeK9wO1r4OdyDnTxvqeELaKmR9k3Awv/HT18SPHk4sZjavoM1l6+LOGyy3gKe 4d9JsPpwcTtbJfm/2Io+skYt9tEw+FwGcCzEVpaBBcGt5kK4DEoNpsywRCA4gftDx/iqYrqumss+a FG3tA+/99UorTQdOABbC+bfxA2xyPydknb3vae6Apo0027pPstTjHt7u3h44aNYPjd4suRfZMsX2I WQdLnECQ==; Received: by zero.zsh.org with local id 1rZrIK-0002U3-8V; Tue, 13 Feb 2024 11:49:48 +0000 Authentication-Results: zsh.org; iprev=pass (mail-oa1-f48.google.com) smtp.remote-ip=209.85.160.48; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-oa1-f48.google.com ([209.85.160.48]:50446) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rZrHj-00029A-Gl; Tue, 13 Feb 2024 11:49:12 +0000 Received: by mail-oa1-f48.google.com with SMTP id 586e51a60fabf-204235d0913so2477293fac.1 for ; Tue, 13 Feb 2024 03:49:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707824950; x=1708429750; darn=zsh.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=eSXqY54Le1xXkwdXWA35cB1TVAClw3MtvBM/x20Wk+A=; b=Vo38gmFSGVX18tD5nw1C9Sft0UgVJxaID+S74QOsHMcLefC8nK2coFj7jiKYwSuVhz HBJmdC8kj3NN19Cs8aIHwsM1dXwB2MoZ/2Wcu+iBeZ6nJn4djB8WH02LMQXAHTtNsn6h x5q8NnxSEVg9lL51YS23mMZ5LEIK20ODm0NPl3xFVjtKjtcXp41/knKCkplm4f0Mo9J7 M2DbgLO8urulNPVf5vNxSfyx/i4Xq5bqlj/+wasdWJYDsGAae9MWZCqrTXt/UGoXvp+7 RISxSxILT2ltuRC8VqNH4gyWCrZTAspWC+XlT6MTpZ7YaHXwtleZaBI4dZ2LE/VEVSgv DXHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707824950; x=1708429750; h=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=eSXqY54Le1xXkwdXWA35cB1TVAClw3MtvBM/x20Wk+A=; b=XMHaIZPtsxkaCMjOiOITtMgabjwV6InNhoivYUYwEzCiNHIjjoeoFUr8wrDafkdhuX tF+cxBxufLY6j3U1LWef5TQohsrNPokMkb8hn0RTKinOEzs7rZaTjF79lxurCp1QCHV6 m55knq6FiWXWqFIj21tSpJVc1Sb9E8fxPCyavnPi4KjVYVkRsXW9YhcPp5uUXUsOIp9f 0CWIwI1798RmNahMTnMJwqL9iSFhahlBQYpPPYsuUz/Or2ZGGL38h9d7+Fmg37c6iLj6 8Rlr2k1QJS7tzzcqfQvv7upDwz9Kgb9XMER+fr9ajm/MtH2UnKyy/SkxBYnYj0w0gSpR 9J2w== X-Gm-Message-State: AOJu0YxjTjniPm/+zMrHvBxWFQWi61MFDIFFd21YZpSgHbFhj6Dc2UQ4 vGYgbWP/ersb3Aiwhw3gNVYbeKkDwJybD5hEcWRDtBLNwxXF5H8LBVM+j0DCAUH+WMQfJLWjRvu cX6CSIX6OOZ8gcFjygWf7WHJqsswVgGpC X-Google-Smtp-Source: AGHT+IFPl3SWDr7j/S+mAPTRcalKtm2oz6Kq3kcPwDHvSKMHQv8tDhk/E4RGQ7y00U68LhmuugiJHhDxY/37dOQGKkE= X-Received: by 2002:a05:6870:9692:b0:21a:de9:58eb with SMTP id o18-20020a056870969200b0021a0de958ebmr11785053oaq.52.1707824949913; Tue, 13 Feb 2024 03:49:09 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: "Ajeet D'Souza" <98ajeet@gmail.com> Date: Tue, 13 Feb 2024 17:18:33 +0530 Message-ID: Subject: Re: command cd doesn't work on some builds of zsh To: zsh-workers@zsh.org Content-Type: multipart/alternative; boundary="0000000000007a6ddf061141fbbc" X-Seq: 52539 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: --0000000000007a6ddf061141fbbc Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable You're right, Fedora does have a cd binary which is why this works: *$ which cd* /usr/bin/cd However, this still seems like inconsistent behaviour: *$ /usr/bin/cd "foo"* # this will not change directories, because a binary cannot change the CWD of its parent process *$ command cd "foo"* # this throws an error on systems without a cd binary, but it actually calls the shell builtin and changes the CWD Also, since the manpage mentions that command is supposed to invoke shell builtins, why does this command fail without POSIX_BUILTINS being set? Is c= d not considered a builtin otherwise? On Tue, Feb 13, 2024 at 3:35=E2=80=AFPM Andreas K=C3=A4h=C3=A4ri wrote: > On Tue, Feb 13, 2024 at 03:24:22PM +0530, Ajeet D'Souza wrote: > > Hi, I found inconsistent behaviour of the command builtin in some build= s > on > > zsh. > > > > On Fedora 39: > > *$ zsh --version* > > zsh 5.9 (x86_64-redhat-linux-gnu) > > *$ zsh -c 'command cd'* > > > > On Debian 10: > > *$ zsh --version* > > zsh 5.9 (x86_64-unknown-linux-gnu) > > *$ zsh -c 'command cd'* > > zsh:1: command not found: cd > > > > According to the manual, command cd should work: > > > > > Run command with args suppressing the normal shell function lookup. > *Only > > > builtin commands* or commands found in the PATH are executed. > > > > > > Any idea why different builds on zsh produce different outcomes here? > > Is there in fact an external cd command on the Fedora system? Is the > POSIX_BUILTINS zsh shell option set by default on the Fedora system? > > -- > Andreas (Kusalananda) K=C3=A4h=C3=A4ri > Uppsala, Sweden > > . > --0000000000007a6ddf061141fbbc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
You're right, Fedora does have a cd=C2=A0binary which is why this works:

$ which cd
/usr/bin/cd

Howe= ver, this still seems like inconsistent behaviour:

$ /usr/bin/cd "foo"
=
# this will not change directories, because a= binary cannot change the CWD of its parent=C2=A0process
<= b>$ command cd "foo"
# this throws an error on systems without a cd b= inary, but it actually calls the shell builtin and changes the CWD

Also, since the manpage mentions that=C2=A0command=C2=A0is supposed to invoke shell builtins, = why does this command fail without=C2=A0POSIX_BUIL= TINS=C2=A0being=C2=A0set? Is cd not = considered a builtin otherwise?

On Tue, Feb 13, 2024 at 3:35=E2=80=AFPM Andr= eas K=C3=A4h=C3=A4ri <andreas.kahari@abc.se> wrote:
On Tue, Feb 13, 2024 at 03:24:22PM +0530, Aje= et D'Souza wrote:
> Hi, I found inconsistent behaviour of the command builtin in some buil= ds on
> zsh.
>
> On Fedora 39:
> *$ zsh --version*
> zsh 5.9 (x86_64-redhat-linux-gnu)
> *$ zsh -c 'command cd'*
>
> On Debian 10:
> *$ zsh --version*
> zsh 5.9 (x86_64-unknown-linux-gnu)
> *$ zsh -c 'command cd'*
> zsh:1: command not found: cd
>
> According to the manual, command cd should work:
>
> > Run command with args suppressing the normal shell function looku= p. *Only
> > builtin commands* or commands found in the PATH are executed.
>
>
> Any idea why different builds on zsh produce different outcomes here?<= br>
Is there in fact an external cd command on the Fedora system?=C2=A0 Is the<= br> POSIX_BUILTINS zsh shell option set by default on the Fedora system?

--
Andreas (Kusalananda) K=C3=A4h=C3=A4ri
Uppsala, Sweden

.
--0000000000007a6ddf061141fbbc--