bug-bash
[Top][All Lists]
Advanced

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

[bug] Problem with cd -@ if filesystem does not support extended attribu


From: Joshuah Hurst
Subject: [bug] Problem with cd -@ if filesystem does not support extended attributes (O_XATTR)
Date: Wed, 6 Nov 2013 13:16:54 +0100

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

---------- Forwarded message ----------
From: Lionel Cons <lionelcons1972@gmail.com>
Date: Tue, Nov 5, 2013 at 11:12 PM
Subject: Re: Bash-4.3-beta2 available for FTP
To: Chester Ramey <chet.ramey@case.edu>
Cc: Simon Toedt <simon.toedt@gmail.com>, bug-bash@gnu.org, Joshuah
Hurst <joshhurst@gmail.com>, Cedric Blancher
<cedric.blancher@gmail.com>, Chester Ramey <chet@po.cwru.edu>


On 5 November 2013 22:56, Chet Ramey <chet.ramey@case.edu> wrote:
>> > I'm interested in the patch if cd -@ file works like in ksh. Or
>> > whatever, just send the patch that I can test it.
>> >
>> > Thank you.
>>
>> Again. Any patch or git pull tarball which we could try?
>
> The cd -@ option is available in the `devel' branch of the git tree on
> savannah:
>
> http://git.savannah.gnu.org/cgit/bash.git/?h=devel
>
> It first appears in the bash-20131025 snapshot.

Chet, thank you

Build instructions:
git clone --branch devel git://git.savannah.gnu.org/bash.git

Apply this patch and then build as usual:
diff --git a/builtins/cd.def b/builtins/cd.def
index 498cf88..c448c5a 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)

Lionel


-- 
Josh



reply via email to

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