bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] [GNU tar 1.20] testsuite: 2 7 8 13 14 16 17 22 28 29 44 45


From: H.Merijn Brand
Subject: Re: [Bug-tar] [GNU tar 1.20] testsuite: 2 7 8 13 14 16 17 22 28 29 44 45 46 48 51 52 61 63 64 65 67 68 69 70 71 72 73 74 failed
Date: Wed, 21 May 2008 10:06:02 +0200

On Tue, 20 May 2008 23:25:53 +0300, "Sergey Poznyakoff"
<address@hidden> wrote:

> H.Merijn Brand <address@hidden> ha escrit:
> 
> > It looks like 'genfile' either spews more or less info than what
> > testsuite expects,
> 
> It is unable to create files on these system. The following output:
> 
> +10242 10240
> 
> means that genfile attempted to create a file 10240 bytes long, but the
> resulting file had 10242 bytes. The same for the rest of tests. What's
> interesting, in all tests the actual file length is 2 bytes more than
> requested. Any idea why?

Now I do. Analysis follows, patch below ...

d3:/pro/3gl/GNU/tar-1.20/tests 112 > rm directory/file2
d3:/pro/3gl/GNU/tar-1.20/tests 113 > genfile --length 13 --file directory/file2
15 13
Exit 1
d3:/pro/3gl/GNU/tar-1.20/tests 114 > dump directory/file2
[DUMP 0.5.05 UX]

00000000  00 00 00 01 02 03 04 05  06 07 08 09 0A 0B 0C       ...............

d3:/pro/3gl/GNU/tar-1.20/tests 115 >

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:

GNU/tar-1.20/tests 135 > genfile --length 6 --file directory/file2
W 00 @      2
W 01 @      3
W 02 @      4
W 03 @      5
W 04 @      6
W 05 @      7
8 6
Exit 1

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---

GNU/tar-1.20/tests 141 > genfile --length 6 --file directory/file2
Generating file 'directory/file2'. seek_offset = 0, length = 0
File opened 0x7b011c58, off: 0
File seeked, off: 2
W 00 @      2

 DESCRIPTION
      fseek() sets the file‐position indicator for stream.  The new
      position, measured in bytes from the beginning of the file, is
      obtained by adding offset to the position specified by whence.  The
      specified position is the beginning of the file for SEEK_SET, the
      current position for SEEK_CUR, or end‐of‐file for SEEK_END.

      fseeko() is a non‐POSIX standard API provided by the _LARGEFILE_SOURCE
      compile option.  It is identical to the fseek() except that the offset
      parameter is an off_t instead of a long int.  All other functional
      behaviors, returns, and errors are identical to the POSIX fseek().

      If the most recent operation, other than ftell(), on the stream is
      fflush(), the file offset in the underlying open file description is
      adjusted to reflect the location specified by the fseek().

So obviously fseeko () (and.or fseek ()) are severely borked when
called as first call after fopen (), even if seek_offset == 0.

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---

After this most tests pass.

 63: volume header size                              FAILED (volsize.at:32)

Test 63 sucks, because it depends on the Time Zone.
If I setsenv TZ to UTC-3, the test passes.


The .tar, .gtar, and .tar.bz2 files are not automatically fetched, but I got
them manually, because they were not fetched on my other systems either.

 73: ustar-big-8g                                    FAILED (multi-fail.at:26)

This system doesn't have that much disk space anyway.

> > How do I run a single test?
> 
> ./testsuite -k ID

testsuite -k pipe runs 2 AND 55 :(

> where ID is any of identifiers listed in the file's AT_KEYWORDS
> statement.
> 
> > In verbose mode?
> 
> ./testsuite -k ID -v
> 
> For maximum verbosity:
> 
> ./testsuite -k ID -v -x 
> 
> > ------ This is a copy of the message, including all the headers. ------
> > ------ The body of the message is 970533 characters long; only the
> > ------ first
> 
> That message was obviously too big to be accepted by the list.

That's what I guessed, hence my report with a gzipped version

BTW, WTF do you want locale support in genfile. It is only for testing
the suite for goodness sake. I always build everything with no NLS
support, as it is completely unreliable when shipping binaries to other
systems (AIX and HP-UX), which either do not have the required (shared)
libraries installed (a very healthy choice indeed) or are incompatible
with the building system (very likely, and exactly the reason for not
installing it in the first place).

$ configure --prefix=/pro --program-prefix=n --disable-nls
            --without-libiconv-prefix --without-libintl-prefix

Hope this all helped ....

--8<--- genfile.c.diff
--- GNU/tar-1.20/tests/genfile.c    2008-02-18 09:23:24 +0100
+++ GNU/tar-1.20/tests/genfile.c    2008-05-21 09:12:15 +0200
@@ -423,7 +423,7 @@ generate_simple_file (char *filename)
   else
     fp = stdout;

-  if (fseeko (fp, seek_offset, 0))
+  if (seek_offset && fseek (fp, (long)seek_offset, 0))
     error (EXIT_FAILURE, errno, "%s", _("cannot seek"));

   fill (fp, file_length, pattern);
-->8---

-- 
H.Merijn Brand         Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using & porting perl 5.6.2, 5.8.x, 5.10.x  on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.1 & 10.2, AIX 5.2, and Cygwin.       http://qa.perl.org
http://mirrors.develooper.com/hpux/            http://www.test-smoke.org
                        http://www.goldmark.org/jeff/stupid-disclaimers/




reply via email to

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