Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#992383: debianutils: which is noisy and doesn't suggest a different option

3 views
Skip to first unread message

Norbert Preining

unread,
Aug 18, 2021, 12:40:03 AM8/18/21
to
Package: debianutils
Version: 5.0.1-1
Severity: important

Hi,

it seems that /usr/bin/which from debianutils has been deprecated, which
is ok, but being noisy about it on any invocation, **without** providing
an alternative is a no go, since it might break scripts that parse
output including stderr.

Please use NEWS, or whatever other channels, and above all, **provide
information on a replacement!**

Thanks

Norbert



-- System Information:
Debian Release: 11.0
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.13.11+ (SMP w/8 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages debianutils depends on:
ii libc6 2.31-15

debianutils recommends no packages.

debianutils suggests no packages.

-- no debconf information

Clint Adams

unread,
Aug 18, 2021, 11:00:04 AM8/18/21
to
On Wed, Aug 18, 2021 at 01:28:14PM +0900, Norbert Preining wrote:
> it seems that /usr/bin/which from debianutils has been deprecated, which
> is ok, but being noisy about it on any invocation, **without** providing
> an alternative is a no go, since it might break scripts that parse
> output including stderr.
>
> Please use NEWS, or whatever other channels, and above all, **provide
> information on a replacement!**

Alternatives include
* type
* command -v
* whereis from util-linux
* the which builtin in some interactive shells
* the whence builtin in some interactive shells
* the which() function included in keyboard-configuration.postinst

I don't have a comprehensive list.

Jason Riedy

unread,
Aug 18, 2021, 1:10:03 PM8/18/21
to
I've been using which for decades, including on SunOS and AIX.
When I know it's a script, less `which foobar` is quick and easy.

None of the alternatives listed do the same thing.

Yes, which has issues, but you're breaking what people have used
for a very, very long time.

From a bash session:
> DEPRECATION
> Since type and command -v were mandated by POSIX,
> this utility is no longer
> useful for maintainer scripts and thus will be
> removed from debianutils.
>
> Debian 9 Jul 2021
> WHICH(1)
> ejr@signbit:~/kernel/linux$ type ls
> ls is aliased to `ls --color=auto --hyperlink=auto'
> ejr@signbit:~/kernel/linux$ command -v ls
> alias ls='ls --color=auto --hyperlink=auto'
> ejr@signbit:~/kernel/linux$ which ls
> /usr/bin/which: this version of 'which' is deprecated and should
> not be used.
> /usr/bin/ls
> ejr@signbit:~/kernel/linux$ whereis ls
> ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz
> ejr@signbit:~/kernel/linux$ whence ls
> bash: whence: command not found
> ejr@signbit:~/kernel/linux$ command which ls
> /usr/bin/which: this version of 'which' is deprecated and should
> not be used.
> /usr/bin/ls
> ejr@signbit:~/kernel/linux$ command -v which ls
> /usr/bin/which
> alias ls='ls --color=auto --hyperlink=auto'

Michael Gold

unread,
Aug 19, 2021, 2:20:03 PM8/19/21
to
On Wed, Aug 18, 2021 at 12:53:53 -0400, Jason Riedy wrote:
> I've been using which for decades, including on SunOS and AIX. When I know
> it's a script, less `which foobar` is quick and easy.

Adding this to ~/.bashrc or similar might help:
which () { bash -c 'command -v "$@"' which "$@"; }

It won't find binaries shadowed by shell builtins or functions, though I
don't imagine this would be a common problem.

-- Michael
signature.asc
0 new messages