Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 181275 - sys-libs/uclibc-0.9.28.3 performs fnmatch(..., ..., FNM_PATHNAME) incorrectly when slash only in string and not pattern
Summary: sys-libs/uclibc-0.9.28.3 performs fnmatch(..., ..., FNM_PATHNAME) incorrectly...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Embedded Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-08 06:37 UTC by Aurélien Francillon
Modified: 2020-10-10 18:26 UTC (History)
4 users (show)

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


Attachments
build.log (build.log,30.10 KB, text/plain)
2007-06-08 06:39 UTC, Aurélien Francillon
Details
emerge.info (emerge.info,2.79 KB, text/plain)
2007-06-08 06:42 UTC, Aurélien Francillon
Details
git-1.5.2.5_error_log.txt (git-1.5.2.5_error_log.txt,1.71 KB, text/plain)
2007-09-28 13:26 UTC, Aurélien Francillon
Details
uclibc-fnmatch.c (uclibc-fnmatch.c,907 bytes, text/plain)
2007-10-19 08:52 UTC, Fernando J. Pereda (RETIRED)
Details
git_1.5.3.7-r1_error_log.txt (git_1.5.3.7-r1_error_log.txt,1.72 KB, text/plain)
2007-12-31 01:06 UTC, Aurélien Francillon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aurélien Francillon 2007-06-08 06:37:52 UTC
on a uclibc/hardened host, building git with FEATURES="test" fails : 

*** t3001-ls-files-others-exclude.sh ***
* FAIL 1: git-ls-files --others with various exclude options.
	git-ls-files --others \
	       --exclude=\*.6 \
	       --exclude-per-directory=.gitignore \
	       --exclude-from=.git/ignore \
	       >output &&
	     git diff expect output
* FAIL 2: git-ls-files --others with \r\n line endings.
	git-ls-files --others \
	       --exclude=\*.6 \
	       --exclude-per-directory=.gitignore \
	       --exclude-from=.git/ignore \
	       >output &&
	     git diff expect output
*   ok 3: git-status honours core.excludesfile
* failed 2 among 3 test(s)


Reproducible: Always
Comment 1 Aurélien Francillon 2007-06-08 06:39:53 UTC
Created attachment 121470 [details]
build.log

complete build log
Comment 2 Aurélien Francillon 2007-06-08 06:42:24 UTC
Created attachment 121471 [details]
emerge.info

emerge --info
Comment 3 Fernando J. Pereda (RETIRED) gentoo-dev 2007-06-16 18:11:13 UTC
Hi,

If you unpack the tarball yourself, edit t/Makefile and UNcomment the line that reads:

#GIT_TEST_OPTS=--verbose --debug

Then run 'make -C t t3001-ls-files-others-exclude.sh' and paste that result here.

Thanks.

- ferdy
Comment 4 Fernando J. Pereda (RETIRED) gentoo-dev 2007-09-28 12:35:27 UTC
Please test a newer version and provide the info needed to track this issue down. Reopen with the result. Thanks.

- ferdy
Comment 5 Aurélien Francillon 2007-09-28 13:26:37 UTC
Created attachment 132079 [details]
git-1.5.2.5_error_log.txt

test suite error log with git-1.5.2.5
Comment 6 Aurélien Francillon 2007-09-28 13:27:40 UTC
sorry for the slackiness, 
I hope you can see the problem with the verbose logging ... 
Cheers
Aurélien 
Comment 7 Fernando J. Pereda (RETIRED) gentoo-dev 2007-10-19 08:50:36 UTC
Looks like a bug in uclibc's fnmatch. Care to run the attached test? Thanks.

- ferdy
Comment 8 Fernando J. Pereda (RETIRED) gentoo-dev 2007-10-19 08:52:16 UTC
Created attachment 133872 [details]
uclibc-fnmatch.c

Desired output:

--- 8< ---
$ ./uclibc-fnmatch && echo $?
fnmatch(*.foo, a.foo, 1) = 0 -> Ok
fnmatch(*.foo, a.foo, 0) = 0 -> Ok
fnmatch(*.foo, bar/a.foo, 1) = FNM_NOMATCH -> Ok
fnmatch(*.foo, bar/a.foo, 0) = 0 -> Ok
0
--- 8< ---
Comment 9 Aurélien Francillon 2007-10-19 09:28:41 UTC
(In reply to comment #7)
> Looks like a bug in uclibc's fnmatch. Care to run the attached test? Thanks.

well it fails ... 

./a.out
fnmatch(*.foo, a.foo, 1) = 0 -> Ok
fnmatch(*.foo, a.foo, 0) = 0 -> Ok
fnmatch(*.foo, bar/a.foo, 1) = 0 -> FAIL
fnmatch(*.foo, bar/a.foo, 0) = 0 -> Ok

and the fnmatch is the one of sys-libs/uclibc-0.9.28.3

ldd a.out
        libc.so.0 => /lib/libc.so.0 (0x4ccd7000)
        ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x4cd31000)
ll /lib/libc.so.0
        /lib/libc.so.0 -> libuClibc-0.9.28.so
nm a.out | grep fnmatch
         U fnmatch

and sys-libs/uclibc-0.9.28.3 was built with :
-build -debug hardened -iconv ipv6 -minimal -nls -pregen -savedconfig uclibc-compat -userlocales wordexp

thanks,
Aurélien 
Comment 10 Fernando J. Pereda (RETIRED) gentoo-dev 2007-10-19 09:43:06 UTC
Unless my understanding of POSIX's entry for fnmatch is wrong, this is a bug in uclibc: 

"If the FNM_PATHNAME flag is set in flags, then a slash character ( '/' ) in string shall be explicitly matched by a slash in pattern; it shall not be matched by either the asterisk or question-mark special characters, nor by a bracket expression"

So '*.foo' shouldn't have matched 'bar/a.foo'. Reassigning to embedded since they maintain uclibc.

- ferdy
Comment 11 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2007-12-25 09:08:14 UTC
submitter: can you please retest with 1.5.3.7-r1?
But I do agree with ferdy's assessment that it's a bug in uclibc.
Comment 12 Aurélien Francillon 2007-12-31 01:06:14 UTC
Created attachment 139677 [details]
git_1.5.3.7-r1_error_log.txt

hi , 
this is the error message with git 1.5.3.7-r1:

*** t3001-ls-files-others-exclude.sh ***
* FAIL 1: git ls-files --others with various exclude options.
        git ls-files --others \
               --exclude=\*.6 \
               --exclude-per-directory=.gitignore \
               --exclude-from=.git/ignore \
               >output &&
             git diff expect output
* FAIL 2: git ls-files --others with \r\n line endings.
        git ls-files --others \
               --exclude=\*.6 \
               --exclude-per-directory=.gitignore \
               --exclude-from=.git/ignore \
               >output &&
             git diff expect output
*   ok 3: git-status honours core.excludesfile
* failed 2 among 3 test(s)

verbose log attached

Cheers
Aurélien
Comment 13 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2007-12-31 02:21:56 UTC
thx. So yeah, uclibc bug I'd say.
I'm changing the summary to reflect the actual problem rather than just say git.
Comment 14 Jonas Stein gentoo-dev 2020-10-10 18:26:55 UTC
package was treecleaned long ago