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

Bug#703240: apt: pkgTagSection.Exists sometimes lies about a field being present, .Find does not



On 2013-03-18 12:14, Michael Vogt wrote:
> On Sun, Mar 17, 2013 at 03:26:33PM +0100, Niels Thykier wrote:
>> > Package: apt
>> > Version: 0.9.7.8
>> > Severity: normal
> Thanks for your bugreport and your testcase!
>  
> [..]

You are most welcome, :)

>> > Attached is a prototype test case for test/libapt that triggers this
>> > flaw.
> I pushed a fix (that also removes the inline as Julian suggested) to
>  lp:~mvo/apt/fix-tagfile-hash
> 
> Attached is a bzr bundle for code-review & feedback.
> 
> Cheers,
>  Michael
> 
> 
> apt-fix-tagfile-hash
> 
> 
> [...]
> 

Fix looks good at first glace (don't have time to apply and test it atm).

> === added file 'test/libapt/tagfile_test.cc'
> --- test/libapt/tagfile_test.cc	1970-01-01 00:00:00 +0000
> +++ test/libapt/tagfile_test.cc	2013-03-18 11:10:35 +0000
> @@ -0,0 +1,57 @@
> +#include <apt-pkg/fileutl.h>
> +#include <apt-pkg/tagfile.h>
> +
> +#include "assert.h"
> +#include <stdlib.h>
> +#include <string.h>
> +
> +char *tempfile = NULL;
> +int tempfile_fd = -1;
> +
> +void remove_tmpfile(void)
> +{
> +   if (tempfile_fd > 0)
> +      close(tempfile_fd);
> +   if (tempfile != NULL) {
> +      unlink(tempfile);

Come to think of it; shouldn't I have an include for unlink, like
unistd.h or so.

> +      free(tempfile);
> +   }
> +}
> +
> +int main(int argc, char *argv[])
> +{
> +   [...]
> +}
> 
> [...]

~Niels


Reply to: