[source] build: bundle-libraries.sh: do not override argv[0] in inner exec calls

LEDE Commits lede-commits at lists.infradead.org
Thu Dec 14 09:44:56 PST 2017


jow pushed a commit to source.git, branch lede-17.01:
https://git.lede-project.org/2e1a87a3e11b6928b128fcf72570178a250ba072

commit 2e1a87a3e11b6928b128fcf72570178a250ba072
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Mon Jul 24 13:33:33 2017 +0200

    build: bundle-libraries.sh: do not override argv[0] in inner exec calls
    
    Only mangle argv[0] of the first executed process and leave the argument
    vector of subsequent invocations as-is to allow child programs to properly
    discover resources relative to their binary locations.
    
    Fixes "cc1" discovery when executing the host gcc through the bundled
    "ccache" executable.
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
    (cherry picked from commit 9e64874fb2508e49e52898c238d817bd152bf2c2)
---
 scripts/bundle-libraries.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/bundle-libraries.sh b/scripts/bundle-libraries.sh
index b108fd8..f254d4d 100755
--- a/scripts/bundle-libraries.sh
+++ b/scripts/bundle-libraries.sh
@@ -79,8 +79,10 @@ _runas_so() {
 		int mangle_arg0(int argc, char **argv, char **env) {
 			char *arg0 = getenv("RUNAS_ARG0");
 
-			if (arg0)
+			if (arg0) {
 				argv[0] = arg0;
+				unsetenv("RUNAS_ARG0");
+			}
 
 			return 0;
 		}



More information about the lede-commits mailing list