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

Re: Bug#736202: undeterministic output when running egrep repeatedly with the same input

This is about 100x times harder to reproduce running under ktrace but I
got lucky.  The problematic syscall is right here:

>  egrep    RET   read 32768/0x8000
>  egrep    CALL  lseek(0,0,SEEK_CUR)
>  egrep    RET   lseek 32768/0x8000
>  egrep    CALL  lseek(0,0x8000,SEEK_HOLE)
> -egrep    RET   lseek -1 errno 6 No such device or address
> -egrep    CALL  fstat(0x1,0x7fffffffd070)
> +egrep    RET   lseek 32768/0x8000
> +egrep    CALL  lseek(0,0x8000,SEEK_SET)
> +egrep    RET   lseek 32768/0x8000
> +egrep    CALL  fstat(0x1,0x7fffffffca40)

Only if the lseek *fails*, it continues normally, reading from stdin
here and outputting matches to stdout.  If the lseek succeds, it aborts
with "Binary file (standard input) matches".

> -egrep    CALL  read(0,0x636000,0x8000)
> -egrep    GIO   fd 0 read 1164 bytes
> -egrep    RET   read 1164/0x48c
> -egrep    CALL  read(0,0x63648c,0x7000)
> -egrep    GIO   fd 0 read 0 bytes
> -""
> -egrep    RET   read 0
> -egrep    CALL  write(0x1,0x8007ff000,0x952)
> -egrep    GIO   fd 1 wrote 2386 bytes
> +egrep    CALL  write(0x1,0x8007ff000,0x25)
> +egrep    GIO   fd 1 wrote 37 bytes
> +"Binary file (standard input) matches
>  "
> -egrep    RET   write 2386/0x952
> +egrep    RET   write 37/0x25

It exits with zero status either way (indicating there were matches).

Steven Chamberlain

Reply to: