From: "Ajeet D'Souza" <98ajeet@gmail.com>
To: zsh-workers@zsh.org
Subject: Re: command cd doesn't work on some builds of zsh
Date: Tue, 13 Feb 2024 17:18:33 +0530 [thread overview]
Message-ID: <CAF6KdoXdvvhTUEcNf+XmjemdS1CDFzhs-gjze=R94_tcMzWbiQ@mail.gmail.com> (raw)
In-Reply-To: <Zcs-51EmF9RJNF6L@harpo.local>
[-- Attachment #1: Type: text/plain, Size: 1647 bytes --]
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 cd
not considered a builtin otherwise?
On Tue, Feb 13, 2024 at 3:35 PM Andreas Kähäri <andreas.kahari@abc.se>
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 builds
> 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ähäri
> Uppsala, Sweden
>
> .
>
[-- Attachment #2: Type: text/html, Size: 2509 bytes --]
next prev parent reply other threads:[~2024-02-13 11:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-13 9:54 Ajeet D'Souza
2024-02-13 10:05 ` Andreas Kähäri
2024-02-13 11:48 ` Ajeet D'Souza [this message]
2024-02-13 12:02 ` Peter Stephenson
2024-02-13 10:48 ` Peter Stephenson
2024-02-13 14:25 ` Lawrence Velázquez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAF6KdoXdvvhTUEcNf+XmjemdS1CDFzhs-gjze=R94_tcMzWbiQ@mail.gmail.com' \
--to=98ajeet@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).