bugGNU Wget - Bugs: bug #22830, Built-in fnmatch is broken


bug #22830: Built-in fnmatch is broken

Submitter:  Micah Cowan <micahcowan>
Submitted:  Fri 04 Apr 2008 01:34:55 PM UTC
Category:  Program Logic Severity:  3 - Normal
Priority:  4 Status:  Confirmed
Privacy:  Public Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  None Operating System:  None
Reproducibility:  None Fixed Release:  None
Planned Release:  1.13 Regression:  None
Work Required:  1 - Days Patch Included:  None
* Mandatory Fields

Add a New Comment Rich Markup

Fri 04 Apr 2008 01:34:55 PM UTC, original submission:  

Should write a complete set of tests against our built-in fnmatch.

See related bugs 21693, and 22260.

From Alain Guibert, http://article.gmane.org/gmane.comp.web.wget.general/7860:

> Well, it would point to a problem with both the fnmatch replacement
> and the older system fnmatch.  "Our" fnmatch (coming from an old
> release of Bash

The fnmatch()es in libc 5.4.33 and in Wget are twins. They differ on
some minor details like FNM_CASEFOLD support, and cosmetic things like
parenthesis around return(code). The part dealing with * in pattern is
functionaly identical.

> Maybe you could put a breakpoint in fnmatch and see what goes wrong?

The for loop intended to eat several characters from the string also
advances the pattern pointer. This one reaches the end of the pattern,
and points to a NUL. It is not a '*' anymore, so the loop exits
prematurely. Just below, a test for NUL returns 0.

The body of the loop, returning FNM_NOMATCH on a slash, is not executed
at all. That isn't moderately broken, is it?


Micah Cowan <micahcowan>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by micahcowan (Submitted the item)

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-10-02 micahcowan Planned Release1.14 1.13
    2009-06-11 micahcowan Planned Release1.12 1.14
    2008-11-04 micahcowan Priority5 - Normal 4

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code