diff --git a/check.t b/check.t index 8b6761f..42c1723 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.440 2011/03/28 21:18:00 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.441 2011/03/28 21:30:59 tg Exp $ # $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $ @@ -8664,8 +8664,7 @@ stdin: pwd cd ../lib pwd - cd -P ../libexec - pwd + realpath //usr/include/../bin expected-stdout: /bin //bin @@ -8677,8 +8676,8 @@ expected-stdout: //bin /bin //usr/bin - //usr/bin/../lib - //usr/libexec + //usr/lib + //usr/bin --- name: crash-1 description: diff --git a/misc.c b/misc.c index b2b3039..a26beab 100644 --- a/misc.c +++ b/misc.c @@ -29,7 +29,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.163 2011/03/26 21:46:03 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.164 2011/03/28 21:31:01 tg Exp $"); /* type bits for unsigned char */ unsigned char chtypes[UCHAR_MAX + 1]; @@ -1368,9 +1368,9 @@ do_realpath(const char *upath) /* assert: (ip == ipath)[0] == '/' */ /* assert: xp == xs.beg => start of path */ - /* exactly two leading slashes? */ + /* exactly two leading slashes? (SUSv4 3.266) */ if (ip[1] == '/' && ip[2] != '/') { - /* SUSv4 3.266 Pathname */ + /* keep them, e.g. for UNC pathnames */ Xput(xs, xp, '/'); } } @@ -1516,7 +1516,7 @@ make_path(const char *cwd, const char *file, * * simplify_path(this) = that * /a/b/c/./../d/.. /a/b - * //./C/foo/bar/../baz //./C/foo/bar/../baz + * //./C/foo/bar/../baz //C/foo/baz * /foo/ /foo * /foo/../../bar /bar * /foo/./blah/.. /foo @@ -1538,8 +1538,8 @@ simplify_path(char *p) case '/': /* exactly two leading slashes? (SUSv4 3.266) */ if (p[1] == '/' && p[2] != '/') - /* implementation defined, we CANNOT simplify this */ - return; + /* keep them, e.g. for UNC pathnames */ + ++p; needslash = true; break; default: