On Fri, Nov 8, 2013 at 11:53 AM, Roland Mainz <[email protected]> wrote:
> $ cd -@ / # doesn't work in ast-ksh.2013-10-10 on Solaris
> 11/B145/AMD64/64bit build:
> -- snip --
> $ ./arch/sol11.i386-64/bin/ksh -c 'cd -@ / ; echo $?'
> ./arch/sol11.i386-64/bin/ksh: cd: /dev/file/xattr@///@//: [No such
> file or directory]
> 1
> -- snip --
> ... the issue here is that the path mangeling removes all slashes
> ('/') until there is no slash left to represent the root directory...
> ;-(
More data:
The issue seems to be an "off by one" issue. If $ cd -@ / # is called
then variables |t| and |r| in src/lib/libast/path/pathcanon.c line 523
are one byte from each other and both point to a byte with the value
'/':
-- snip --
519 char buf[2*PATH_MAX];
520
521 t = r - 2;
522 r = x;
523 if (t == r)
524 {
525 buf[0] = *path
== '/' ? '/' : '.';
526 buf[1] = 0;
527 }
528 else
529 {
530 memcpy(buf, r, t - r);
531 for (r = buf +
(t - r); r > buf && *(r - 1) == '/'; r--);
532 *r = 0;
533 }
-- snip --
Uhm... there are several ways to fix this (e.g. remove the |if (t ==
r)| branch and instead check for an empty buffer after the |*r = 0|)
... but what would be the preferred one ?
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) [email protected]
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers