Re: Future of /usr/bin/which in Debian?

2021-09-27 Thread Jonathan Dowland

Michael Stone wrote:

I think it doesn't matter how many which implementations are in debian.
If you want something with specific portable semantics, just use command
-v. The remaining consumers of which are either programs that (ipso
facto) don't care about semantic corner cases or are humans who want to
use which just because, and probably have strong opinions on how it
should behave (as, apparently, you do).


*I* don't; in Clint's categorization¹ I fall into (d) "wants there to be
exactly one version of `which` (except for all the shell builtins) so
that alternatives won't confuse and complicate things". The point I've
tried to make (too clumsily I guess) is the process of choosing one
should not be shoot-from-the-hip: there should be some consideration as
to which `which` would be the best fit for Debian. I hadn't seen any
evidence of that, until,

On Tue, Sep 21, 2021 at 05:41:49PM -0400, Nicholas D Steeves wrote:

I also think it may be more reasonable to prefer (by default, using the
alternatives mechanism) the more LSBish one (in this case GNU) rather
than the potentially more simple, clean, and full-featured one (BSD).


^ this is an example of exactly what I would have hoped took place to
decide upon which `which` we provided.


Thankfully we have the /etc/alternatives and Provides mechanisms to
affirm user choice in such cases, and I think most of us will agree this
is a totally equitable and reasonable compromise :-)


Unless there's a really compelling reason for there to be more than one
`which`, we could avoid the burden of alternatives entirely.


I should get off my soapbox now.


¹ Message-ID: 

--
Please do not CC me for listmail.

  Jonathan Dowland
✎j...@debian.org
   https://jmtd.net



Re: Future of /usr/bin/which in Debian?

2021-09-22 Thread Fabrice Bauzac-Stehly
The Wanderer  writes:

> On 2021-09-21 at 16:16, Michael Stone wrote:

>> On Tue, Sep 21, 2021 at 09:00:52AM +0100, Jonathan Dowland wrote:

>> If you want something with specific portable semantics, just
>> use command -v.

> I think I've seen that suggested a lot as an alternative for 'which',
> but it doesn't seem to be comparably reliable in all contexts.
>
> The primary issue I've run across to date is with aliases.

I don't know if it is always the case, especially with bizarre zsh
setups, but on my computers, aliases are not defined in shell scripts,
only in interactive shells.

If it's an issue, a shell script can do this beforehand:

  \unalias -a

See https://pubs.opengroup.org/onlinepubs/009695399/utilities/command.html

-- 
Fabrice Bauzac-Stehly
PGP 01EEACF8244E9C14B551C5256ADA5F189BD322B6



Re: Future of /usr/bin/which in Debian?

2021-09-21 Thread Russ Allbery
The Wanderer  writes:
> On 2021-09-21 at 16:16, Michael Stone wrote:

>> I think it doesn't matter how many which implementations are in
>> debian. If you want something with specific portable semantics, just
>> use command -v.

> I think I've seen that suggested a lot as an alternative for 'which',
> but it doesn't seem to be comparably reliable in all contexts.

I don't think the point is that command -v is a drop-in replacement for
which (it definitely is not).  I think the point is that command -v is a
standardized, portable interface.  If you want portable semantics, the
standardized command is command -v, but it doesn't do quite the same thing
in quite the same way.  If you want which, you have to live with the fact
that it's not portable and different which implementations behave in
different ways.

-- 
Russ Allbery (r...@debian.org)  



Re: Future of /usr/bin/which in Debian?

2021-09-21 Thread The Wanderer
On 2021-09-21 at 16:16, Michael Stone wrote:

> On Tue, Sep 21, 2021 at 09:00:52AM +0100, Jonathan Dowland wrote:
> 
>> On Mon, Sep 20, 2021 at 11:02:49AM -0400, Michael Stone wrote:
>> 
>>> It seems to install to /usr/bin/which.gnu, implying that you
>>> could upload /usr/bin/which.bsd if you so desire; what's the
>>> issue?
>> 
>> I think we should have just one which implementation in the
>> archive. We should (have) pick(ed) the best one for Debian. I
>> believe (perhaps unfairly... I'd love to be proven wrong) that the
>> GNU implementation was uploaded very quickly, without the BSD
>> implementation being considered. Perhaps the GNU one is the best
>> fit for our needs. It would have been nice to see that there was an
>> evaluation.
> 
> I think it doesn't matter how many which implementations are in
> debian. If you want something with specific portable semantics, just
> use command -v.

I think I've seen that suggested a lot as an alternative for 'which',
but it doesn't seem to be comparably reliable in all contexts.

The primary issue I've run across to date is with aliases.

For example, on my computer as I type this:

$ which ls
/usr/bin/ls
$ command -v ls
alias ls='ls -N --color=auto'
$ $(which ls) /
bin   homelib32   media  pulse  srv  var
boot  initrd.img  lib64   mntroot   sys  vmlinuz
dev   initrd.img.old  libx32  optruntmp  vmlinuz.old
etc   lib lost+found  proc   sbin   usr
$ $(command -v ls) /
bash: alias: -N: not found
bash: alias: /: not found

And then 'ls' is broken in that shell session; I haven't yet found a way
to get it working again, short of exiting and re-launching the shell.
(Though I also haven't tried *terribly* hard.)

This seems to demonstrate that you can't safely just use 'command -v'
wherever you would otherwise use 'which'.

-- 
   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man. -- George Bernard Shaw



signature.asc
Description: OpenPGP digital signature


Re: Future of /usr/bin/which in Debian?

2021-09-21 Thread Nicholas D Steeves
Michael Stone  writes:

> On Tue, Sep 21, 2021 at 09:00:52AM +0100, Jonathan Dowland wrote:
>>On Mon, Sep 20, 2021 at 11:02:49AM -0400, Michael Stone wrote:
>>>It seems to install to /usr/bin/which.gnu, implying that you could 
>>>upload /usr/bin/which.bsd if you so desire; what's the issue?
>>
>>I think we should have just one which implementation in the archive. We
>>should (have) pick(ed) the best one for Debian. I believe (perhaps
>>unfairly... I'd love to be proven wrong) that the GNU implementation was
>>uploaded very quickly, without the BSD implementation being considered.
>>Perhaps the GNU one is the best fit for our needs. It would have been
>>nice to see that there was an evaluation.
>
> I think it doesn't matter how many which implementations are in debian. 
> If you want something with specific portable semantics, just use command 
> -v. The remaining consumers of which are either programs that (ipso 
> facto) don't care about semantic corner cases or are humans who want to 
> use which just because, and probably have strong opinions on how it 
> should behave (as, apparently, you do). We can't satisfy everybody with 
> one implementation, and I see no technical reason that we'd even try to 
> do so.

+1 for everything above.  I also think it may be more reasonable to
prefer (by default, using the alternatives mechanism) the more LSBish
one (in this case GNU) rather than the potentially more simple, clean,
and full-featured one (BSD).  For precedent see netcat-traditional vs
netcat-openbsd, and GNU tar vs bsdtar and pax--particularly during the
time when bsdtar was superior (iirc) to GNU tar.

I also acknowledge that this may entrench the precedent of preferring a
GNU/Linux-standard solution that may not be the technically best.  For
the record, I seem to remember using bsdtar for the period of time when
GNU tar had some issue or another (or was it a missing feature?  Maybe
xattr, sparse file support, or acl-related?), and I also have a strong
personal preference for netcat-openbsd.

Thankfully we have the /etc/alternatives and Provides mechanisms to
affirm user choice in such cases, and I think most of us will agree this
is a totally equitable and reasonable compromise :-)

Regards,
Nicholas


signature.asc
Description: PGP signature


Re: Future of /usr/bin/which in Debian?

2021-09-21 Thread Michael Stone

On Tue, Sep 21, 2021 at 09:00:52AM +0100, Jonathan Dowland wrote:

On Mon, Sep 20, 2021 at 11:02:49AM -0400, Michael Stone wrote:
It seems to install to /usr/bin/which.gnu, implying that you could 
upload /usr/bin/which.bsd if you so desire; what's the issue?


I think we should have just one which implementation in the archive. We
should (have) pick(ed) the best one for Debian. I believe (perhaps
unfairly... I'd love to be proven wrong) that the GNU implementation was
uploaded very quickly, without the BSD implementation being considered.
Perhaps the GNU one is the best fit for our needs. It would have been
nice to see that there was an evaluation.


I think it doesn't matter how many which implementations are in debian. 
If you want something with specific portable semantics, just use command 
-v. The remaining consumers of which are either programs that (ipso 
facto) don't care about semantic corner cases or are humans who want to 
use which just because, and probably have strong opinions on how it 
should behave (as, apparently, you do). We can't satisfy everybody with 
one implementation, and I see no technical reason that we'd even try to 
do so.




Re: Future of /usr/bin/which in Debian?

2021-09-21 Thread Jonathan Dowland

On Mon, Sep 20, 2021 at 11:02:49AM -0400, Michael Stone wrote:
It seems to install to /usr/bin/which.gnu, implying that you could 
upload /usr/bin/which.bsd if you so desire; what's the issue?


I think we should have just one which implementation in the archive. We
should (have) pick(ed) the best one for Debian. I believe (perhaps
unfairly... I'd love to be proven wrong) that the GNU implementation was
uploaded very quickly, without the BSD implementation being considered.
Perhaps the GNU one is the best fit for our needs. It would have been
nice to see that there was an evaluation.

--
Please do not CC me for listmail.

  Jonathan Dowland
✎j...@debian.org
   https://jmtd.net



Re: Future of /usr/bin/which in Debian?

2021-09-20 Thread Michael Stone

On Mon, Sep 20, 2021 at 02:38:06PM +0100, Jonathan Dowland wrote:

On Fri, Aug 20, 2021 at 11:03:50AM +0800, YunQiang Su wrote:

For such a simple tool, do we really need such many versions?


At least you've asked the question. I'd love to think that there was a
proper evaluation of BSD which versus GNU which prior to the latter
being uploaded to NEW, and there's a compelling reason that the GNU one
was chosen; but if so there's no evidence of that on -devel. :(


It seems to install to /usr/bin/which.gnu, implying that you could 
upload /usr/bin/which.bsd if you so desire; what's the issue?




Re: Future of /usr/bin/which in Debian?

2021-09-20 Thread Wookey
On 2021-09-20 04:48 +, Clint Adams wrote:
> On Sun, Sep 19, 2021 at 05:32:04PM +0100, Wookey wrote:
> > I must admit that I have no idea why replacing such a longstanding
> > utility is deemed necessary. 
> 
> Maybe this riddle will help.
> 
> Imagine that you are the product manager for Debian `which`.  According
> to the hatemail in my inbox, this is the most important utility in the
> history of time,

:-)

> such that even printing a warning to stderr causes
> global devastation, block hints, and calls for impeachment.

I do agree that it's pretty shoddy of bazel to break because a utility
several layers down issues stderr text whilst still returning a
success code. And yes I/someone should probably try to actually work
out why and fix it... But there is a lot of shit code in the world,
and only so many hours.

> You go on a Gemba walk,

Never heard of a Gemba walk before, so I learned something today :-)

> Wearing your customer-centricity hat, what is the optimal set of
> personas to unperson so that you can implement a solution that works
> for everyone who still matters?

I'm not fussy. Any of a,b,c or d would suit me fine. It's just e
(issue deprecation message), which caused me trouble.

Thanks for explaining what the actual problem is. You have my sympathy
trying to navigate the mess.

Wookey
-- 
Principal hats:  Linaro, Debian, Wookware, ARM
http://wookware.org/


signature.asc
Description: PGP signature


Re: Future of /usr/bin/which in Debian?

2021-09-20 Thread Jonathan Dowland

On Fri, Aug 20, 2021 at 11:03:50AM +0800, YunQiang Su wrote:

For such a simple tool, do we really need such many versions?


At least you've asked the question. I'd love to think that there was a
proper evaluation of BSD which versus GNU which prior to the latter
being uploaded to NEW, and there's a compelling reason that the GNU one
was chosen; but if so there's no evidence of that on -devel. :(


--
Please do not CC me for listmail.

  Jonathan Dowland
✎j...@debian.org
   https://jmtd.net



Re: Future of /usr/bin/which in Debian?

2021-09-19 Thread Clint Adams
On Sun, Sep 19, 2021 at 05:32:04PM +0100, Wookey wrote:
> I must admit that I have no idea why replacing such a longstanding
> utility is deemed necessary. 

Maybe this riddle will help.

Imagine that you are the product manager for Debian `which`.  According
to the hatemail in my inbox, this is the most important utility in the
history of time, such that even printing a warning to stderr causes
global devastation, block hints, and calls for impeachment.  So, it
makes sense for this to be a full-time job, though perhaps you manage
another, less significant utility as well.

You go on a Gemba walk, and discover you have several user personas
amongst your customers:

(a) wants GNU `which`, to have feature parity with Red Hat Enterprise Linux
(b) wants FreeBSD `which`, to have feature parity with FreeBSD
(c) wants nothing ever to change, and the xiafs removal from Linux 2.1.21
to be reverted
(d) wants there to be exactly one version of `which` (except for all the
shell builtins) so that alternatives won't confuse and complicate things

Wearing your customer-centricity hat, what is the optimal set of
personas to unperson so that you can implement a solution that works
for everyone who still matters?



Re: Future of /usr/bin/which in Debian?

2021-09-19 Thread Wookey
On 2021-08-27 16:48 -0400, Boyuan Yang wrote:
> Hi,
> 
> The GNU which package is now in NEW queue:
> https://ftp-master.debian.org/new/gnu-which_2.21-1.html

Thanks for this. Missing which broke bazel (at least in tensorflow)
and the implementation made it fiddly to replace  with
 as recommended.

Have a plain which back is much easier than fixing the build mess.

I must admit that I have no idea why replacing such a longstanding
utility is deemed necessary. 

Wookey
-- 
Principal hats:  Linaro, Debian, Wookware, ARM
http://wookware.org/


signature.asc
Description: PGP signature


Re: Future of /usr/bin/which in Debian?

2021-08-27 Thread 肖盛文


在 2021/8/28 上午4:54, Sean Whitton 写道:



I'd rather suggest the FreeBSD which, which I'm mirroring here:
https://salsa.debian.org/andrewsh/freebsd-which/

I think it's much simpler than the GNU one.

The GNU which package is now in NEW queue:
https://ftp-master.debian.org/new/gnu-which_2.21-1.html

Having both freebsd which and gnu which in Debian archive is definitely ok. If
you would like, please also upload freebsd-which onto unstable.

It's okay, indeed, but please do consider NEW queue workload with things
like this -- upload it if you're sure it's going to get used, not just
for completeness.
If there are several different versions of which in Debian, this will 
give the user that have a chance to choice one.



--
肖盛文 xiao sheng wen Faris Xiao
微信(wechat):atzlinux
《铜豌豆 Linux》https://www.atzlinux.com
基于 Debian 的 Linux 中文 桌面 操作系统
Debian QA page: https://qa.debian.org/developer.php?login=atzlinux%40sina.com
GnuPG Public Key: 0x00186602339240CB



OpenPGP_0x00186602339240CB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: Future of /usr/bin/which in Debian?

2021-08-27 Thread Sean Whitton
Hello Boyuan,

On Fri 27 Aug 2021 at 04:48PM -04, Boyuan Yang wrote:

> Hi,
>
> 在 2021-08-22星期日的 17:36 +0200,Andrej Shadura写道:
>> Hi,
>>
>> On Thu, 19 Aug 2021, at 23:17, Boyuan Yang wrote:
>> > 在 2021-08-18星期三的 22:59 +0200,Geert Stappers写道:
>> > > > /usr/bin/which.debianutils 0
>> > > >
>> > > > in postinst and so on so that FreeBSD which and GNU which and friends
>> > > > could
>> > > > take over.
>> > >
>> > > Please do.  Make such take over possible.
>> > > It is what
>> > > https://salsa.debian.org/debian/debianutils/-/merge_requests/6#note_242172
>> > > is asking for.
>> >
>> > So we will have https://salsa.debian.org/debian/which-gnu providing a
>> > binary
>> > package with name "which". I will upload it to the NEW queue soon.
>>
>> I'd rather suggest the FreeBSD which, which I'm mirroring here:
>> https://salsa.debian.org/andrewsh/freebsd-which/
>>
>> I think it's much simpler than the GNU one.
>
> The GNU which package is now in NEW queue:
> https://ftp-master.debian.org/new/gnu-which_2.21-1.html
>
> Having both freebsd which and gnu which in Debian archive is definitely ok. If
> you would like, please also upload freebsd-which onto unstable.

It's okay, indeed, but please do consider NEW queue workload with things
like this -- upload it if you're sure it's going to get used, not just
for completeness.

-- 
Sean Whitton


signature.asc
Description: PGP signature


Re: Future of /usr/bin/which in Debian?

2021-08-27 Thread Boyuan Yang
Hi,

在 2021-08-22星期日的 17:36 +0200,Andrej Shadura写道:
> Hi,
> 
> On Thu, 19 Aug 2021, at 23:17, Boyuan Yang wrote:
> > 在 2021-08-18星期三的 22:59 +0200,Geert Stappers写道:
> > > > /usr/bin/which.debianutils 0
> > > > 
> > > > in postinst and so on so that FreeBSD which and GNU which and friends
> > > > could
> > > > take over.
> > > 
> > > Please do.  Make such take over possible.
> > > It is what 
> > > https://salsa.debian.org/debian/debianutils/-/merge_requests/6#note_242172
> > > is asking for.
> > 
> > So we will have https://salsa.debian.org/debian/which-gnu providing a
> > binary
> > package with name "which". I will upload it to the NEW queue soon.
> 
> I'd rather suggest the FreeBSD which, which I'm mirroring here:
> https://salsa.debian.org/andrewsh/freebsd-which/
> 
> I think it's much simpler than the GNU one.

The GNU which package is now in NEW queue:
https://ftp-master.debian.org/new/gnu-which_2.21-1.html

Having both freebsd which and gnu which in Debian archive is definitely ok. If
you would like, please also upload freebsd-which onto unstable.

Thanks,
Boyuan Yang


signature.asc
Description: This is a digitally signed message part


Re: Future of /usr/bin/which in Debian?

2021-08-19 Thread Calum McConnell
On Fri, 2021-08-20 at 11:03 +0800, YunQiang Su wrote:
> Paul Wise  于2021年8月20日周五 上午10:50写道:
> > 
> > On Thu, Aug 19, 2021 at 9:17 PM Boyuan Yang wrote:
> > 
> > > So we will have https://salsa.debian.org/debian/which-gnu providing
> > > a binary
> > > package with name "which". I will upload it to the NEW queue soon.
> > 
> > Some folks on IRC wanted to package the FreeBSD which too, so I
> > suggest using which-gnu as the binary package name too.
> > 
> 
> For such a simple tool, do we really need such many versions?

Which which witches wish to which with will wildly wander.  We wish
welcome to witches which which with weird whichs, which will want whiches
which witches who were wasted winds when we were whelks used.  Which which
any witch uses is a decision whence the heart, which we wish to watch each
which make.


signature.asc
Description: This is a digitally signed message part


Re: Future of /usr/bin/which in Debian?

2021-08-19 Thread YunQiang Su
Paul Wise  于2021年8月20日周五 上午10:50写道:
>
> On Thu, Aug 19, 2021 at 9:17 PM Boyuan Yang wrote:
>
> > So we will have https://salsa.debian.org/debian/which-gnu providing a binary
> > package with name "which". I will upload it to the NEW queue soon.
>
> Some folks on IRC wanted to package the FreeBSD which too, so I
> suggest using which-gnu as the binary package name too.
>

For such a simple tool, do we really need such many versions?


> --
> bye,
> pabs
>
> https://wiki.debian.org/PaulWise
>


-- 
YunQiang Su



Re: Future of /usr/bin/which in Debian?

2021-08-19 Thread Paul Wise
On Thu, Aug 19, 2021 at 9:17 PM Boyuan Yang wrote:

> So we will have https://salsa.debian.org/debian/which-gnu providing a binary
> package with name "which". I will upload it to the NEW queue soon.

Some folks on IRC wanted to package the FreeBSD which too, so I
suggest using which-gnu as the binary package name too.

-- 
bye,
pabs

https://wiki.debian.org/PaulWise



Re: Future of /usr/bin/which in Debian?

2021-08-19 Thread Boyuan Yang
在 2021-08-18星期三的 22:59 +0200,Geert Stappers写道:
> On Wed, Aug 18, 2021 at 07:56:05PM +, Clint Adams wrote:
> > On Wed, Aug 18, 2021 at 09:48:29PM +0200, Geert Stappers wrote:
> > } } I'm happy to transition /usr/bin/which to alternatives
> > > Which alternatives would that be?
> > 
> > I meant
> > 
> > update-alternatives --install /usr/bin/which which
> > /usr/bin/which.debianutils 0
> > 
> > in postinst and so on so that FreeBSD which and GNU which and friends
> > could
> > take over.
> 
> Please do.  Make such take over possible.
> It is what 
> https://salsa.debian.org/debian/debianutils/-/merge_requests/6#note_242172
> is asking for.

So we will have https://salsa.debian.org/debian/which-gnu providing a binary
package with name "which". I will upload it to the NEW queue soon.

Still not sure about the the package's priority. Now I am using Priority:
optional, but we may raise it later if needed.

Thanks,
Boyuan Yang


signature.asc
Description: This is a digitally signed message part


Re: Future of /usr/bin/which in Debian?

2021-08-18 Thread Colin Watson
On Wed, Aug 18, 2021 at 08:50:04PM +0200, Ben Hutchings wrote:
> Debian's implementation started out in 1995 or 1996 as a shell script
> calling 'type', and remains a shell script.

Not very important historical note: it's true that Debian had a "which"
command from 1995/1996 or so, but the current implementation doesn't
descend from that at all.

I wrote the earliest version of the current implementation from scratch,
as part of a job I held from 2000 to 2003; in that job, I worked on lots
of different Unix flavours, and we had NFS-mounted home directories so I
wanted a reasonably cross-platform ~/.bashrc.  The spectacular lack of
consistent behaviour of "which" across those platforms got in my way, so
I wrote a shell script that I could put in my ~/bin and use everywhere.
I don't remember exactly when I wrote it, but it can't have been before
2000 and I think it was probably around 2002.

I contributed that script to Debian in 2002 in response to
https://bugs.debian.org/94507, where it became clear that the previous
implementation wasn't really salvageable; Clint merged that in
debianutils 1.16.5.  It's been extended since then, but still has the
same basic approach.

-- 
Colin Watson (he/him)  [cjwat...@debian.org]



Re: Future of /usr/bin/which in Debian?

2021-08-18 Thread Clint Adams
On Wed, Aug 18, 2021 at 10:59:08PM +0200, Geert Stappers wrote:
> Please do.  Make such take over possible.
> It is what 
> https://salsa.debian.org/debian/debianutils/-/merge_requests/6#note_242172
> is asking for.

Okay, you have it in debianutils 5.1-2.



Re: Future of /usr/bin/which in Debian?

2021-08-18 Thread Geert Stappers
On Wed, Aug 18, 2021 at 07:56:05PM +, Clint Adams wrote:
> On Wed, Aug 18, 2021 at 09:48:29PM +0200, Geert Stappers wrote:
> } } I'm happy to transition /usr/bin/which to alternatives
> > Which alternatives would that be?
> 
> I meant
> 
> update-alternatives --install /usr/bin/which which /usr/bin/which.debianutils > 0
> 
> in postinst and so on so that FreeBSD which and GNU which and friends could
> take over.

Please do.  Make such take over possible.
It is what 
https://salsa.debian.org/debian/debianutils/-/merge_requests/6#note_242172
is asking for.



Groeten
Geert Stappers
-- 
Silence is hard to parse



Re: Future of /usr/bin/which in Debian?

2021-08-18 Thread Clint Adams
On Wed, Aug 18, 2021 at 09:48:29PM +0200, Geert Stappers wrote:
> Which alternatives would that be?

I meant

update-alternatives --install /usr/bin/which which /usr/bin/which.debianutils 0

in postinst and so on so that FreeBSD which and GNU which and friends could
take over.



Re: Future of /usr/bin/which in Debian?

2021-08-18 Thread Geert Stappers
On Wed, Aug 18, 2021 at 06:53:45PM +, Clint Adams wrote:
> 
> I'm happy to transition /usr/bin/which to alternatives

Which alternatives would that be?


 | $ apt show alternatives
 | N: Unable to locate package alternatives
 | $



> if people are interested in packaging all of these.
> 




Groeten
Geert Stappers
-- 
Silence is hard to parse



Re: Future of /usr/bin/which in Debian?

2021-08-18 Thread Clint Adams
On Wed, Aug 18, 2021 at 08:50:04PM +0200, Ben Hutchings wrote:
> 3BSD first implemented 'which':
> 
> (1979).  This was csh-specific and I think it later became built-into
> csh.
> 
> FreeBSD 2.1 introduced a new non-built-in implementation:
> 
> (1995).  This was written in Perl and then rewritten in C a few years
> later.
> 
> Debian's implementation started out in 1995 or 1996 as a shell script
> calling 'type', and remains a shell script.
> 
> Red Hat has yet another implementation:
> ,
>  (1999 or earlier).  This is
> written in C.
> 
> So 'which' has a very long history in csh, which was the default
> interactive shell in many versions of Unix.  Its availability to other
> shells dates back to the 90s (at least) but is not portable due to
> there being multiple very different implementations.

I'm happy to transition /usr/bin/which to alternatives if people are
interested in packaging all of these.



Re: Future of /usr/bin/which in Debian?

2021-08-18 Thread Ben Hutchings
On Wed, 2021-08-18 at 22:58 +0500, Andrey Rahmatullin wrote:
> On Wed, Aug 18, 2021 at 12:36:43PM -0500, Gunnar Wolf wrote:
> > I agree with you, maintainer scripts should not rely on 'which'
> > anymore. However, what about users? 'which' is a standard Unix tool
> > since forever, and I expect many users to experience head scratching
> > when told it's not cool to use it anymore.
> Why is a standard Unix tool since forever shipped by a package called
> debianutils, that has a description saying "Miscellaneous utilities
> specific to Debian" and "used primarily by the installation scripts of
> Debian packages"? Surely a standard Unix tool would, or at least could, be
> shipped somewhere else?

3BSD first implemented 'which':

(1979).  This was csh-specific and I think it later became built-into
csh.

FreeBSD 2.1 introduced a new non-built-in implementation:

(1995).  This was written in Perl and then rewritten in C a few years
later.

Debian's implementation started out in 1995 or 1996 as a shell script
calling 'type', and remains a shell script.

Red Hat has yet another implementation:
,
 (1999 or earlier).  This is
written in C.

So 'which' has a very long history in csh, which was the default
interactive shell in many versions of Unix.  Its availability to other
shells dates back to the 90s (at least) but is not portable due to
there being multiple very different implementations.

Ben.

-- 
Ben Hutchings
[W]e found...that it wasn't as easy to get programs right as we had
thought. I realized that a large part of my life from then on was going
to be spent in finding mistakes in my own programs.
 - Maurice Wilkes, 1949


signature.asc
Description: This is a digitally signed message part


Re: Future of /usr/bin/which in Debian?

2021-08-18 Thread Andrey Rahmatullin
On Wed, Aug 18, 2021 at 12:36:43PM -0500, Gunnar Wolf wrote:
> I agree with you, maintainer scripts should not rely on 'which'
> anymore. However, what about users? 'which' is a standard Unix tool
> since forever, and I expect many users to experience head scratching
> when told it's not cool to use it anymore.
Why is a standard Unix tool since forever shipped by a package called
debianutils, that has a description saying "Miscellaneous utilities
specific to Debian" and "used primarily by the installation scripts of
Debian packages"? Surely a standard Unix tool would, or at least could, be
shipped somewhere else?

-- 
WBR, wRAR


signature.asc
Description: PGP signature


Re: Future of /usr/bin/which in Debian?

2021-08-18 Thread Gunnar Wolf
Clint Adams dijo [Wed, Aug 18, 2021 at 04:20:02AM +]:
> > Besides, will the new "which" tool be installed in Debian by default? Since
> > debianutils is Essential:yes, not providing "which" tool by default could
> > probably break some existing packages.
> 
> My personal opinion is that no one should be using `which` in maintainer
> scripts and that no one should be using `which` in an interactive shell
> unless it is a builtin of that shell.
> 
> There are a ton of postinst scripts relying on `which` right
> now, which makes sense because `type` and `command -v` used to be
> optional extensions to POSIX and not guaranteed to be provided
> by /bin/sh.

I agree with you, maintainer scripts should not rely on 'which'
anymore. However, what about users? 'which' is a standard Unix tool
since forever, and I expect many users to experience head scratching
when told it's not cool to use it anymore.



Re: Future of /usr/bin/which in Debian?

2021-08-17 Thread Clint Adams
On Tue, Aug 17, 2021 at 09:15:24PM -0400, Boyuan Yang wrote:
> Besides, will the new "which" tool be installed in Debian by default? Since
> debianutils is Essential:yes, not providing "which" tool by default could
> probably break some existing packages.

My personal opinion is that no one should be using `which` in maintainer
scripts and that no one should be using `which` in an interactive shell
unless it is a builtin of that shell.

There are a ton of postinst scripts relying on `which` right
now, which makes sense because `type` and `command -v` used to be
optional extensions to POSIX and not guaranteed to be provided
by /bin/sh.