git: f12e86a205c8 - stable/13 - tools/build/make.py: fix cross build on Fedora Linux
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 08 Nov 2022 03:30:42 UTC
The branch stable/13 has been updated by alfredo:
URL: https://cgit.FreeBSD.org/src/commit/?id=f12e86a205c8577a8f8bd9f9955fed78f658c004
commit f12e86a205c8577a8f8bd9f9955fed78f658c004
Author: Alfredo Dal'Ava Junior <alfredo@FreeBSD.org>
AuthorDate: 2022-11-01 23:59:58 +0000
Commit: Alfredo Dal'Ava Junior <alfredo@FreeBSD.org>
CommitDate: 2022-11-08 03:29:58 +0000
tools/build/make.py: fix cross build on Fedora Linux
Fedora defines shell functions for some commands used by FreeBSD build
scripts. Unortunatelly it makes them behave incorrectly for our purposes.
For instance 'which which' returns something like:
which ()
{
( alias;
eval ${which_declare} ) | /usr/bin/which --tty-only --read-alias ...
}
instead of
/usr/bin/which
This patch unsets those functions to restore original/expected behavior
Reviewed by: emaste, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36900
(cherry picked from commit b7ac17b48bdfc688b54b29aa4feacb535c91aec2)
---
tools/build/make.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/build/make.py b/tools/build/make.py
index 799ea89b74b3..cede0c99e316 100755
--- a/tools/build/make.py
+++ b/tools/build/make.py
@@ -267,5 +267,13 @@ if __name__ == "__main__":
shlex.quote(s) for s in [str(bmake_binary)] + bmake_args)
debug("Running `env ", env_cmd_str, " ", make_cmd_str, "`", sep="")
os.environ.update(new_env_vars)
+
+ # Fedora defines bash function wrapper for some shell commands and this
+ # makes 'which <command>' return the function's source code instead of
+ # the binary path. Undefine it to restore the original behavior.
+ os.unsetenv("BASH_FUNC_which%%")
+ os.unsetenv("BASH_FUNC_ml%%")
+ os.unsetenv("BASH_FUNC_module%%")
+
os.chdir(str(source_root))
os.execv(str(bmake_binary), [str(bmake_binary)] + bmake_args)