about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2023-02-14 09:21:19 +0000
committerPeter Stephenson <p.stephenson@samsung.com>2023-02-14 09:21:32 +0000
commit7e0c4406ceba1e021bf37680d6a6b8dcd3dd657f (patch)
tree25403174293198d6f5bebe00597cab2d5ec928ae
parent03887bb03fbca246fa94b5b5f2266572c0b6d038 (diff)
downloadzsh-7e0c4406ceba1e021bf37680d6a6b8dcd3dd657f.tar.gz
zsh-7e0c4406ceba1e021bf37680d6a6b8dcd3dd657f.tar.xz
zsh-7e0c4406ceba1e021bf37680d6a6b8dcd3dd657f.zip
51424: $(<...) shouldn't try to open a file with NO_EXEC
-rw-r--r--ChangeLog5
-rw-r--r--Src/exec.c3
-rw-r--r--Test/E01options.ztst3
3 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index be0d8d5e1..b490b0ee8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2023-02-14  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 51425: Src/exec.c, Test/E01OPTIONS: $(<...) shouldn't try to
+	open a file with NO_EXEC.
+
 2023-02-13  Bart Schaefer  <schaefer@zsh.org>
 
 	* 51430: Src/Modules/parameter.c, Src/builtin.c, Src/params.c,
diff --git a/Src/exec.c b/Src/exec.c
index c8eb71b34..3330bbce8 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -4678,6 +4678,9 @@ getoutput(char *cmd, int qt)
     if (!prog)
 	return NULL;
 
+    if (!isset(EXECOPT))
+	return newlinklist();
+
     if ((s = simple_redir_name(prog, REDIR_READ))) {
 	/* $(< word) */
 	int stream;
diff --git a/Test/E01options.ztst b/Test/E01options.ztst
index d38fbed74..533e08773 100644
--- a/Test/E01options.ztst
+++ b/Test/E01options.ztst
@@ -416,6 +416,9 @@
 1:NO_EXEC does recognize bad substitution syntax
 *?* bad substitution
 
+  (setopt noexec; : $(<nonexistentfile))
+0:NO_EXEC does not attempt to read files in $(<....)
+
   setopt NO_eval_lineno
   eval 'print $LINENO'
   setopt eval_lineno