target/hexagon/idef-parser/prepare: use env to invoke bash
PATCH 1/1 target/hexagon/idef-parser/prepare: use env to invoke bash
This file is the only one involved in the compilation process which still uses the /bin/bash path.
--- target/hexagon/idef-parser/prepare | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/hexagon/idef-parser/prepare +1 -1
@@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Copyright(c) 2019-2021 rev.ng Labs Srl. All Rights Reserved.
Signature · 1 line
2.42.0
23.11.2023 23:57, Samuel Tardieu :
Quoted 13 lines
This file is the only one involved in the compilation process which still uses the
/bin/bashpath.Signed-off-by Samuel Tardieu <[email protected]>--- target/hexagon/idef-parser/prepare | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/hexagon/idef-parser/prepare +0
-0
target/hexagon/idef-parser/prepare line 1
Quoted 2 lines
target/hexagon/idef-parser/prepare +1
-1@@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash
What's the reason for this indirection? bash has been /bin/bash for decades, it is used this way in many other places in qemu code and in other projects. Yes I know about current move /bin => /usr/bin etc, but the thing is that traditional paths like this one (or like /bin/sh) is not going away any time soon. What's the matter here?
/mjt
Am 25.12.23 um 09:05 schrieb Michael Tokarev:
Quoted 23 lines
23.11.2023 23:57, Samuel Tardieu :
Quoted 13 lines
This file is the only one involved in the compilation process which still uses the
/bin/bashpath.Signed-off-by Samuel Tardieu <[email protected]>---
target/hexagon/idef-parser/prepare | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)target/hexagon/idef-parser/prepare +0
-0target/hexagon/idef-parser/prepare line 1
Quoted 2 lines
target/hexagon/idef-parser/prepare +1
-1@@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bashWhat's the reason for this indirection? bash has been
/bin/bashfor decades, it is used this way in many other places in qemu code and in other projects. Yes I know about current move /bin =>/usr/binetc, but the thing is that traditional paths like this one (or like/bin/sh) is not going away any time soon. What's the matter here?
Quoted 2 lines
/mjt
On MacOS /bin/bash is the pre-installed bash:
% /bin/bash --version
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin23) Copyright (C) 2007 Free Software Foundation, Inc.
With /usr/bin/env I get a recent one from Homebrew:
% /usr/bin/env bash --version
GNU bash, version 5.2.21(1)-release (aarch64-apple-darwin23.0.0) Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
So if a bash script uses bash syntax which was added after 2007, that would not work with /bin/bash. That's why I had to use the indirection for another open source project. I don't know whether the QEMU bash scripts require a newer version of bash.
Regards
Stefan
Quoted 8 lines · Michael Tokarev
target/hexagon/idef-parser/prepare line 1
Quoted 2 lines
target/hexagon/idef-parser/prepare +1
-1-#!/bin/bash +#!/usr/bin/env bashWhat's the reason for this indirection? bash has been
/bin/bashfor decades, it is used this way in many other places in qemu code and in other projects. Yes I know about current move /bin =>/usr/binetc, but the thing is that traditional paths like this one (or like/bin/sh) is not going away any time soon. What's the matter here?
In addition to Stefan's answer, some modern systems use a per-user file system hierarchy where each user (or even each environment development for a user) gets a global set of directories with only the applications they want. This is done either through adding each application directory into the user PATH or by using a set of user-specific bin/lib/... directories full of symlinks to the chosen applications.
In those environments, /usr/bin might only contain "env", such as "/usr/bin/env application" works. This is the case for example on NixOS, which is more and more used in research environments for their easily reproducible build environments.
Sam
Signature · 2 lines
Samuel Tardieu Télécom Paris - Institut Polytechnique de Paris