Subject: bug#7708: cp: Solaris 11 ACL-related problem

From: Jim Meyering <[email-masked]>
Date: Wed, 22 Dec 2010 14:18:11 +0100

Jim Meyering wrote:
...
> Here's a small reproducer that should be made into its own test:
> (the currently failing test does catch it, but it's almost by accident)
>
>     $ mkdir -p D/D; chmod u=rx D; cp -pR D DD
>     $ chmod -R 700 DD; rm -rf DD
>     rm: cannot remove `DD/D': Permission denied
>     [Exit 1]
>
> Here's truss output from the above cp command:
>
>     mkdir("DD/D", 0700)                             = 0
>     lstat64("DD/D", 0x08047500)                     = 0
>     openat(AT_FDCWD, "D/D", O_RDONLY|O_NDELAY|O_LARGEFILE) = 3
>     fcntl(3, F_SETFD, 0x00000001)                   = 0
>     fstat64(3, 0x080471B0)                          = 0
>     getdents64(3, 0xCE9F4000, 8192)                 = 48
>     getdents64(3, 0xCE9F4000, 8192)                 = 0
>     close(3)                                        = 0
>     utimensat(AT_FDCWD, "DD/D", 0x08047320, 0)      = 0
>     lchown("DD/D", 14263, 14263)                    = 0
>     pathconf("D/D", _PC_ACL_ENABLED)                = 2
>     acl("D/D", ACE_GETACLCNT, 0, 0x00000000)        = 6
>     stat64("D/D", 0x08047220)                       = 0
>     acl("D/D", ACE_GETACL, 6, 0x0807FA00)           = 6
>     stat64("DD/D", 0x080471C0)                      = 0
>     pathconf("DD/D", _PC_ACL_ENABLED)               = 2
>     acl("DD/D", ACE_SETACL, 7, 0x0807FA70)          = 0
>     utimensat(AT_FDCWD, "DD", 0x080476A0, 0)        = 0
>     lchown("DD", 14263, 14263)                      = 0
>     pathconf("D", _PC_ACL_ENABLED)                  = 2
>     acl("D", ACE_GETACLCNT, 0, 0x00000000)          = 6
>     stat64("D", 0x080475A0)                         = 0
>     acl("D", ACE_GETACL, 6, 0x0807EFF0)             = 6
>     stat64("DD", 0x08047540)                        = 0
>     pathconf("DD", _PC_ACL_ENABLED)                 = 2
>     acl("DD", ACE_SETACL, 7, 0x0807F060)            = 0
>     llseek(0, 0, SEEK_CUR)                          = 1314515
>     close(0)                                        = 0
>     close(1)                                        = 0
>     close(2)                                        = 0
>     _exit(0)
>
> For the record, uname -a reports this:
>   SunOS xxx 5.11 snv_134 i86pc i386 i86pc Solaris

I omitted an important detail: file system type:
It is ZFS.