From 909b88c40bfb55d24c6a8a7ed85dca6cf9f18f07 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Thu, 2 Apr 2015 16:07:41 +0000 Subject: [PATCH] When skipping white space after #! to find the interpreter only skip ' ' and tabs. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15063 --- coregrind/m_ume/script.c | 2 +- none/tests/Makefile.am | 1 + none/tests/shell_valid4 | 3 +++ none/tests/shell_valid4.stderr.exp | 0 none/tests/shell_valid4.stdout.exp | 1 + none/tests/shell_valid4.vgtest | 7 +++++++ 6 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 none/tests/shell_valid4 create mode 100644 none/tests/shell_valid4.stderr.exp create mode 100644 none/tests/shell_valid4.stdout.exp create mode 100644 none/tests/shell_valid4.vgtest diff --git a/coregrind/m_ume/script.c b/coregrind/m_ume/script.c index 741838e62d..182a23c65a 100644 --- a/coregrind/m_ume/script.c +++ b/coregrind/m_ume/script.c @@ -55,7 +55,7 @@ Bool VG_(match_script)(const void *hdr, Int len) // Find interpreter name, make sure it's an absolute path (starts with // '/') and has at least one more char. First, skip over any space // between the #! and the start of the interpreter name - while (interp < end && VG_(isspace)(*interp)) interp++; + while (interp < end && (*interp == ' ' || *interp == '\t')) interp++; // overrun? if (interp >= end) return False; // can't find start of interp name diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index 54790425ac..fee4a782f8 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -159,6 +159,7 @@ EXTRA_DIST = \ shell_valid1 shell_valid1.vgtest shell_valid1.stderr.exp \ shell_valid2 shell_valid2.vgtest shell_valid2.stderr.exp \ shell_valid3 shell_valid3.vgtest shell_valid3.stderr.exp \ + shell_valid4 shell_valid4.vgtest shell_valid4.stderr.exp shell_valid4.stdout.exp \ shell_zerolength shell_zerolength.vgtest shell_zerolength.stderr.exp \ shell_zerolength.stderr.exp-dash \ sha1_test.stderr.exp sha1_test.vgtest \ diff --git a/none/tests/shell_valid4 b/none/tests/shell_valid4 new file mode 100755 index 0000000000..fe35d8ae6b --- /dev/null +++ b/none/tests/shell_valid4 @@ -0,0 +1,3 @@ +#! +/bin/echo + diff --git a/none/tests/shell_valid4.stderr.exp b/none/tests/shell_valid4.stderr.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/none/tests/shell_valid4.stdout.exp b/none/tests/shell_valid4.stdout.exp new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/none/tests/shell_valid4.stdout.exp @@ -0,0 +1 @@ + diff --git a/none/tests/shell_valid4.vgtest b/none/tests/shell_valid4.vgtest new file mode 100644 index 0000000000..1178aa1cf3 --- /dev/null +++ b/none/tests/shell_valid4.vgtest @@ -0,0 +1,7 @@ +# +# This test used to write +# ./shell_valid4 +# to stdout which is not what happens when executed natively. +# +prog: shell_valid4 +vgopts: -q -- 2.47.3