we got a decision on pathnames with exactly two leading slashes
thanks, Eric and David!
This commit is contained in:
parent
6fddfc009b
commit
b91b037e6a
9
check.t
9
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: 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: 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 $
|
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
||||||
|
@ -8664,8 +8664,7 @@ stdin:
|
||||||
pwd
|
pwd
|
||||||
cd ../lib
|
cd ../lib
|
||||||
pwd
|
pwd
|
||||||
cd -P ../libexec
|
realpath //usr/include/../bin
|
||||||
pwd
|
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
/bin
|
/bin
|
||||||
//bin
|
//bin
|
||||||
|
@ -8677,8 +8676,8 @@ expected-stdout:
|
||||||
//bin
|
//bin
|
||||||
/bin
|
/bin
|
||||||
//usr/bin
|
//usr/bin
|
||||||
//usr/bin/../lib
|
//usr/lib
|
||||||
//usr/libexec
|
//usr/bin
|
||||||
---
|
---
|
||||||
name: crash-1
|
name: crash-1
|
||||||
description:
|
description:
|
||||||
|
|
12
misc.c
12
misc.c
|
@ -29,7 +29,7 @@
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#endif
|
#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 */
|
/* type bits for unsigned char */
|
||||||
unsigned char chtypes[UCHAR_MAX + 1];
|
unsigned char chtypes[UCHAR_MAX + 1];
|
||||||
|
@ -1368,9 +1368,9 @@ do_realpath(const char *upath)
|
||||||
/* assert: (ip == ipath)[0] == '/' */
|
/* assert: (ip == ipath)[0] == '/' */
|
||||||
/* assert: xp == xs.beg => start of path */
|
/* assert: xp == xs.beg => start of path */
|
||||||
|
|
||||||
/* exactly two leading slashes? */
|
/* exactly two leading slashes? (SUSv4 3.266) */
|
||||||
if (ip[1] == '/' && ip[2] != '/') {
|
if (ip[1] == '/' && ip[2] != '/') {
|
||||||
/* SUSv4 3.266 Pathname */
|
/* keep them, e.g. for UNC pathnames */
|
||||||
Xput(xs, xp, '/');
|
Xput(xs, xp, '/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1516,7 +1516,7 @@ make_path(const char *cwd, const char *file,
|
||||||
*
|
*
|
||||||
* simplify_path(this) = that
|
* simplify_path(this) = that
|
||||||
* /a/b/c/./../d/.. /a/b
|
* /a/b/c/./../d/.. /a/b
|
||||||
* //./C/foo/bar/../baz //./C/foo/bar/../baz
|
* //./C/foo/bar/../baz //C/foo/baz
|
||||||
* /foo/ /foo
|
* /foo/ /foo
|
||||||
* /foo/../../bar /bar
|
* /foo/../../bar /bar
|
||||||
* /foo/./blah/.. /foo
|
* /foo/./blah/.. /foo
|
||||||
|
@ -1538,8 +1538,8 @@ simplify_path(char *p)
|
||||||
case '/':
|
case '/':
|
||||||
/* exactly two leading slashes? (SUSv4 3.266) */
|
/* exactly two leading slashes? (SUSv4 3.266) */
|
||||||
if (p[1] == '/' && p[2] != '/')
|
if (p[1] == '/' && p[2] != '/')
|
||||||
/* implementation defined, we CANNOT simplify this */
|
/* keep them, e.g. for UNC pathnames */
|
||||||
return;
|
++p;
|
||||||
needslash = true;
|
needslash = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue