-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[adding bug-gnulib]
According to H.Merijn Brand on 5/21/2008 2:06 AM:
[on HP-UX 10.20...]
|
| So, all these files have a leading two NULL bytes, but only when there
| is a size (any size).
|
| d3:/pro/3gl/GNU/tar-1.20/tests 124 > genfile --length 0 --file
directory/file2
| d3:/pro/3gl/GNU/tar-1.20/tests 125 > dump directory/file2
[DUMP 0.5.05 UX]
|
| 00000000
|
| In order to track the source, I added a debug print with a ftell ()
| call in fill () to test the file offset before the write:
|
| So the problem lies before that, in generate_simple_file ()
| --8<---
| fprintf (stderr, "File opened 0x%x, off: %d\n", fp, ftell (fp));
| if (fseeko (fp, seek_offset, 0))
| error (EXIT_FAILURE, errno, "%s", _("cannot seek"));
| fprintf (stderr, "File seeked, off: %d\n", ftell (fp));
|
| fill (fp, file_length, pattern);
| -->8---
|
|
| So obviously fseeko () (and.or fseek ()) are severely borked when
| called as first call after fopen (), even if seek_offset == 0.
Are you using the gnulib replacement for fseek/fseeko, or the native one?
~ If this is a bug in the gnulib replacement, it might be nice to figure
out why the seek is borking the file position.
|
| An extra guard to prevent this unwanted call:
| --8<---
| if (seek_offset && fseek (fp, (long)seek_offset, 0))
| error (EXIT_FAILURE, errno, "%s", _("cannot seek"));
| -->8---
This shouldn't be necessary with a compliant fseek (or working gnulib
fseek replacement).
- --
Don't work too hard, make some time for fun as well!
Eric Blake [EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkg0F0IACgkQ84KuGfSFAYAyHgCguh3cjXFpK1duaFtAouMkCAUx
i2wAn0whU1a+lwf/OtOhc/uPKKZ2wYC/
=PcSu
-----END PGP SIGNATURE-----