On 6 November 2013 13:16, Joshuah Hurst <joshhu...@gmail.com> wrote: > 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
Thanks The following patch should fix the bugs (build+cd -@ /devices): =============================== diff --git a/builtins/cd.def b/builtins/cd.def index 498cf88..7dd9684 100644 --- a/builtins/cd.def +++ b/builtins/cd.def @@ -194,7 +194,7 @@ cdxattr (dir, ndirp) { #if defined (O_XATTR) int apfd, fd, r, e; - char buf[11+40+40]; /* construct new `fake' path for pwd */ + char buff[11+40+40]; /* construct new `fake' path for pwd */ apfd = openat (AT_FDCWD, dir, O_RDONLY|O_NONBLOCK); if (apfd < 0) @@ -630,7 +630,7 @@ change_to_directory (newdir, nolinks, xattr) /* We're not in physical mode (nolinks == 0), but we failed to change to the canonicalized directory name (TDIR). Try what the user passed verbatim. If we succeed, reinitialize the_current_working_directory. */ - if (chdir (newdir) == 0) + if (!xattr && (chdir (newdir) == 0)) { t = resetpwd ("cd"); if (t == 0) =============================== After applying the patch I get: ./bash -c 'cd -@ /devices ; echo $?' ./bash: line 0: cd: /devices: Invalid argument 1 <--- correct ./bash -c 'cd -@ / ; ls -l' total 2 -r--r--r-- 1 root root 156 Sep 18 05:05 SUNWattr_ro -rw-r--r-- 1 root root 472 Sep 18 05:05 SUNWattr_rw Lionel