Skip to contentSkip to conversation

support/dependencies/dependencies.sh: simplify an error message

PATCH New Markus Mayer 2 participants 2 messages Apr 9, 2019 – Apr 10, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 support/dependencies/dependencies.sh: simplify an error message

There is no need to break the "\n" sequence using "%sn". We can just escape it. Note: the escaping backslash needs to be escaped too, because the shell will process the string before printf gets to see it.

---
 support/dependencies/dependencies.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/dependencies/dependencies.sh +1 -2
index 826874baa2e8..1d5c164aa65b 100755
@@ -37,8 +37,7 @@ case ":${PATH:-unset}:" 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) character.\n" "\\"
+	printf "Your PATH contains a newline (\\\n) character.\n"
 	printf "This doesn't work. Fix you PATH.\n"
 	exit 1
 	;;
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 support/dependencies/dependencies.sh: simplify an error message

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Markus" == Markus Mayer <[email protected]> writes:

There is no need to break the "\n" sequence using "%sn". We can just escape it. Note: the escaping backslash needs to be escaped too, because the shell will process the string before printf gets to see it.

Maybe we should have used single quotes here to get rid of one layer of quoting.

Committed, thanks.

Quoted 25 lines
---
 support/dependencies/dependencies.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/dependencies/dependencies.sh +1 -2
index 826874baa2e8..1d5c164aa65b 100755
@@ -37,8 +37,7 @@ case ":${PATH:-unset}:" 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) character.\n" "\\"
+	printf "Your PATH contains a newline (\\\n) character.\n"
 	printf "This doesn't work. Fix you PATH.\n"
 	exit 1
 	;;
Signature · 6 lines
2.17.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 1 line
Bye, Peter Korsgaard