Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix fnmatch strnlen namespace (bug 18470).
fnmatch brings in references to strnlen, which isn't in all the
standards that contain fnmatch (not added until the 2008 edition of
POSIX), resulting in linknamespace test failures.  (This is contrary
to glibc conventions, rather than a standards conformance issue,
because of the str* reservation.)  This patch fixes this in the usual
way, using __strnlen instead of strnlen.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	[BZ #18470]
	* posix/fnmatch.c (fnmatch) [_LIBC]: Call __strnlen instead of
	strnlen.
	* conform/Makefile (test-xfail-XPG3/fnmatch.h/linknamespace):
	Remove variable.
	(test-xfail-XPG4/fnmatch.h/linknamespace): Likewise.
	(test-xfail-POSIX/fnmatch.h/linknamespace): Likewise.
	(test-xfail-POSIX/glob.h/linknamespace): Likewise.
	(test-xfail-POSIX/wordexp.h/linknamespace): Likewise.
	(test-xfail-UNIX98/fnmatch.h/linknamespace): Likewise.
	(test-xfail-UNIX98/glob.h/linknamespace): Likewise.
	(test-xfail-UNIX98/wordexp.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K/fnmatch.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K/glob.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K/wordexp.h/linknamespace): Likewise.
  • Loading branch information
Joseph Myers committed Jun 3, 2015
1 parent aca6ea6 commit f014e87
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
16 changes: 16 additions & 0 deletions ChangeLog
@@ -1,5 +1,21 @@
2015-06-03 Joseph Myers <joseph@codesourcery.com>

[BZ #18470]
* posix/fnmatch.c (fnmatch) [_LIBC]: Call __strnlen instead of
strnlen.
* conform/Makefile (test-xfail-XPG3/fnmatch.h/linknamespace):
Remove variable.
(test-xfail-XPG4/fnmatch.h/linknamespace): Likewise.
(test-xfail-POSIX/fnmatch.h/linknamespace): Likewise.
(test-xfail-POSIX/glob.h/linknamespace): Likewise.
(test-xfail-POSIX/wordexp.h/linknamespace): Likewise.
(test-xfail-UNIX98/fnmatch.h/linknamespace): Likewise.
(test-xfail-UNIX98/glob.h/linknamespace): Likewise.
(test-xfail-UNIX98/wordexp.h/linknamespace): Likewise.
(test-xfail-XOPEN2K/fnmatch.h/linknamespace): Likewise.
(test-xfail-XOPEN2K/glob.h/linknamespace): Likewise.
(test-xfail-XOPEN2K/wordexp.h/linknamespace): Likewise.

[BZ #18468]
* wcsmbs/wmemchr.c (wmemchr): Rename to __wmemchr and define as
weak alias of __wmemchr. Use libc_hidden_weak.
Expand Down
2 changes: 1 addition & 1 deletion NEWS
Expand Up @@ -19,7 +19,7 @@ Version 2.22
18047, 18049, 18068, 18080, 18093, 18100, 18104, 18110, 18111, 18116,
18125, 18128, 18138, 18185, 18196, 18197, 18206, 18210, 18211, 18217,
18220, 18221, 18234, 18244, 18247, 18287, 18319, 18333, 18346, 18397,
18409, 18410, 18412, 18418, 18422, 18434, 18444, 18468, 18469.
18409, 18410, 18412, 18418, 18422, 18434, 18444, 18468, 18469, 18470.

* Cache information can be queried via sysconf() function on s390 e.g. with
_SC_LEVEL1_ICACHE_SIZE as argument.
Expand Down
11 changes: 0 additions & 11 deletions conform/Makefile
Expand Up @@ -345,14 +345,12 @@ test-xfail-XOPEN2K/ndbm.h/linknamespace = yes
test-xfail-XOPEN2K8/ndbm.h/linknamespace = yes

# Unsorted expected failures.
test-xfail-XPG3/fnmatch.h/linknamespace = yes
test-xfail-XPG3/glob.h/linknamespace = yes
test-xfail-XPG3/regex.h/linknamespace = yes
test-xfail-XPG3/stdio.h/linknamespace = yes
test-xfail-XPG3/unistd.h/linknamespace = yes
test-xfail-XPG3/wordexp.h/linknamespace = yes
test-xfail-XPG4/fmtmsg.h/linknamespace = yes
test-xfail-XPG4/fnmatch.h/linknamespace = yes
test-xfail-XPG4/glob.h/linknamespace = yes
test-xfail-XPG4/netdb.h/linknamespace = yes
test-xfail-XPG4/regex.h/linknamespace = yes
Expand All @@ -362,35 +360,26 @@ test-xfail-XPG4/syslog.h/linknamespace = yes
test-xfail-XPG4/unistd.h/linknamespace = yes
test-xfail-XPG4/wordexp.h/linknamespace = yes
test-xfail-POSIX/aio.h/linknamespace = yes
test-xfail-POSIX/fnmatch.h/linknamespace = yes
test-xfail-POSIX/glob.h/linknamespace = yes
test-xfail-POSIX/mqueue.h/linknamespace = yes
test-xfail-POSIX/regex.h/linknamespace = yes
test-xfail-POSIX/semaphore.h/linknamespace = yes
test-xfail-POSIX/unistd.h/linknamespace = yes
test-xfail-POSIX/wordexp.h/linknamespace = yes
test-xfail-UNIX98/fmtmsg.h/linknamespace = yes
test-xfail-UNIX98/fnmatch.h/linknamespace = yes
test-xfail-UNIX98/glob.h/linknamespace = yes
test-xfail-UNIX98/mqueue.h/linknamespace = yes
test-xfail-UNIX98/netdb.h/linknamespace = yes
test-xfail-UNIX98/stdio.h/linknamespace = yes
test-xfail-UNIX98/stdlib.h/linknamespace = yes
test-xfail-UNIX98/syslog.h/linknamespace = yes
test-xfail-UNIX98/unistd.h/linknamespace = yes
test-xfail-UNIX98/wchar.h/linknamespace = yes
test-xfail-UNIX98/wordexp.h/linknamespace = yes
test-xfail-XOPEN2K/fmtmsg.h/linknamespace = yes
test-xfail-XOPEN2K/fnmatch.h/linknamespace = yes
test-xfail-XOPEN2K/glob.h/linknamespace = yes
test-xfail-XOPEN2K/netdb.h/linknamespace = yes
test-xfail-XOPEN2K/signal.h/linknamespace = yes
test-xfail-XOPEN2K/stdlib.h/linknamespace = yes
test-xfail-XOPEN2K/sys/wait.h/linknamespace = yes
test-xfail-XOPEN2K/syslog.h/linknamespace = yes
test-xfail-XOPEN2K/ucontext.h/linknamespace = yes
test-xfail-XOPEN2K/unistd.h/linknamespace = yes
test-xfail-XOPEN2K/wordexp.h/linknamespace = yes
test-xfail-POSIX2008/grp.h/linknamespace = yes
test-xfail-POSIX2008/netdb.h/linknamespace = yes
test-xfail-POSIX2008/semaphore.h/linknamespace = yes
Expand Down
4 changes: 2 additions & 2 deletions posix/fnmatch.c
Expand Up @@ -348,7 +348,7 @@ fnmatch (pattern, string, flags)
memset (&ps, '\0', sizeof (ps));
p = pattern;
#ifdef _LIBC
n = strnlen (pattern, 1024);
n = __strnlen (pattern, 1024);
#else
n = strlen (pattern);
#endif
Expand Down Expand Up @@ -392,7 +392,7 @@ fnmatch (pattern, string, flags)

assert (mbsinit (&ps));
#ifdef _LIBC
n = strnlen (string, 1024);
n = __strnlen (string, 1024);
#else
n = strlen (string);
#endif
Expand Down

0 comments on commit f014e87

Please sign in to comment.