about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2020-03-21 18:40:37 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2020-03-25 23:49:01 +0000
commitde587b43ba10fc11159630fd63486e247ea8719c (patch)
treec453803738b1efc00b4cf1c6706796330bd15a15 /Test
parent0903ddb7b981974c0f66113ae95790962e72d1de (diff)
downloadzsh-de587b43ba10fc11159630fd63486e247ea8719c.tar.gz
zsh-de587b43ba10fc11159630fd63486e247ea8719c.tar.xz
zsh-de587b43ba10fc11159630fd63486e247ea8719c.zip
45583/0001: Add tests for the segfault on resolving a symlink loop bug (workers/45282).
This is workers/45377, extended.
Diffstat (limited to 'Test')
-rw-r--r--Test/D02glob.ztst36
1 files changed, 36 insertions, 0 deletions
diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst
index 4e6dc2a7a..248cc7ff5 100644
--- a/Test/D02glob.ztst
+++ b/Test/D02glob.ztst
@@ -757,6 +757,42 @@
 -f:(workers/45367) modifier ':P' squashes multiple slashes
 >/dev  
 
+  ln -s loop glob.tmp/loop
+  ln -s loop glob.tmp/trap
+  { 
+    (set -- glob.tmp/trap; echo $1:P)
+    (set -- glob.tmp/loop; echo $1:P)
+  } always {
+    rm -f glob.tmp/trap glob.tmp/loop
+  }
+-f:the ':P' modifier handles symlink loops in the last path component
+*>*/(trap|loop)
+*>*/(trap|loop)
+
+  ln -s loop glob.tmp/loop
+  ln -s loop glob.tmp/trap
+  { 
+    (set -- glob.tmp/loop/trailing/components; echo $1:P)
+    (set -- glob.tmp/trap/trailing/components; echo $1:P)
+  } always {
+    rm -f glob.tmp/trap glob.tmp/loop
+  }
+-f:the ':P' modifier handles symlink loops before the last path component
+*>*/glob.tmp/loop/trailing/components
+*>*/glob.tmp/(loop|trap)/trailing/components
+
+  ln -s flip glob.tmp/flop
+  ln -s flop glob.tmp/flip
+  {
+    (set -- glob.tmp/flip; echo $1:P)
+    (set -- glob.tmp/flip/trailing/components; echo $1:P)
+  } always {
+    rm -f glob.tmp/flip glob.tmp/flop
+  }
+-f:the ':P' modifier handles symlink loops other than the trivial case
+*>*/glob.tmp/(flip|flop)
+*>*/glob.tmp/(flip|flop)/trailing/components
+
 %clean
 
  # Fix unreadable-directory permissions so ztst can clean up properly