GNU bug report logs - #17066
a DFA state which is built previously may be re-built in non-UTF8 locales

Previous Next

Package: grep;

Reported by: Norihiro Tanaka <noritnk <at> kcn.ne.jp>

Date: Sat, 22 Mar 2014 07:00:02 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17066 in the body.
You can then email your comments to 17066 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#17066; Package grep. (Sat, 22 Mar 2014 07:00:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Norihiro Tanaka <noritnk <at> kcn.ne.jp>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Sat, 22 Mar 2014 07:00:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
To: submit <at> debbugs.gnu.org
Subject: a DFA state which is built previously may be re-built in non-UTF8
 locales
Date: Sat, 22 Mar 2014 15:59:11 +0900
[Message part 1 (text/plain, inline)]
Package: grep

When don't pass backref parameter to dfaexec(), a DFA state which is built
previously may be re-built.

In non-UTF8 locales, when reach a state which mbps aren't empty, exit
main loop and call build_state() in dfa.c, even if the state has been
already built.

That will cause increase of processing time, and waste of a lot of
memories.

Fortunately, grep program doesn't pass the code in dfa.c unless
mblen_buf overflows, since backref parameter is specified when dfaexec()
is called with large buffer.

Norihiro
[patch.txt (text/plain, attachment)]

Added tag(s) patch. Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Sat, 22 Mar 2014 22:53:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-grep <at> gnu.org:
bug#17066; Package grep. (Tue, 01 Apr 2014 08:48:02 GMT) Full text and rfc822 format available.

Message #10 received at 17066 <at> debbugs.gnu.org (full text, mbox):

From: Paolo Bonzini <bonzini <at> gnu.org>
To: Norihiro Tanaka <noritnk <at> kcn.ne.jp>, 17066 <at> debbugs.gnu.org
Subject: Re: bug#17066: a DFA state which is built previously may be re-built
 in non-UTF8 locales
Date: Tue, 01 Apr 2014 10:47:27 +0200
Il 22/03/2014 07:59, Norihiro Tanaka ha scritto:
>
> From fba7984fa2a5baff18e1b48611c3d7fb3701255b Mon Sep 17 00:00:00 2001
> From: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
> Date: Sat, 22 Mar 2014 15:11:52 +0900
> Subject: [PATCH] grep: avoid to re-build a state built previously.
>
> * src/dfa.c (dfaexec): avoid to re-build a state built previously.
> ---
>  src/dfa.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/dfa.c b/src/dfa.c
> index 5e60cd5..8261849 100644
> --- a/src/dfa.c
> +++ b/src/dfa.c
> @@ -3501,7 +3501,8 @@ dfaexec (struct dfa *d, char const *begin, char *end,
>
>        if (s >= 0)
>          {
> -          build_state (s, d);
> +          if (!d->trans[s])
> +            build_state (s, d);
>            trans = d->trans;
>            continue;
>          }
> -- 1.9.1

Thanks, I'll apply this patch.

Paolo




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Wed, 02 Apr 2014 05:26:03 GMT) Full text and rfc822 format available.

Notification sent to Norihiro Tanaka <noritnk <at> kcn.ne.jp>:
bug acknowledged by developer. (Wed, 02 Apr 2014 05:26:04 GMT) Full text and rfc822 format available.

Message #15 received at 17066-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Paolo Bonzini <bonzini <at> gnu.org>, Norihiro Tanaka <noritnk <at> kcn.ne.jp>, 
 17066-done <at> debbugs.gnu.org
Subject: Re: bug#17066: a DFA state which is built previously may be re-built
 in non-UTF8 locales
Date: Tue, 01 Apr 2014 22:25:40 -0700
Paolo Bonzini wrote:
> Thanks, I'll apply this patch.

Thanks, closing this bug report as done.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 30 Apr 2014 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 47 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.