I just filed: http://sourceware.org/bugzilla/show_bug.cgi?id=12378

which is in turn the root cause of this findutils bug:
https://savannah.gnu.org/bugs/index.php?32043

Basically, fnmatch("[","[",0) is required by POSIX 2008 to return 0, but
in glibc, it returns FNM_NOMATCH.

(It's behavior was more or less undefined in POSIX 2001, because it
represented an unterminated bracket expression which is thus an invalid
glob; but POSIX 2008 tightened the definition of globs to require that a
leading bracket that does not introduce a bracket expression must match
itself, in light of the fact that the [ utility (aka test) is an example
of a file name that looks like an unterminated bracket expression but
does not trigger globbing.)

I'm not sure how simple the fix will be, or how fast it will be patched
in glibc, but since gnulib copies the glibc definition, we'll need to
fix the gnulib implementation of fnmatch.

If it proves too hard to actually patch the glibc implementation, a
possible gnulib solution is to provide a wrapper that scans the pattern
argument for unterminated [ expressions, and replaces them with \[ (but
I hope that we can come up with a real fix in the fnmatch code itself).

-- 
Eric Blake   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to