ksh93 does not report the correct kind of error when cd -@ is used for
a filesystem which doesn't support extended attributes (O_XATTR) like
/devices on Solaris :

ksh -c 'cd -@ /devices ; :'
/home/josh/bin/ksh: cd: /dev/file/xattr@/devices//@//: [No such file
or directory]

It should return the EINVAL from openat(3, ".",
O_RDONLY|O_NONBLOCK|O_XATTR) from the truss log below:

stat(".", 0xFFFFFD7FFFDFF8C8)                   = 0
sigaction(SIGCLD, 0xFFFFFD7FFFDFF920, 0xFFFFFD7FFFDFF998) = 0
lwp_sigmask(SIG_SETMASK, 0x00000000, 0x00000000, 0x00000000,
0x00000000) = 0xFFBFFEFF [0xFFFFFFFF]
openat(10, "/devices", O_RDONLY|O_NONBLOCK)     = 3
fstat(3, 0xFFFFFD7FFFDFE400)                    = 0
fcntl(3, F_SETFD, 0x00000001)                   = 0
openat(3, ".", O_RDONLY|O_NONBLOCK|O_XATTR)     Err#22 EINVAL
close(3)                                        = 0
openat(10, "/dev/file/xattr@/devices//@//", O_RDONLY|O_NONBLOCK) Err#2 ENOENT
open("/usr/lib/locale/en_US.UTF-8/LC_MESSAGES/SUNW_OST_OSLIB.mo",
O_RDONLY) Err#2 ENOENT
/home/josh/bin/ksh: cd: /dev/file/xattr@/devices//@//: [No such file
or directory]
write(2, " / h o m e / j o s h / 0 0".., 86)      = 86
close(10)                                       = 0
fstat(1, 0xFFFFFD7FFFDFF828)                    = 0
fstat(2, 0xFFFFFD7FFFDFF828)                    = 0
_exit(0)

Also why does it do a openat(10, "/dev/file/xattr@/devices//@//",
O_RDONLY|O_NONBLOCK)?
That's totally wrong.

Josh

---------- Forwarded message ----------
From: Joshuah Hurst <[email protected]>
Date: Wed, Nov 6, 2013 at 1:16 PM
Subject: [bug] Problem with cd -@ if filesystem does not support
extended attributes (O_XATTR)
To: [email protected], Chester Ramey <[email protected]>


Chet, on Solaris the /devices filesystem does not support extended
attributes (O_XATTR), yet cd -@ returns 0 (success):

./bash -c 'cd -@ /devices 2>/dev/null; echo $?'
0
~/bin/ksh -c 'cd -@ /devices 2>/dev/null; echo $?'
1

truss shows that bash gets errno==EINVAL but then uses
chdir("/devices") instead of returning the error:
stat64("/devices", 0x08047520)                  = 0
open64("/devices", O_RDONLY|O_NONBLOCK)         = 3
openat64(3, ".", O_RDONLY|O_XATTR)              Err#22 EINVAL
close(3)                                        = 0
chdir("/devices")                               = 0
brk(0x0819C000)                                 = 0

Josh
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to