libtool-patches
[Top][All Lists]
Advanced

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

Re: workaround for virtualpc bug


From: Christoph Egger
Subject: Re: workaround for virtualpc bug
Date: Sat, 29 Oct 2005 09:17:28 +0200 (MEST)

> Hi Christoph,
> 
> * Christoph Egger wrote on Sat, Oct 29, 2005 at 01:20:00AM CEST:
> > > 
> > > Could you please find out for me:
> > > - whether empty files in general get messed up in your setup
> > > - whether newline encoding is the issue
> > > - whether the
> > >    sed -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' 
> > >   outputs something weird.
> > 
> > I created a small script, which tests all these cases.
> > If it is really a sed bug, then it should reproduce the issue.
> 
> So, does it reproduce the issue now?  :)
> Can you see which part is at fault?

Aaargh! What happened with my mail? The one I sent was MUCH longer!


No, it did NOT reproduce any error of them. All tests were
successful. Independent if Virtual PC runs in foreground or background.

I downloaded the source of GNU sed 4.1.4 and looked into it.
sed uses fopen(), fread() and fclose() to handle the -f option.
It uses a subroutine called 'compile_program()', which sed also uses
to parse the commands passed with -e. And we know -e works, so the bug
can't be there.

The question is why does cp not fail? I mean, why does my libtool patch
work?
So I downloaded the source of GNU fileutils and looked into cp's code.
It uses open(), read(), write() and close().

The difference: fopen(), fread(), fwrite() and fclose() use a FILE *.
This uses libc's internal cache buffer.
open(), read(), write() and close() use filedescriptors and bypass
libc's caching.

I also checked libtool and libtool uses sed with the -f option only
one time in the whole source. So this should actually be the only
one impacting place.

It doesn't look like to be a bug in sed. And I pretty doubt that
libc's caching is that buggy to garbarge it's memory. Such a bug should
be found and fixed pretty fast, since really MANY programs use fopen(),
fread(), etc.

So when it is a bug in Virtual PC, why does my above script not fail?
Actually I don't know. And because VirtualPC is closed-source I can only
make a guess:

The above script is not complex enough (as libtool is) and/or does
not "the right thing" to expose the bug in VirtualPC which garbages
libc's cache used when sed is called with -f _later_.

For more detailed analyzes send me the source of VirtualPC... :-)


-- 
Greetings,

Christoph

Telefonieren Sie schon oder sparen Sie noch?
NEU: GMX Phone_Flat http://www.gmx.net/de/go/telefonie




reply via email to

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