[Pkg-haskell-maintainers] Bug#702617: regex /./ fails to match certiain characters

Joachim Breitner nomeata at debian.org
Mon Mar 11 17:13:07 UTC 2013


Control: reassign -1 libc6
Control: found libc6/2.13-38
Control: affects haskell-regex-compat

Hi,

Am Montag, den 11.03.2013, 11:53 -0400 schrieb Joey Hess:
> Joachim Breitner wrote:
> > I can reproduce it from within ghc’s address space using gdb:
> > 
> > (gdb) call malloc(32)
> > $7 = 64943120
> > (gdb) call regcomp(64943120, ".", 0)
> > $8 = 0
> > (gdb) call regexec(64943120,"\242",0,0,0)
> > $9 = 1
> > (gdb) call regexec(64943120,"only_ascii",0,0,0)
> > $10 = 0
> > 
> > And even from gdb while debugging “sleep”. So the behaviour is already
> > there in regexec, but for some reason it is not triggered from C code,
> > but only via some variants of FFI (GHC’s or gdb’s).
> > 
> > I’ll leave it at that, as this is not really related to GHC or Haskell
> > any more.
> 
> That's some deep dive!
> 
> Sounds like a reassign to glibc is in order?

if you think so...

@glibc maintainers, here is the short story:

This code prints, as expected 0 (for regex matches):

#include <sys/types.h>
#include <regex.h>
#include <stdio.h>

main () {
	regex_t r;
	regcomp(&r, ".", 0);
	char *s = "\242";
	int i = regexec(&r, s, 0, NULL, 0);
	printf("%d\n", i);
}

But in some circumstances, this does not work as expected. One such
circumstance is Haskell code doing this via the FFI, but also from gdb:

(gdb) call malloc(32)
$1 = 6332464
(gdb) call memset(6332464, 0, 32)
$3 = 6332464
(gdb) call regcomp(6332464, ".", 0)
$4 = 0
(gdb) call regexec(6332464, "\242",0,0,0)
$5 = 1

It fails if there are no ascii characters around:

(gdb) call regexec(6332464, "\242x",0,0,0)
$6 = 0
(gdb) call regexec(6332464, "\242\242",0,0,0)
$7 = 1
(gdb) call regexec(6332464, "only_ascii",0,0,0)
$8 = 0

Greetings,
Joachim


-- 
Joachim "nomeata" Breitner
Debian Developer
  nomeata at debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C
  JID: nomeata at joachim-breitner.de | http://people.debian.org/~nomeata

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.alioth.debian.org/pipermail/pkg-haskell-maintainers/attachments/20130311/81dcccd3/attachment.pgp>


More information about the Pkg-haskell-maintainers mailing list