[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH v2] build: Replace `which` with `command -v`



On Wed, Feb 14, 2024 at 06:06:38PM +0000, Andrew Cooper wrote:
> On 14/02/2024 6:00 pm, Anthony PERARD wrote:
> > The `which` command is not standard, may not exist on the build host,
> > or may not behave as expected by the build system. It is recommended
> > to use `command -v` to find out if a command exist and have its path,
> > and it's part of a POSIX shell standard (at least, it seems to be
> > mandatory since IEEE Std 1003.1-2008, but was optional before).
> >
> > Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
> > Tested-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
> 
> Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> 
> I expect we want fixes tags for c8a8645f1ef (python) and 3b47bcdb6d383
> (figlet).  Both my fault it turns out...

Sounds good. I saw this patch as an improvement rather than a bug fix so
I didn't think about fixes tags. It's one less build dependency, so I
guess it's nice to have and backport.

It's common to use `which` to find a path to a binary, and unfortunately
not well known that `command -v` is a more portable alternative. So not
exactly your fault.

It's looks like there's a nice write up about this here:
https://unix.stackexchange.com/questions/85249/why-not-use-which-what-to-use-then/85250#85250

Cheers,

-- 
Anthony PERARD



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.