pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/regress/tools regress/tools: demonstrate wrong shell q...
details: https://anonhg.NetBSD.org/pkgsrc/rev/da4da6af7598
branches: trunk
changeset: 331688:da4da6af7598
user: rillig <rillig%pkgsrc.org@localhost>
date: Fri Mar 22 22:41:06 2019 +0000
description:
regress/tools: demonstrate wrong shell quoting in the tools wrapper
diffstat:
regress/tools/Makefile | 17 ++++++++++++++++-
regress/tools/files/logging-test.sh | 18 +++++++++++++++++-
2 files changed, 33 insertions(+), 2 deletions(-)
diffs (69 lines):
diff -r c9ec87619891 -r da4da6af7598 regress/tools/Makefile
--- a/regress/tools/Makefile Fri Mar 22 22:13:21 2019 +0000
+++ b/regress/tools/Makefile Fri Mar 22 22:41:06 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.11 2019/03/22 20:56:16 rillig Exp $
+# $NetBSD: Makefile,v 1.12 2019/03/22 22:41:06 rillig Exp $
#
DISTNAME= # not applicable
@@ -18,6 +18,21 @@
REGRESS_TESTS+= awk sed sh sort tar tr
USE_TOOLS+= awk sed sh sort tar tr
+TOOLS_CREATE+= script-dquot
+TOOLS_SCRIPT.script-dquot= \
+ echo "hello; world"
+
+TOOLS_CREATE+= script-backslash
+TOOLS_SCRIPT.script-backslash= \
+ echo hello\;\ world
+
+# If both of the above tools are properly quoted during logging, the
+# semicolon in "hello; world" is never interpreted as a shell command
+# delimiter, and this tool is never run.
+TOOLS_CREATE+= world
+TOOLS_SCRIPT.world= \
+ echo oops
+
do-build:
.for t in ${REGRESS_TESTS}
${RUN} cd ${WRKSRC}; \
diff -r c9ec87619891 -r da4da6af7598 regress/tools/files/logging-test.sh
--- a/regress/tools/files/logging-test.sh Fri Mar 22 22:13:21 2019 +0000
+++ b/regress/tools/files/logging-test.sh Fri Mar 22 22:41:06 2019 +0000
@@ -1,5 +1,5 @@
#! /bin/sh
-# $NetBSD: logging-test.sh,v 1.2 2019/03/22 22:13:21 rillig Exp $
+# $NetBSD: logging-test.sh,v 1.3 2019/03/22 22:41:06 rillig Exp $
# Up to March 2019, the command logging for the wrapped tools didn't properly
# quote the command line arguments. This meant the logging did not reflect
@@ -31,6 +31,8 @@
(exec echo "squot" "'" "end")
(exec echo "five" '\\\\\' "end")
(exec mkdir "directory with spaces")
+(exec script-dquot)
+(exec script-backslash)
unset TOOLS_WRAPPER_LOG
@@ -63,4 +65,18 @@
<.> echo five \\\\\ end
[*] WRKDIR/.tools/bin/mkdir directory with spaces
<.> BINDIR/mkdir -p directory with spaces
+[*] WRKDIR/.tools/bin/script-dquot
+[*] WRKDIR/.tools/bin/world
+<.> echo oops
+oops
+[*] WRKDIR/.tools/bin/script-backslash
+<.> echo hello\;\ world
EOF
+
+# FIXME: The tool wrapper log must contain [*] and <.> equally often.
+# Explanation:
+# In WRKDIR/.tools/bin/script-dquot, the shell quoting is obviously wrong.
+# This results in "hello" being echoed to stdout instead of the log file.
+# This also results in the "hello" tool to be run.
+# The output of that tool is appended to the log file, as can be seen in
+# the tool wrapper script.
Home |
Main Index |
Thread Index |
Old Index