Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: More tests



In article <E120XrM-00073o-00.1999-12-21-22-34-25@xxxxxxxxxxxxxxxxxxx>,
  Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx> writes:

> Here are some more tests for basic shell stuff.

This is some shell scripting portability fixes.

1. modish is changed to a directory.

  On Solaris 7 and 4.4BSD, sticky bit for non-directories can be set
  only by root.  If an usual user attempt to do it, Solaris 7 simply
  ignores the bit and 4.4BSD --- I tested on FreeBSD 2.2.8, NetBSD
  1.4.1 and BSD/OS 3.0 --- causes EFTYPE.

2. The format of `df' is different on Solaris 7.

Z:akr@is27e1u11% df /
/                  (/dev/dsk/c0t0d0s0 ): 1221764 blocks   316009 files
Z:akr@is27e1u11% 

3. mknod cannot be used for making a pipe on 4.4BSD.

Z:akr@ape% mknod pipe p 
usage: mknod name [b | c] major minor
zsh: exit 1     mknod pipe p
Z:akr@ape% 

mkfifo should be used instead.  mknod on NetBSD 1.4.1 supports above
usage, though.

Index: Test/07cond.ztst
===================================================================
RCS file: /projects/zsh/zsh/Test/07cond.ztst,v
retrieving revision 1.1.1.1
diff -u -F^( -r1.1.1.1 07cond.ztst
--- Test/07cond.ztst	1999/12/21 23:12:01	1.1.1.1
+++ Test/07cond.ztst	1999/12/22 21:29:58
@@ -13,7 +13,7 @@
   touch zerolength
   print 'Garbuglio' >nonzerolength
 
-  touch modish
+  mkdir modish
   chmod g+s modish
   chmod u+s modish
   chmod +t modish
@@ -26,7 +26,11 @@
 0:-a cond
 
   # Find a block special file system.  This is a little tricky.
-  block=$(df / | tail -1 | awk '{ print $1 }') &&
+  block=$(df / | awk '
+    $NF == "/" {print $1}
+    $1 == "/" && substr($2,0,1) == "(" {
+      if((l = index($2,")") - 2) < 0) l = length($2) - 1;
+      print substr($2,2,l)}') &&
   [[ -b $block && ! -b zerolength ]]
 0:-b cond
 
@@ -61,7 +65,11 @@
   [[ -o rcs && ! -o norcs && -o noerrexit && ! -o errexit ]]
 0:-o cond
 
-  mknod pipe p
+  if whence mkfifo >/dev/null; then
+    mkfifo pipe
+  else
+    mknod pipe p
+  fi
   [[ -p pipe && ! -p zerolength ]]
 0:-p cond
 
-- 
Tanaka Akira



Messages sorted by: Reverse Date, Date, Thread, Author