Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <petr.vorel@gmail.com>
To: David Laight <David.Laight@aculab.com>
Cc: Markus Mayer <mmayer@broadcom.com>,
	Buildroot Mailing List <buildroot@buildroot.org>
Subject: Re: [Buildroot] [PATCH 0/1] Build issue related to "command -v"
Date: Wed, 29 Sep 2021 19:30:49 +0200	[thread overview]
Message-ID: <YVSiyejB7ZKWev6I@pevik> (raw)
In-Reply-To: <515fab0378614d93821aed6a95cbd16e@AcuMS.aculab.com>

Hi all,

> ...
> > Meanwhile, 'which' is not standard, and right now, it misbehaves on
> > Debian by filling the screen with warnings.

> 'which' is a shell script that is trying to emulate a csh builtin.
> I've NFI why people keep using it :-)
FYI Yes, version from the Debian's debianutils package was a shell script, but
other distros had GNU which [2], which is C code.

> The equivalent bourne shell command is 'type'.
I also knew 'type' and was suspicious about 'command -v' support across
implemented shell, until I asked [3], because checkbashisms.pl [4] complains
about 'type' and it's ok with 'command -v'.

'type' is part of POSIX, but as part of the X/Open Systems Interfaces option
(XSI) [5] thus it might not be implemented on very small systems.
'command -v' is POSIX but not extension [6] thus it should be everywhere.

I tested 'command -v' is supported by commonly used shells (bash, dash, busybox
ash, zsh). Although so does 'type' thus I prefer to use 'command -v' instead of
'type' in shell scripts thus I can check them with checkbashisms.pl.

> As for 'command -v' no idea what the POSIX committee had
> for lunch that day :-)
> It was probably they same day they added 'fc' (from ksh??)
I cannot comment that, but if you read their definition [5] and [6] has slightly
different purpose.

Kind regards,
Petr

[1] https://salsa.debian.org/debian/debianutils/-/commit/3a8dd10b4502f7bae8fc6973c13ce23fc9da7efb
[2] https://ftp.gnu.org/gnu/which/which-2.21.tar.gz
[3] https://unix.stackexchange.com/a/667293
[4] https://salsa.debian.org/debian/devscripts/-/blob/master/scripts/checkbashisms.pl
[5] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/type.html
[6] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html

> 	David
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2021-09-29 17:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-28 19:55 [Buildroot] [PATCH 0/1] Build issue related to "command -v" Markus Mayer via buildroot
2021-09-28 19:55 ` [Buildroot] [PATCH 1/1] Makefile: set HOST*_NOCCACHE variables only if unset Markus Mayer via buildroot
2021-09-29 19:27   ` Petr Vorel
2021-12-28 21:18   ` Thomas Petazzoni
2021-12-28 21:26     ` Nicolas Cavallari
2021-12-29  9:00       ` Thomas Petazzoni
2021-12-29  9:12   ` Thomas Petazzoni
2021-09-29  8:24 ` [Buildroot] [PATCH 0/1] Build issue related to "command -v" Nicolas Cavallari
2021-09-29 16:14   ` David Laight
2021-09-29 17:30     ` Petr Vorel [this message]
2021-09-29 19:59 ` Arnout Vandecappelle
2021-09-29 20:11   ` Petr Vorel
2021-10-01 17:53     ` Markus Mayer via buildroot
2021-10-01 18:17       ` Yann E. MORIN
2021-10-02 19:23         ` Petr Vorel

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=YVSiyejB7ZKWev6I@pevik \
    --to=petr.vorel@gmail.com \
    --cc=David.Laight@aculab.com \
    --cc=buildroot@buildroot.org \
    --cc=mmayer@broadcom.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox