Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 599392

Summary: eselect-java: Replace "/usr/bin/which" with "command -v"
Product: Gentoo Linux Reporter: Manuel Rüger (RETIRED) <mrueg>
Component: Current packagesAssignee: Java team <java>
Status: RESOLVED FIXED    
Severity: normal Keywords: PATCH
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 449316    
Attachments: Replace which with command-v

Description Manuel Rüger (RETIRED) gentoo-dev 2016-11-10 13:46:16 UTC
Created attachment 452904 [details, diff]
Replace which with command-v

On some systems /usr/bin/which might not be available, it's safer to use "command -v".

Patch attached.
Comment 1 Austin English (RETIRED) gentoo-dev 2016-11-22 19:08:52 UTC
(In reply to Manuel Rüger from comment #0)
> Created attachment 452904 [details, diff] [details, diff]
> Replace which with command-v
> 
> On some systems /usr/bin/which might not be available, it's safer to use
> "command -v".
> 
> Patch attached.

command -v doesn't require an external binary, but it's not POSIX either. bash/dash/zsh/csh/FreeBSD sh all support it, though busybox doesn't. I suspect plenty else wouldn't work under busybox though ;).

Why the quoting, though?
Comment 2 Manuel Rüger (RETIRED) gentoo-dev 2016-11-27 20:32:36 UTC
Yeah the quoting is not necessary.

I check busybox:

mrueg@euler ~ % bb
~ $ command -v eselect
/usr/bin/eselect


Seems to be supported there as well.
Comment 3 Austin English (RETIRED) gentoo-dev 2016-11-28 23:02:39 UTC
(In reply to Manuel Rüger from comment #2)
> Yeah the quoting is not necessary.
> 
> I check busybox:
> 
> mrueg@euler ~ % bb
> ~ $ command -v eselect
> /usr/bin/eselect
> 
> 
> Seems to be supported there as well.

Cool. I committed the modified patch here:
https://gitweb.gentoo.org/proj/eselect-java.git/commit/?id=4d7da7ac603f610fef687ea95357e7b727b19d03

and pushed a 0.3.0 ebuild here:
https://github.com/gentoo/gentoo/commit/588325937049c7ca75da537f615c961c64b7e2a4