bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sed segfaults


From: Stepan Kasal
Subject: Re: sed segfaults
Date: Mon, 10 Nov 2003 09:22:04 +0100
User-agent: Mutt/1.4.1i

Hello,

On Sat, Nov 08, 2003 at 12:45:47PM +0100, Paolo Bonzini wrote:
> > sed -e 's/\'.*\'/foo/' input.txt

> (besides, I think that you were just adding some
> extra backslashes...)

there is a confusion about shell escaping.  The original poster seems to
use bash, in which case the following three are equivalent:

        's/\'\''.*\'\''/foo/'
        "s/\\'.*\\'/foo/"
        "s/\'.*\'/foo/"

I used the last one in my previous mail, though it wasn't good choice
perhaps.
You say 's/\'.*\'/foo/' which wouldn't be correct under bash.

> The correct behavior is to output fooxxx. \'.*\' means the end of pattern
> space, followed by zero or more characters, followed by the end of pattern
> space -- so the end of pattern space.  (The current version BTW is 4.0.8).

I've missed that \' has a defined meaning, thank you for telling me.
So the correct output is "xxxfoo", right?

And that's what the newest regex does.

So there is a way, though somewhat complicated:
- go to http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/posix/?cvsroot=glibc
  and get regcomp.c, regex.c, regex.h, regex_internal.c, regex_internal.h and
  regexec.c
- place it to sed-4.0.8/lib and mv regex.h regex_.h
- ./configure and make
- install the result, changing the version number, so that this strange
  configuration won't generate strange bug reports in future.

Beware, the code from CVS may contain another bugs, so this is a risky
instalation.

Stepan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]