Skip to contentSkip to conversation

support/dependencies: check PATH does not carry a \n

PATCH New Yann E. MORIN 2 participants 2 messages May 20, 2017 – Jun 8, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 support/dependencies: check PATH does not carry a \n

... otherwise it fails spectacularly as soon as PATH is referenced in a package rule (i.e. very soon, fortunately):

Quoted 1 line
Quoted 1 line
Quoted 1 line

host-lzip 1.18 Downloading

/bin/bash: -c: line 0: unexpected EOF while looking for matching `"' /bin/bash: -c: line 1: syntax error: unexpected end of file

Fixes # 9886.

---
 support/dependencies/dependencies.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
support/dependencies/dependencies.sh +12 -0
index 168d1960a1..925414cf18 100755
@@ -29,6 +29,18 @@ if test -n "$LD_LIBRARY_PATH" ; then
 	fi
 fi;
 
+# PATH should not contain a newline, otherwise it fails in spectacular ways
+# as soon as PATH is referenced in a package rule
+case "${PATH}" in
+(*"
+"*) printf "\n"
+    # Break the '\n' sequence, or a \n is printed (which is not what we want).
+    printf "Your PATH contains a newline (%sn) charater.\n" "\\"
+    printf "This doesn't work. Fix you PATH.\n"
+    exit 1
+    ;;
+esac
+
 # sanity check for CWD in PATH. Having the current working directory
 # in the PATH makes the toolchain build process break.
 # try not to rely on egrep..
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 support/dependencies: check PATH does not carry a \n

Hello,

support/dependencies/dependencies.sh if test -n "$LD_LIBRARY_PATH" ; then · line 38

Quoted 2 lines · Yann E. MORIN
support/dependencies/dependencies.sh +2 -0
+    # Break the '\n' sequence, or a \n is printed (which is not what we want).
+    printf "Your PATH contains a newline (%sn) charater.\n" "\\"

Typo: character.

support/dependencies/dependencies.sh if test -n "$LD_LIBRARY_PATH" ; then · line 41

Quoted 3 lines
support/dependencies/dependencies.sh +3 -0
+    printf "This doesn't work. Fix you PATH.\n"
+    exit 1
+    ;;

Also, we use one tab for indentation in this file, not 4 spaces, so I've fixed that.

Applied to master. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com