bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

coreutils test failure on MacOS X


From: Bruno Haible
Subject: coreutils test failure on MacOS X
Date: Tue, 2 Jan 2007 22:07:09 +0100
User-agent: KMail/1.9.1

Hi,

On MacOS X 10.3.9 (Darwin 7.9), coreutils-6.7 builds fine but gives a failure
in "make check":

Making check in mv
...
mv: cannot create fifo `/tmp/tmp21258/mv-null': Operation not permitted
FAIL: mv-special-1

This is fairly new; it worked in version 6.4-cvs.

Execution with VERBOSE=yes shows:

+ test -z /tmp/tmp14070
+ null=mv-null
+ dir=mv-dir
+ framework_failure=0
+ mkdir mv-spec.14070
+ cd mv-spec.14070
+ rm -f mv-null
+ mknod mv-null p
+ test -p mv-null
+ mkdir -p mv-dir/a/b/c mv-dir/d/e/f
+ touch mv-dir/a/b/c/file1 mv-dir/d/e/f/file2
+ test 0 = 1
+ fail=0
+ mv --verbose mv-null mv-dir /tmp/tmp14070
mv: cannot create fifo `/tmp/tmp14070/mv-null': Operation not permitted
+ fail=1

When I do "mknod nod1 p", the system call being executed is this:

 14111 mknod    CALL  mkfifo(0xbffffb6e,0x1b6)
 14111 mknod    NAMI  "nod1"
 14111 mknod    RET   mkfifo 0

When I then do "mv --verbose nod1 /tmp/nod2" (/tmp being on a different 
partition),
the system calls are these:

 14142 mv       CALL  stat(0xbfffedc0,0xbffff1d0)
 14142 mv       NAMI  
"/Volumes/UserData/work/coreutils-6.7/tests/mv/../../src/mv"
 14142 mv       RET   stat 0
 14142 mv       CALL  getuid
 14142 mv       RET   getuid 502/0x1f6
 14142 mv       CALL  getuid
 14142 mv       RET   getuid 502/0x1f6
 14142 mv       CALL  ioctl(0,FIODTYPE,0xbffff830)
 14142 mv       RET   ioctl 0
 14142 mv       CALL  stat(0xbffffb62,0xbffff830)
 14142 mv       NAMI  "/tmp/nod2"
 14142 mv       RET   stat -1 errno 2 No such file or directory
 14142 mv       CALL  lstat(0xbffffb5d,0xbffff580)
 14142 mv       NAMI  "nod1"
 14142 mv       RET   lstat 0
 14142 mv       CALL  lstat(0xbffffb62,0xbffff5e0)
 14142 mv       NAMI  "/tmp/nod2"
 14142 mv       RET   lstat -1 errno 2 No such file or directory
 14142 mv       CALL  getuid
 14142 mv       RET   getuid 502/0x1f6
 14142 mv       CALL  getuid
 14142 mv       RET   getuid 502/0x1f6
 14142 mv       CALL  getgid
 14142 mv       RET   getgid 502/0x1f6
 14142 mv       CALL  getgid
 14142 mv       RET   getgid 502/0x1f6
 14142 mv       CALL  getuid
 14142 mv       RET   getuid 502/0x1f6
 14142 mv       CALL  getuid
 14142 mv       RET   getuid 502/0x1f6
 14142 mv       CALL  getuid
 14142 mv       RET   getuid 502/0x1f6
 14142 mv       CALL  getuid
 14142 mv       RET   getuid 502/0x1f6
 14142 mv       CALL  getlogin(0xa6476e2c,0xff)
 14142 mv       RET   getlogin 0
...
 14142 mv       CALL  fstat(0x1,0xbfffec60)
 14142 mv       RET   fstat 0
 14142 mv       CALL  ioctl(0x1,FIODTYPE,0xbfffecb0)
 14142 mv       RET   ioctl 0
 14142 mv       CALL  write(0x1,0x25c000,0x1e)
 14142 mv       GIO   fd 1 wrote 30 bytes
       "address@hidden@\M^\ -> address@hidden/tmp/address@hidden
       "
 14142 mv       RET   write 30/0x1e
 14142 mv       CALL  rename(0xbffffb5d,0xbffffb62)
 14142 mv       NAMI  "nod1"
 14142 mv       NAMI  "/tmp/nod2"
 14142 mv       RET   rename -1 errno 18 Cross-device link
 14142 mv       CALL  unlink(0xbffffb62)
 14142 mv       NAMI  "/tmp/nod2"
 14142 mv       RET   unlink -1 errno 2 No such file or directory
 14142 mv       CALL  mknod(0xbffffb62,0x1180,0)
 14142 mv       RET   mknod -1 errno 1 Operation not permitted
 14142 mv       CALL  write(0x2,0xbfffef80,0x4)
 14142 mv       GIO   fd 2 wrote 4 bytes
       "mv: "
 14142 mv       RET   write 4
 14142 mv       CALL  write(0x2,0xbfffef70,0x30)
 14142 mv       GIO   fd 2 wrote 48 bytes
       "Erzeugen von FIFO address@hidden/tmp/address@hidden nicht m\M-C\M-6gli\
        ch"
 14142 mv       RET   write 48/0x30
 14142 mv       CALL  write(0x2,0xbfffead0,0x19)
 14142 mv       GIO   fd 2 wrote 25 bytes
       ": Operation not permitted"
 14142 mv       RET   write 25/0x19
 14142 mv       CALL  write(0x2,0xa646e647,0x1)
 14142 mv       GIO   fd 2 wrote 1 byte
       "
       "
 14142 mv       RET   write 1
 14142 mv       CALL  close(0x1)
 14142 mv       RET   close 0
 14142 mv       CALL  close(0x2)
 14142 mv       RET   close 0
 14142 mv       CALL  exit(0x1)

As you can see, 'mv' tries to use the mknod() system call to create /tmp/nod2.
It should use the mkfifo() system call instead. Or, at least, when mknod() 
fails,
it should try mkfifo() as a fallback. This fixes it, and makes all tests pass:

2006-12-26  Bruno Haible  <address@hidden>

        * src/copy.c (copy_internal): Use mkfifo as a fallback if mknod fails.
        Needed on MacOS X.

*** src/copy.c.bak      Thu Dec  7 08:01:16 2006
--- src/copy.c  Tue Dec 26 11:24:41 2006
***************
*** 1686,1697 ****
      {
        /* Use mknod, rather than mkfifo, because the former preserves
         the special mode bits of a fifo on Solaris 10, while mkfifo
!        does not.  */
        if (mknod (dst_name, src_mode & ~omitted_permissions, 0) != 0)
!       {
!         error (0, errno, _("cannot create fifo %s"), quote (dst_name));
!         goto un_backup;
!       }
      }
    else if (S_ISBLK (src_mode) || S_ISCHR (src_mode) || S_ISSOCK (src_mode))
      {
--- 1686,1701 ----
      {
        /* Use mknod, rather than mkfifo, because the former preserves
         the special mode bits of a fifo on Solaris 10, while mkfifo
!        does not.  But fall back on mkfifo, because on some BSD systems,
!        mknod always fails when asked to create a FIFO.  */
        if (mknod (dst_name, src_mode & ~omitted_permissions, 0) != 0)
! #if HAVE_MKFIFO
!       if (mkfifo (dst_name, src_mode & ~S_IFIFO & ~omitted_permissions) != 0)
! #endif
!         {
!           error (0, errno, _("cannot create fifo %s"), quote (dst_name));
!           goto un_backup;
!         }
      }
    else if (S_ISBLK (src_mode) || S_ISCHR (src_mode) || S_ISSOCK (src_mode))
      {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]