Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 527954 - sys-libs/uclibc-0.9.33.2-r14 and -0.9.33.9999: broken implementation of fnmatch()
Summary: sys-libs/uclibc-0.9.33.2-r14 and -0.9.33.9999: broken implementation of fnmat...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Embedded Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: uclibc-porting
  Show dependency tree
 
Reported: 2014-11-02 00:18 UTC by René Rhéaume
Modified: 2017-10-14 17:50 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info output (emerge-info.txt,5.15 KB, text/plain)
2014-11-02 00:18 UTC, René Rhéaume
Details
build.log (build.log,47.18 KB, text/plain)
2014-11-02 00:20 UTC, René Rhéaume
Details
tests/test-suite.log from work directory (test-suite.log,1.89 KB, text/plain)
2014-11-02 00:24 UTC, René Rhéaume
Details
tests/unit-tests.log from work directory (unit-tests.log,174 bytes, text/plain)
2014-11-02 00:27 UTC, René Rhéaume
Details

Note You need to log in before you can comment on or make changes to this bug.
Description René Rhéaume 2014-11-02 00:18:27 UTC
The first test (named unit-tests) in wget test suite fails.

Reproducible: Always

Steps to Reproduce:
1. FEATURES="test" emerge -1 wget

Actual Results:  
 * ERROR: net-misc/wget-1.16::gentoo failed (test phase):
 *   Make check failed. See above for details.


Expected Results:  
wget updated on system
Comment 1 René Rhéaume 2014-11-02 00:18:53 UTC
Created attachment 388290 [details]
emerge --info output
Comment 2 René Rhéaume 2014-11-02 00:20:40 UTC
Created attachment 388292 [details]
build.log
Comment 3 René Rhéaume 2014-11-02 00:21:41 UTC
% emerge -pqv '=net-misc/wget-1.16::gentoo'
[ebuild     U ] net-misc/wget-1.16 [1.14] USE="-debug -gnutls -idn ipv6 (-nls) -ntlm pcre ssl -static -uuid zlib"
Comment 4 René Rhéaume 2014-11-02 00:24:41 UTC
Created attachment 388294 [details]
tests/test-suite.log from work directory
Comment 5 René Rhéaume 2014-11-02 00:27:37 UTC
Created attachment 388296 [details]
tests/unit-tests.log from work directory
Comment 6 René Rhéaume 2014-11-02 00:28:55 UTC
Comment on attachment 388296 [details]
tests/unit-tests.log from work directory

Text already included in test-suite.log
Comment 7 Anthony Basile gentoo-dev 2015-04-21 16:28:48 UTC
The failure is in src/utils.c, in test_dir_matches_p(void), line 2528:

  { { "*COMPLETE", NULL, NULL }, "foo/!COMPLETE", false }

and 2539:

  bool res = dir_matches_p (test_array[i].dirlist, test_array[i].dir);

which checks test_array[i].dirlist = { "*COMPLETE", NULL, NULL } for an instance of test_array[i].dir = "foo/!COMPLETE" and expects a false return but gets true.  This is because of the line 975 which reads:

  if (matcher (p, dir, FNM_PATHNAME) == 0)

where matcher is set to either fnmatch or fnmatch_nocase.  Reducing the code down we have the following test code:

#include <stdio.h>
#include <fnmatch.h>

int main() {
	int res = fnmatch("*COMPLETE", "foo/!COMPLETE", FNM_PATHNAME);
	printf("res = %d\n", res);
}

On glibc this returns "res = 1" whereas on uclibc this returns "res = 0".  This was tested on uclibc-0.9.33.9999. which is the head of the 0.3.33 branch.
Comment 8 René Rhéaume 2015-04-21 23:21:16 UTC
(In reply to Anthony Basile from comment #7)
> [...] Reducing the code
> down we have the following test code:
> 
> #include <stdio.h>
> #include <fnmatch.h>
> 
> int main() {
> 	int res = fnmatch("*COMPLETE", "foo/!COMPLETE", FNM_PATHNAME);
> 	printf("res = %d\n", res);
> }
> 
> On glibc this returns "res = 1" whereas on uclibc this returns "res = 0". 
> This was tested on uclibc-0.9.33.9999. which is the head of the 0.3.33
> branch.

According to http://pubs.opengroup.org/stage7tc1/functions/fnmatch.html , glibc is correct because it returns a non-match when options contains FNM_PATHNAME and slash is not in both strings. So this is a bug in uclibc­.
Comment 9 René Rhéaume 2015-06-13 09:26:55 UTC
After doing a quick search with "uclibc" as the search term, this bug looks like a duplicate of bug #181275 , an old bug indeed.