public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug manual/14029] New: glibc manual wrongly claims fnmatch cannot fail
@ 2012-04-28  1:20 bugdal at aerifal dot cx
  2013-10-13  6:22 ` [Bug manual/14029] " neleai at seznam dot cz
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: bugdal at aerifal dot cx @ 2012-04-28  1:20 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14029

             Bug #: 14029
           Summary: glibc manual wrongly claims fnmatch cannot fail
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: manual
        AssignedTo: unassigned@sourceware.org
        ReportedBy: bugdal@aerifal.cx
                CC: mtk.manpages@gmail.com, roland@gnu.org
    Classification: Unclassified


Per http://www.gnu.org/software/libc/manual/html_node/Wildcard-Matching.html

"In the GNU C Library, fnmatch cannot experience an “error”—it always returns
an answer for whether the match succeeds. However, other implementations of
fnmatch might sometimes report “errors”. They would do so by returning nonzero
values that are not equal to FNM_NOMATCH."

In fnmatch.c:

 433           wstring_malloc = wstring
 434             = (wchar_t *) malloc ((n + 1) * sizeof (wchar_t));
 435           if (wstring == NULL)
 436             {
 437               free (wpattern_malloc);
 438               return -2;
 439             }

Note that glibc's fnmatch requires memory to allocate a typically-4x-expanded
copy of both the pattern and string (since they're converted to wchar_t
strings). This means on a 32-bit system, fnmatch("*", long_string, 0) will
always fail with -2 for strings at least 600 MB in length, when of course it
should obviously succeed.

I'm filing this as a bug against the manual since I suspect there is not the
will to fix it in the code, and the manual should probably just be fixed to
state that fnmatch can and will fail. However, I actually noticed it while
designing a new bounded-space algorithm for musl's fnmatch, which glibc would
of course be welcome to adopt in the future if there is interest in fixing the
code side (but I have my doubts that the algorithm could support glibc's
FNM_EXTMATCH option).

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug manual/14029] glibc manual wrongly claims fnmatch cannot fail
  2012-04-28  1:20 [Bug manual/14029] New: glibc manual wrongly claims fnmatch cannot fail bugdal at aerifal dot cx
@ 2013-10-13  6:22 ` neleai at seznam dot cz
  2013-10-13  6:29 ` bugdal at aerifal dot cx
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: neleai at seznam dot cz @ 2013-10-13  6:22 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=14029

Ondrej Bilka <neleai at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |neleai at seznam dot cz

--- Comment #1 from Ondrej Bilka <neleai at seznam dot cz> ---
Failing sometimes is desirable, when pattern contains illegal sequence then
returning error is sanest thing to do.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug manual/14029] glibc manual wrongly claims fnmatch cannot fail
  2012-04-28  1:20 [Bug manual/14029] New: glibc manual wrongly claims fnmatch cannot fail bugdal at aerifal dot cx
  2013-10-13  6:22 ` [Bug manual/14029] " neleai at seznam dot cz
@ 2013-10-13  6:29 ` bugdal at aerifal dot cx
  2013-10-25  8:45 ` cvs-commit at gcc dot gnu.org
  2014-06-13 10:49 ` fweimer at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: bugdal at aerifal dot cx @ 2013-10-13  6:29 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=14029

--- Comment #2 from Rich Felker <bugdal at aerifal dot cx> ---
I don't think this bug report is the right place to discuss whether that's the
"sanest thing to do" (the alternative of returning no match seems equally valid
and it's a matter of opinion which is better). To resolve this bug, the manual
should just document what glibc is actually doing and the conditions under
which failure may happen, and perhaps whether this behavior is intended to
continue unchanged or improve in some way in the future.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug manual/14029] glibc manual wrongly claims fnmatch cannot fail
  2012-04-28  1:20 [Bug manual/14029] New: glibc manual wrongly claims fnmatch cannot fail bugdal at aerifal dot cx
  2013-10-13  6:22 ` [Bug manual/14029] " neleai at seznam dot cz
  2013-10-13  6:29 ` bugdal at aerifal dot cx
@ 2013-10-25  8:45 ` cvs-commit at gcc dot gnu.org
  2014-06-13 10:49 ` fweimer at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2013-10-25  8:45 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14029

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
       via  ca42d35ea1a4b69b11a3b9a3e3bd1390470d188f (commit)
      from  52e6d80122eee44b64db0e947fe7e4001e92ce83 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ca42d35ea1a4b69b11a3b9a3e3bd1390470d188f

commit ca42d35ea1a4b69b11a3b9a3e3bd1390470d188f
Author: Ondřej Bílka <neleai@seznam.cz>
Date:   Fri Oct 25 10:42:33 2013 +0200

    Acknowledge that fnmatch can fail. Fixes bug 14029.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog           |    5 +++++
 NEWS                |   16 ++++++++--------
 manual/pattern.texi |    7 ++-----
 3 files changed, 15 insertions(+), 13 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
>From glibc-bugs-return-19957-listarch-glibc-bugs=sources.redhat.com@sourceware.org Fri Oct 25 08:47:04 2013
Return-Path: <glibc-bugs-return-19957-listarch-glibc-bugs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-glibc-bugs@sources.redhat.com
Received: (qmail 3094 invoked by alias); 25 Oct 2013 08:47:03 -0000
Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <glibc-bugs.sourceware.org>
List-Subscribe: <mailto:glibc-bugs-subscribe@sourceware.org>
List-Post: <mailto:glibc-bugs@sourceware.org>
List-Help: <mailto:glibc-bugs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: glibc-bugs-owner@sourceware.org
Delivered-To: mailing list glibc-bugs@sourceware.org
Received: (qmail 3049 invoked by uid 48); 25 Oct 2013 08:47:00 -0000
From: "neleai at seznam dot cz" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug manual/14029] glibc manual wrongly claims fnmatch cannot fail
Date: Fri, 25 Oct 2013 08:47:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: glibc
X-Bugzilla-Component: manual
X-Bugzilla-Version: unspecified
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: neleai at seznam dot cz
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at sourceware dot org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status resolution
Message-ID: <bug-14029-131-psyr4P37v3@http.sourceware.org/bugzilla/>
In-Reply-To: <bug-14029-131@http.sourceware.org/bugzilla/>
References: <bug-14029-131@http.sourceware.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://sourceware.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-10/txt/msg00316.txt.bz2
Content-length: 499

https://sourceware.org/bugzilla/show_bug.cgi?id\x14029

Ondrej Bilka <neleai at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Ondrej Bilka <neleai at seznam dot cz> ---
Fixed.

--
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug manual/14029] glibc manual wrongly claims fnmatch cannot fail
  2012-04-28  1:20 [Bug manual/14029] New: glibc manual wrongly claims fnmatch cannot fail bugdal at aerifal dot cx
                   ` (2 preceding siblings ...)
  2013-10-25  8:45 ` cvs-commit at gcc dot gnu.org
@ 2014-06-13 10:49 ` fweimer at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: fweimer at redhat dot com @ 2014-06-13 10:49 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=14029

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-06-13 10:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-28  1:20 [Bug manual/14029] New: glibc manual wrongly claims fnmatch cannot fail bugdal at aerifal dot cx
2013-10-13  6:22 ` [Bug manual/14029] " neleai at seznam dot cz
2013-10-13  6:29 ` bugdal at aerifal dot cx
2013-10-25  8:45 ` cvs-commit at gcc dot gnu.org
2014-06-13 10:49 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).