From df9eab81a6ad1f818856ebaf4ee8a8ec81085a67 Mon Sep 17 00:00:00 2001 From: Laurent Huberdeau Date: Wed, 4 Sep 2024 12:15:37 -0400 Subject: [PATCH 1/2] Disable pathname expansion using set -f --- sh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sh.c b/sh.c index 025575f6..19ad7a43 100644 --- a/sh.c +++ b/sh.c @@ -2381,7 +2381,7 @@ void comp_glo_decl(ast node) { void prologue() { putstr("#!/bin/sh\n"); - putstr("set -e -u\n"); + putstr("set -e -u -f\n"); putstr("LC_ALL=C\n\n"); } From 0a70851e42b8171a6fdab19139fd6729eff9abd9 Mon Sep 17 00:00:00 2001 From: Laurent Huberdeau Date: Wed, 4 Sep 2024 12:23:13 -0400 Subject: [PATCH 2/2] Regenerate examples --- examples/compiled/all-chars.sh | 2 +- examples/compiled/base64.sh | 2 +- examples/compiled/cat.sh | 2 +- examples/compiled/cp.sh | 2 +- examples/compiled/echo.sh | 2 +- examples/compiled/empty.sh | 2 +- examples/compiled/fib.sh | 2 +- examples/compiled/hello.sh | 2 +- examples/compiled/print-reverse.sh | 2 +- examples/compiled/repl.sh | 2 +- examples/compiled/reverse.sh | 2 +- examples/compiled/select-file.sh | 2 +- examples/compiled/sha256sum.sh | 2 +- examples/compiled/sum-array.sh | 2 +- examples/compiled/wc-stdin.sh | 2 +- examples/compiled/wc.sh | 2 +- examples/compiled/welcome.sh | 2 +- examples/compiled/winterpi.sh | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/compiled/all-chars.sh b/examples/compiled/all-chars.sh index 0eb813ef..f559935a 100755 --- a/examples/compiled/all-chars.sh +++ b/examples/compiled/all-chars.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e -u +set -e -u -f LC_ALL=C : $((c = 0)) diff --git a/examples/compiled/base64.sh b/examples/compiled/base64.sh index 52be9989..da4ee1cf 100755 --- a/examples/compiled/base64.sh +++ b/examples/compiled/base64.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e -u +set -e -u -f LC_ALL=C __ALLOC=1 # Starting heap at 1 because 0 is the null pointer. diff --git a/examples/compiled/cat.sh b/examples/compiled/cat.sh index efcb587f..d7e44d6f 100755 --- a/examples/compiled/cat.sh +++ b/examples/compiled/cat.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e -u +set -e -u -f LC_ALL=C __ALLOC=1 # Starting heap at 1 because 0 is the null pointer. diff --git a/examples/compiled/cp.sh b/examples/compiled/cp.sh index 7fdacdcf..fa256aae 100755 --- a/examples/compiled/cp.sh +++ b/examples/compiled/cp.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e -u +set -e -u -f LC_ALL=C : $((filename = 0)) diff --git a/examples/compiled/echo.sh b/examples/compiled/echo.sh index a33f67fb..11d50406 100755 --- a/examples/compiled/echo.sh +++ b/examples/compiled/echo.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e -u +set -e -u -f LC_ALL=C : $((i = argv_ = argc = 0)) diff --git a/examples/compiled/empty.sh b/examples/compiled/empty.sh index e5828186..af7584ef 100755 --- a/examples/compiled/empty.sh +++ b/examples/compiled/empty.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e -u +set -e -u -f LC_ALL=C _main() { diff --git a/examples/compiled/fib.sh b/examples/compiled/fib.sh index e7134315..7e67745d 100755 --- a/examples/compiled/fib.sh +++ b/examples/compiled/fib.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e -u +set -e -u -f LC_ALL=C : $((__t2 = __t1 = n = 0)) diff --git a/examples/compiled/hello.sh b/examples/compiled/hello.sh index 83e3da80..44fbf543 100755 --- a/examples/compiled/hello.sh +++ b/examples/compiled/hello.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e -u +set -e -u -f LC_ALL=C _main() { diff --git a/examples/compiled/print-reverse.sh b/examples/compiled/print-reverse.sh index 44a86661..fa4536de 100755 --- a/examples/compiled/print-reverse.sh +++ b/examples/compiled/print-reverse.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e -u +set -e -u -f LC_ALL=C : $((i = len = tmp = end = str = 0)) diff --git a/examples/compiled/repl.sh b/examples/compiled/repl.sh index ac2fcbfd..d43e0b1d 100755 --- a/examples/compiled/repl.sh +++ b/examples/compiled/repl.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e -u +set -e -u -f LC_ALL=C __ALLOC=1 # Starting heap at 1 because 0 is the null pointer. diff --git a/examples/compiled/reverse.sh b/examples/compiled/reverse.sh index 422bdd3b..11754573 100755 --- a/examples/compiled/reverse.sh +++ b/examples/compiled/reverse.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e -u +set -e -u -f LC_ALL=C : $((i = argv_ = argc = 0)) diff --git a/examples/compiled/select-file.sh b/examples/compiled/select-file.sh index 2eb606be..89d2d9ba 100755 --- a/examples/compiled/select-file.sh +++ b/examples/compiled/select-file.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e -u +set -e -u -f LC_ALL=C ################################################################################ diff --git a/examples/compiled/sha256sum.sh b/examples/compiled/sha256sum.sh index 7c33f76a..d4525219 100755 --- a/examples/compiled/sha256sum.sh +++ b/examples/compiled/sha256sum.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e -u +set -e -u -f LC_ALL=C __ALLOC=1 # Starting heap at 1 because 0 is the null pointer. diff --git a/examples/compiled/sum-array.sh b/examples/compiled/sum-array.sh index 39723f57..a6a8ea6d 100755 --- a/examples/compiled/sum-array.sh +++ b/examples/compiled/sum-array.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e -u +set -e -u -f LC_ALL=C : $((sum = i = size = n = 0)) diff --git a/examples/compiled/wc-stdin.sh b/examples/compiled/wc-stdin.sh index daea2254..523a3b5c 100755 --- a/examples/compiled/wc-stdin.sh +++ b/examples/compiled/wc-stdin.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e -u +set -e -u -f LC_ALL=C : $((c = 0)) diff --git a/examples/compiled/wc.sh b/examples/compiled/wc.sh index 816a2813..b3175468 100755 --- a/examples/compiled/wc.sh +++ b/examples/compiled/wc.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e -u +set -e -u -f LC_ALL=C __ALLOC=1 # Starting heap at 1 because 0 is the null pointer. diff --git a/examples/compiled/welcome.sh b/examples/compiled/welcome.sh index 9231653e..d726fa39 100755 --- a/examples/compiled/welcome.sh +++ b/examples/compiled/welcome.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e -u +set -e -u -f LC_ALL=C : $((__t1 = i = name = 0)) diff --git a/examples/compiled/winterpi.sh b/examples/compiled/winterpi.sh index 9f7fface..ab1b12d2 100755 --- a/examples/compiled/winterpi.sh +++ b/examples/compiled/winterpi.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e -u +set -e -u -f LC_ALL=C __ALLOC=1 # Starting heap at 1 because 0 is the null pointer.