pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/regress/tools



Module Name:    pkgsrc
Committed By:   rillig
Date:           Fri Mar 22 22:41:06 UTC 2019

Modified Files:
        pkgsrc/regress/tools: Makefile
        pkgsrc/regress/tools/files: logging-test.sh

Log Message:
regress/tools: demonstrate wrong shell quoting in the tools wrapper


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 pkgsrc/regress/tools/Makefile
cvs rdiff -u -r1.2 -r1.3 pkgsrc/regress/tools/files/logging-test.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/regress/tools/Makefile
diff -u pkgsrc/regress/tools/Makefile:1.11 pkgsrc/regress/tools/Makefile:1.12
--- pkgsrc/regress/tools/Makefile:1.11  Fri Mar 22 20:56:16 2019
+++ pkgsrc/regress/tools/Makefile       Fri Mar 22 22:41:06 2019
@@ -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+=      logging
 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};                                            \

Index: pkgsrc/regress/tools/files/logging-test.sh
diff -u pkgsrc/regress/tools/files/logging-test.sh:1.2 pkgsrc/regress/tools/files/logging-test.sh:1.3
--- pkgsrc/regress/tools/files/logging-test.sh:1.2      Fri Mar 22 22:13:21 2019
+++ pkgsrc/regress/tools/files/logging-test.sh  Fri Mar 22 22:41:06 2019
@@ -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 @@ export TOOLS_WRAPPER_LOG
 (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 @@ assert_file_equals "$nopath_log" <<'EOF'
 <.> 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