On 02/18/2018 04:04 PM, Sven Joachim wrote: > Historical reasons, POSIX has only mandated "command -v" since 2008 and > Debian does not even require that /bin/sh supports it, since the Policy > Manual specifies SUSv3 aka POSIX.2001 as the baseline[1]. As a > consequence, the minimal posh shell does not support[2] "command -v" > (not that using posh as /bin/sh is actually supported in Debian). > > See also bugs #747320[3] (talks about the "type" command, but mentions > "command -v" in the last comment) and #864615[4] (requests that Debian > should upgrade to SUSv4). > > Cheers, > Sven > > > 1. https://www.debian.org/doc/debian-policy/#scripts > 2. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=397601 > 3. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=747320 > 4. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=864615
Hmm, well, it would be exceedingly nice to support a POSIX standard that is *only* a decade old. That debian policy mandates the local keyword on top of POSIX, as well as completely frivolous things like echo -n (even though printf is already allowed and unambiguously better than any conceivable version of echo in any shell implementation, no matter how you want to use it) so it would be nice if there was at least one reliable way to figure out if a command exists which I would think is more important. ... Having never heard of posh before (except in the context of powershell, which I severely doubt is what you meant), I looked it up. Apparently busybox/dash were not sufficient as regards POSIX-compliant sh shells with a super minimal footprint, so debian decided to strip a third shell down for no reason other than to remove everything which is not totally vital to the standardized sh requirement as specified there. I... guess? this could make sense purely for testing purposes, but it seems a bit of a reach to support that for end users *just because* it exists. Can I at least hope that it has meaningful performance benefits over dash??? Meh, I guess this is why we can't have nice things. Woe betide the person attempting to write modern yet POSIX compliant scripts in a generally cross-distro manner. Even Debian cannot do it, and they're the ones who made the big push to get rid of bashisms. I guess if I want my cross-distro scripts I will have to settle for GNU bash in all its tremendous [sic] glory. If I want to implement some tool I have no time to spelunk around the history of SUSv3 to determine if every outdated version of a standard supports it. Well, hopefully this works. I even fixed a couple extra things as a bonus. But this is getting rather exhausting... https://salsa.debian.org/eschwartz-guest/xorg-server/commits/debian-unstable -- Eli Schwartz Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature