zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: block device file detection.
@ 2000-05-04  6:32 Tanaka Akira
  0 siblings, 0 replies; only message in thread
From: Tanaka Akira @ 2000-05-04  6:32 UTC (permalink / raw)
  To: zsh-workers

I found that FreeBSD 4.0 mount a disk with a character special file.

% df /
Filesystem   1K-blocks     Used    Avail Capacity  Mounted on
/dev/ad0s2a      49583    24954    20663    55%    /
% ls -l /dev/ad0s2a
crw-r-----  1 root  operator  116, 0x00030000 May  1 04:40 /dev/ad0s2a
% uname -a
FreeBSD dhcp21.m17n.org 4.0-RELEASE FreeBSD 4.0-RELEASE #0: Mon Mar 20 22:50:22 GMT 2000     root@monster.cdrom.com:/usr/src/sys/compile/GENERIC  i386

So, `make check' is failed as:

| Test ./07cond.ztst failed: bad status 1, expected 0 from:
|   # Find a block special file system.  This is a little tricky.
|   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 ]]
| Was testing: -b cond
| ./07cond.ztst: test failed.

I modified the block special file detection code to use find -type b.
I tested this code on FreeBSD 4.0/3.2/2.2.6, NetBSD 1.4.2, Solaris 7,
SunOS 4.1.4 and Linux.

Index: Test/07cond.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/07cond.ztst,v
retrieving revision 1.2
diff -u -r1.2 07cond.ztst
--- Test/07cond.ztst	2000/04/01 20:49:48	1.2
+++ Test/07cond.ztst	2000/05/04 06:15:53
@@ -27,11 +27,7 @@
 0:-a cond
 
   # Find a block special file system.  This is a little tricky.
-  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)}') &&
+  block=$(find /dev /devices -type b -print 2>/dev/null|head -1) &&
   [[ -b $block && ! -b zerolength ]]
 0:-b cond
 
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-05-04  6:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-04  6:32 PATCH: block device file detection Tanaka Akira

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).