From c5ec4ef5f9782b6de68abc89f801067b7acc2dab Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Mon, 31 May 2021 13:41:49 -0700 Subject: [PATCH] Reverts noshebang test fixes The hope is that the noshebang test was fixed on old glibc through e74b9d53df8. Revert the previous optimistic attempts to fix these through adding sleeps and subshells. This reverts commit b3da0bd5a235549ed67ca90b44d3cd2f519f6cf9. This reverts commit 8a86d3452f9ce779d4b62008b3b3f6ae6c1cf570. --- tests/checks/noshebang.fish | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/tests/checks/noshebang.fish b/tests/checks/noshebang.fish index 5d7d28a4a..c392b2d1d 100644 --- a/tests/checks/noshebang.fish +++ b/tests/checks/noshebang.fish @@ -1,11 +1,11 @@ -# RUN: %fish -C'set -g fish (builtin realpath %fish)' %s +# RUN: %fish %s # Test for shebangless scripts - see 7802. set testdir (mktemp -d) cd $testdir -$fish -c 'true > file' +touch file chmod a+x file function runfile @@ -23,24 +23,22 @@ function runfile end # Empty executable files are 'true'. -sleep 0.2 +true >file +sleep 0.1 runfile #CHECK: 0 #CHECK: 0 # Files without NUL are 'true' as well. -# NOTE: We redirect in a new process because the file must be *closed* -# before it can be run. On some systems that doesn't happen quickly enough. -$fish -c "echo -e -n '#COMMENT\n#COMMENT' >file" -sleep 0.2 +echo -e -n '#COMMENT\n#COMMENT' >file runfile #CHECK: 0 #CHECK: 0 # Never implicitly pass files ending with .fish to /bin/sh. -touch file.fish +true >file.fish +sleep 0.1 chmod a+x file.fish -sleep 0.3 set -g fish_use_posix_spawn 0 ./file.fish echo $status @@ -61,15 +59,15 @@ rm file.fish # On to NUL bytes. # The heuristic is that there must be a line containing a lowercase letter before the first NUL byte. -$fish -c "echo -n -e 'true\n\x00' >file" -sleep 0.3 +echo -n -e 'true\n\x00' >file +sleep 0.1 runfile #CHECK: 0 #CHECK: 0 # Doesn't meet our heuristic as there is no newline. -$fish -c "echo -n -e 'true\x00' >file" -sleep 0.3 +echo -n -e 'true\x00' >file +sleep 0.1 runfile #CHECK: 126 #CHECKERR: Failed {{.*}} @@ -82,7 +80,7 @@ runfile #CHECKERR: {{.*}} # Doesn't meet our heuristic as there is no lowercase before newline. -$fish -c "echo -n -e 'NOPE\n\x00' >file" +echo -n -e 'NOPE\n\x00' >file sleep 0.1 runfile #CHECK: 126