public inbox for glibc-bugs-regex@sourceware.org
help / color / mirror / Atom feed
* [Bug regex/6395] New: regex ^$ is not detected as anchored
@ 2008-04-11 12:45 bonzini at gnu dot org
  2008-04-11 12:46 ` [Bug regex/6395] " bonzini at gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: bonzini at gnu dot org @ 2008-04-11 12:45 UTC (permalink / raw)
  To: glibc-bugs-regex

Regex matching has an optimization where only one match is tried for a regex
anchored to the beginning of the buffer. While other anchors are resolved with
the fastmap, this one allows further optimization and is special cased. However,
because of a bug in create_cd_newstate, ^$ would be mistakenly treated as a
non-anchoring match, and re_search_internal would try matching it at every position.

In fact, the bug is (almost) fixed by this hunk:


@@ -1682,8 +1680,6 @@ create_cd_newstate (const re_dfa_t *dfa,
        newstate->halt = 1;
       else if (type == OP_BACK_REF)
        newstate->has_backref = 1;
-      else if (type == ANCHOR)
-       constraint = node->opr.ctx_type;

       if (constraint)
        {


However, some complications in building the NFA prevent this from fixing the
problem. Therefore, this patch cleans up the handling of anchors so that tests
on type == ANCHOR are not necessary anymore. When creating the NFA (calc_first),
I move the opr.ctx_type to the constraint field of re_token_t, and then I always
look at it unconditionally, without special-casing ANCHORs. This also allows
some simplification of duplicate_node_closure.

-- 
           Summary: regex ^$ is not detected as anchored
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: regex
        AssignedTo: bonzini at gnu dot org
        ReportedBy: bonzini at gnu dot org
                CC: glibc-bugs-regex at sources dot redhat dot com,glibc-
                    bugs at sources dot redhat dot com


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug regex/6395] regex ^$ is not detected as anchored
  2008-04-11 12:45 [Bug regex/6395] New: regex ^$ is not detected as anchored bonzini at gnu dot org
@ 2008-04-11 12:46 ` bonzini at gnu dot org
  2008-04-25 14:26 ` bonzini at gnu dot org
  2008-05-15  3:08 ` drepper at redhat dot com
  2 siblings, 0 replies; 5+ messages in thread
From: bonzini at gnu dot org @ 2008-04-11 12:46 UTC (permalink / raw)
  To: glibc-bugs-regex


------- Additional Comments From bonzini at gnu dot org  2008-04-11 12:45 -------
Created an attachment (id=2690)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2690&action=view)
patch against glibc CVS


-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug regex/6395] regex ^$ is not detected as anchored
  2008-04-11 12:45 [Bug regex/6395] New: regex ^$ is not detected as anchored bonzini at gnu dot org
  2008-04-11 12:46 ` [Bug regex/6395] " bonzini at gnu dot org
@ 2008-04-25 14:26 ` bonzini at gnu dot org
  2008-05-15  3:08 ` drepper at redhat dot com
  2 siblings, 0 replies; 5+ messages in thread
From: bonzini at gnu dot org @ 2008-04-25 14:26 UTC (permalink / raw)
  To: glibc-bugs-regex


------- Additional Comments From bonzini at gnu dot org  2008-04-25 14:26 -------
patch tested on gnu sed trunk testsuite (which also includes those parts of the
glibc testsuite that do not require full internationalization).

roland, i was told to reassign it to either you or ulrich

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|bonzini at gnu dot org      |roland at redhat dot com
             Status|NEW                         |ASSIGNED


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug regex/6395] regex ^$ is not detected as anchored
  2008-04-11 12:45 [Bug regex/6395] New: regex ^$ is not detected as anchored bonzini at gnu dot org
  2008-04-11 12:46 ` [Bug regex/6395] " bonzini at gnu dot org
  2008-04-25 14:26 ` bonzini at gnu dot org
@ 2008-05-15  3:08 ` drepper at redhat dot com
  2 siblings, 0 replies; 5+ messages in thread
From: drepper at redhat dot com @ 2008-05-15  3:08 UTC (permalink / raw)
  To: glibc-bugs-regex


------- Additional Comments From drepper at redhat dot com  2008-05-15 03:07 -------
Added to cvs.

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


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug regex/6395] regex ^$ is not detected as anchored
       [not found] <bug-6395-132@http.sourceware.org/bugzilla/>
@ 2011-03-16 21:26 ` roland at gnu dot org
  0 siblings, 0 replies; 5+ messages in thread
From: roland at gnu dot org @ 2011-03-16 21:26 UTC (permalink / raw)
  To: glibc-bugs-regex

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

Roland McGrath <roland at gnu dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|roland at redhat dot com    |drepper.fsp at gmail dot
                   |                            |com

-- 
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

end of thread, other threads:[~2011-03-16 21:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-11 12:45 [Bug regex/6395] New: regex ^$ is not detected as anchored bonzini at gnu dot org
2008-04-11 12:46 ` [Bug regex/6395] " bonzini at gnu dot org
2008-04-25 14:26 ` bonzini at gnu dot org
2008-05-15  3:08 ` drepper at redhat dot com
     [not found] <bug-6395-132@http.sourceware.org/bugzilla/>
2011-03-16 21:26 ` roland at gnu dot org

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).