build: Replace which command with command -v #24156

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:220125-which changing 1 files +1 −1
  1. hebasto commented at 9:35 pm on January 25, 2022: member

    On some systems the which command can emit messages into stderr. For example, for debianutils 5.5-1 package in Debian Sid:

    0# which cat  
    1/usr/bin/which: this version of `which' is deprecated; use `command -v' in scripts instead.
    2/bin/cat
    

    Although such messages are harmless, they could distract developers needlessly (see bitcoin/bitcoin#24056).

    Fixes bitcoin/bitcoin#24056.

  2. kristapsk commented at 10:31 pm on January 25, 2022: contributor
    Can’t we switch to using command -v instead? Or there are platforms where which is available but shell does not have command built-in?
  3. DrahtBot added the label Build system on Jan 25, 2022
  4. hebasto commented at 11:37 pm on January 25, 2022: member

    Can’t we switch to using command -v instead? Or there are platforms where which is available but shell does not have command built-in?

    #24056 (comment)

  5. laanwj commented at 5:44 pm on January 26, 2022: member

    Thanks for checking about command -v avoiding a next round of hassle.

    Tested ACK https://github.com/bitcoin/bitcoin/pull/24156/commits/1c45a9a900f35cf400392f926af0e08ae42d709f (tested that the message didn’t appear, will do a full GUIX build to make sure the windows build works)

  6. katesalazar commented at 8:41 pm on January 26, 2022: contributor
    ACK 1c45a9a900f35cf400392f926af0e08ae42d709f
  7. in depends/hosts/mingw32.mk:1 in 1c45a9a900 outdated
    0@@ -1,4 +1,4 @@
    1-ifneq ($(shell which $(host)-g++-posix),)
    2+ifneq ($(shell which $(host)-g++-posix 2> /dev/null),)
    


    katesalazar commented at 8:44 pm on January 26, 2022:
    (nit) 2>/dev/null (no space) is more elegant IMO
  8. katesalazar approved
  9. fanquake commented at 2:39 am on January 27, 2022: member

    The main problem this is fixing isn’t

    /usr/bin/which: this version of `which’ is deprecated;

    it’s the output from #24056 which was caused by #22093.

    I mentioned here, we already use command -v, so I’m not sure why we can’t use it in this case.

  10. katesalazar commented at 7:42 am on January 27, 2022: contributor

    fanquake wrote:

    I mentioned here, we already use command -v, so I’m not sure why we can’t use it in this case.

    hebasto [wrote][0]:

    Will add some more tests and then submit a pr.

    I understand you can [use command -v] and is coming in a different PR.

    [0]: #24056 (comment)

  11. hebasto commented at 9:16 pm on January 30, 2022: member

    @fanquake

    The main problem this is fixing isn’t

    /usr/bin/which: this version of `which’ is deprecated;

    it’s the output from #24056 which was caused by #22093.

    Both output from #24056 and another example in the OP are generally the same – the stderr output.

    I mentioned here, we already use command -v, so I’m not sure why we can’t use it in this case.

    grepping gives the only place: https://github.com/bitcoin/bitcoin/blob/bd482b3ffebc68130f8a18dabf08ed1aff7ea159/depends/hosts/darwin.mk#L28-L36

    and comment added in 880660acfa547558f6ef5adff6768de95e53af6e by @dongcarl (#19683) seems say the same as #24056 (comment).

  12. luke-jr commented at 2:21 am on January 31, 2022: member
    Doesn’t #24131 resolve this without the ugly stderr loss? (Would be bad to silence an actually-relevant warning/error in the future..)
  13. prusnak commented at 5:59 pm on January 31, 2022: contributor

    Doesn’t #24131 resolve this without the ugly stderr loss? (Would be bad to silence an actually-relevant warning/error in the future..)

    I don’t think it does, because on older system you still will not have the ...-g++-posix binary.

  14. build: Replace `which` command with `command -v`
    This change made in a way that is compatible with GNU Make versions
    older than 4.3.
    148b33cf72
  15. hebasto force-pushed on Jan 31, 2022
  16. hebasto commented at 10:35 pm on January 31, 2022: member

    Updated 1c45a9a900f35cf400392f926af0e08ae42d709f -> 148b33cf72033eced8a701d127e21dfe8a816ce3 (pr24156.01 -> pr24156.02).

    Addressed:

  17. hebasto renamed this:
    build: Silent `which` command stderr output
    build: Replace `which` command with `command -v`
    on Jan 31, 2022
  18. dongcarl commented at 10:46 pm on January 31, 2022: member

    Code Review ACK 148b33cf72033eced8a701d127e21dfe8a816ce3

    Somewhat frustrating upstream bug, but it is what it is 🤷

  19. MarcoFalke added the label DrahtBot Guix build requested on Feb 1, 2022
  20. laanwj commented at 2:56 pm on February 2, 2022: member

    Code review ACK 148b33cf72033eced8a701d127e21dfe8a816ce3

    I don’t think it does, because on older system you still will not have the …-g++-posix binary.

    True. But the problem here isn’t so much older systems. It’s that when doing a guix build, depends is used to download the packages. This is done outside the build sandbox (because no network connectivity is available there). There, no C++ compiler needs to be installed at all, let alone a mingw one.

  21. laanwj merged this on Feb 2, 2022
  22. laanwj closed this on Feb 2, 2022

  23. hebasto deleted the branch on Feb 2, 2022
  24. DrahtBot commented at 0:52 am on February 3, 2022: member

    Guix builds

    File commit 133f73e86bd7c3114263500be2fb5090dd76b4bc(master) commit 80b3e6a7c2d413b6c701827a3b4239642b6be34e(master and this pull)
    SHA256SUMS.part 4d29ebeb3309d60d... 1c474dec773a946c...
    *-aarch64-linux-gnu-debug.tar.gz c29ba0d0426063e8... a74f4de0ae171921...
    *-aarch64-linux-gnu.tar.gz e52c846b1841b3eb... ce6871857f2aba33...
    *-arm-linux-gnueabihf-debug.tar.gz 5d3f9731cf88da5b... 7d8330054f33e38f...
    *-arm-linux-gnueabihf.tar.gz 282b33b13dd1f8a0... ac536a603e7d1ac0...
    *-arm64-apple-darwin.tar.gz 3f0dba0a6549c410... fe1578d0db8eeaa8...
    *-osx-unsigned.dmg 6692809452b6cb62... 439addc01263fd87...
    *-osx-unsigned.tar.gz 4366f453672f800d... 6b8c0507f3e82153...
    *-osx64.tar.gz 5387d0cdc36be37a... 769ecbb526cdff54...
    *-powerpc64-linux-gnu-debug.tar.gz 1ed57908059941ef... 90b84d89a62d9022...
    *-powerpc64-linux-gnu.tar.gz 21079e1bae0f459b... e5bbdc7c23d6f890...
    *-powerpc64le-linux-gnu-debug.tar.gz 6b441c519f2d3185... 401d9eb1fb71a774...
    *-powerpc64le-linux-gnu.tar.gz 132f95573d0fd005... 7f015bdd45c84868...
    *-riscv64-linux-gnu-debug.tar.gz 3c5e1f8e3d9aa92a... e709ac9377d8f217...
    *-riscv64-linux-gnu.tar.gz b17efbca76425fc5... 91b9cd78d7cd610d...
    *-x86_64-linux-gnu-debug.tar.gz 9f61cd7fca8d6425... 8f7e9e4faa39fc62...
    *-x86_64-linux-gnu.tar.gz 323dc8d7d0aa8290... 5275275fd3da1492...
    *.tar.gz 5887839fbd29cd1c... 3767d2a63dbb3ec5...
    guix_build.log 53868781dafe6675... 9facced985c452a9...
    guix_build.log.diff 48a8ccf5b24eb31d...
  25. DrahtBot removed the label DrahtBot Guix build requested on Feb 3, 2022
  26. sidhujag referenced this in commit c4670fbe58 on Feb 3, 2022
  27. DrahtBot locked this on Feb 3, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-18 18:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me