summaryrefslogtreecommitdiff
path: root/debian/patches/check-for-dev-tty-before-using-it.patch
blob: 92b0e3a8774ec782958dd16b123a17ed0bc9278f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Description: Choose character device for "-c" testing more safely
 Hopefully solves test suite failures on Hurd
Author: Pino Toscano <pino@debian.org>
Reviewed-By: Axel Beckert <abe@debian.org>

Index: zsh/Test/C02cond.ztst
===================================================================
--- zsh.orig/Test/C02cond.ztst	2013-09-20 16:21:32.000000000 +0200
+++ zsh/Test/C02cond.ztst	2013-09-20 17:59:03.000000000 +0200
@@ -41,9 +41,14 @@
   fi
 0D:-b cond
 
-  # Use hardcoded /dev/tty because globbing inside /dev fails on Cygwin
-  char=/dev/tty
-  [[ -c $char && ! -c $zerolength ]]
+  # Hardcoded /dev/tty as necessary for Cygwin may fail on Hurd
+  tty=$(find /dev/ -name 'tty*' -type c -print)
+  if [[ -n $tty ]]; then
+    [[ -c $tty[(f)1] && ! -c $zerolength ]]
+  else
+    print -u$ZTST_fd 'Warning: Not testing [[ -c tty ]] (no tty found)'
+    [[ ! -c $zerolength ]]
+  fi
 0:-c cond
 
   [[ -d . && ! -d zerolength ]]