On Fri, 27 Sep 2013 06:48:33 +0200 Roland Mainz wrote:
> On Fri, Sep 27, 2013 at 6:17 AM, Glenn Fowler <[email protected]> wrote:
> > On Fri, 27 Sep 2013 04:17:31 +0200 Roland Mainz wrote:
> >> On Fri, Sep 27, 2013 at 3:50 AM, Roland Mainz <[email protected]> 
> >> wrote:
> >> > The following code from one of my test scripts no longer work in
> >> > ast-ksh.2013-09-26 on Solaris 11/AMD64/64bit:
> >> > -- snip --
> >> > $ ksh -c 'redirect {n}<. ; redirect {m}</dev/file/flags@xattr@/dev/fd/$n 
> >> > '
> >> > /home/test001/bin/ksh: /dev/file/flags@xattr@/dev/fd/11: cannot open
> >> > [Invalid argument]
> >> > -- snip --
> >> >
> >> > This fails because of the following code tries to open the parent dir
> >> > of an XATTR dir via:
> >> > -- snip --
> >> >    227  #if O_XATTR
> >> >    228                          if ((f = openat(dev.fd, ".",
> >> > O_INTERCEPT|O_RDONLY|O_XATTR)) >= 0)
> >> >    229                          {
> >> >    230                                  fd = openat(f, "..",
> >> > oflags|O_INTERCEPT, mode);
> >> >    231                                  close(f);
> >> >    232                                  return fd;
> >> >    233                          }
> >> >    234  #endif
> >> > -- snip --
> >> >
> >> > ... erm.. I don't understand this... what is this code trying to do ?
> >
> >> This patch fixes the problem:
> >> -- snip --
> >> diff -r -u original/src/lib/libast/path/pathopen.c
> >> build_i386_64bit_debug/src/lib/libast/path/pathopen.c
> >> --- src/lib/libast/path/pathopen.c     2013-08-29 07:17:52.000000000 +0200
> >> +++ src/lib/libast/path/pathopen.c       2013-09-27 04:06:38.362136396 
> >> +0200
> >> @@ -222,16 +222,12 @@
> >
> >>                         /* preserve open() semantics if possible */
> >
> >> -                       if (oflags & (O_DIRECTORY|O_SEARCH))
> >> -                               return openat(dev.fd, ".",
> >> oflags|O_INTERCEPT, mode);
> >> -#if O_XATTR
> >> -                       if ((f = openat(dev.fd, ".",
> >> O_INTERCEPT|O_RDONLY|O_XATTR)) >= 0)
> >> -                       {
> >> -                               fd = openat(f, "..", oflags|O_INTERCEPT, 
> >> mode);
> >> -                               close(f);
> >> -                               return fd;
> >> -                       }
> >> +                       if (oflags & (O_DIRECTORY|O_SEARCH
> >> +#ifdef O_XATTR
> >> +                               |O_XATTR
> >>  #endif
> >> +                               ))
> >> +                               return openat(dev.fd, ".",
> >> oflags|O_INTERCEPT, mode);
> >
> > this patch is wrong -- don't apply it
> > see my previous post

> Why is it wrong ? The |fd = openat(f, "..", oflags|O_INTERCEPT,
> mode);| in the original code could've never worked in any possible way
> because ".." in an xattr directory is doomed to fail anyway...

.. in an xattr dir points to the original object
if it doesn't then why is there any .. entry at all
it make sense that the nameless xattr space must have a way to get to the named 
objects
and it makes sense that .. is the place to hang that reference
and ls confirms it

$ ls -ail /dev/file/[email protected]//@// test79.sh
 27772 -rw-r--r--   1 gsf      gsf           148 Sep 27 02:16 test79.sh

/dev/file/[email protected]//@//:
total 4
     0 drwxrwxrwt   4 gsf      gsf             4 Sep 27 02:16 .
 27772 -rw-r--r--   1 gsf      gsf           148 Sep 27 02:16 ..
     1 -r--r--r--   1 root     root          156 Sep 27 02:16 SUNWattr_ro
     2 -rw-r--r--   1 root     root          472 Sep 27 02:16 SUNWattr_rw

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

Reply via email to