Thanks, but there's something different about our environments.

I downloaded your code. Commented out the "Data::Dumper::Concise" since you don't use it and it isn't installed on my system. Changed output file name (don't have a Desktop on this system).

Still get error. Yes, the .tgz gets created (didn't notice this before).

More interesting, if instead of a 0 byte file (Did you duplicate that?), I do echo "abcd">foo - the error goes away.

BUT: the .tgz is corrupt. Sometimes.

#!/usr/bin/perl -slw use strict; use Archive::Tar; #use Data::Dumper::Concise; $Archive::Tar::FOLLOW_SYMLINK = 1; print $Archive::Tar::VERSION; my $t = Archive::Tar->new; $t->add_files('bar'); $t->write( 'baz.tgz', COMPRESS_GZIP ); $t->error(1); print "Done"; ls -l foo bar baz.tgz ls: cannot access baz.tgz: No such file or directory lrwxrwxrwx. 1 root root 3 Sep 15 19:35 bar -> foo -rw-r--r--. 1 root root 0 Sep 15 23:19 foo # perl z.tmp 1.78 Could not write data for: bar at z.tmp line 12 Done # echo "abcd" >foo # ls -l foo bar baz.tgz lrwxrwxrwx. 1 root root 3 Sep 15 19:35 bar -> foo -rw-r--r--. 1 root root 97 Sep 15 23:21 baz.tgz -rw-r--r--. 1 root root 5 Sep 15 23:20 foo # rm baz.tgz # perl z.tmp 1.78 Done ]# ls -l foo bar baz.tgz lrwxrwxrwx. 1 root root 3 Sep 15 19:35 bar -> foo -rw-r--r--. 1 root root 97 Sep 15 23:25 baz.tgz -rw-r--r--. 1 root root 5 Sep 15 23:20 foo And sometimes, I get # tar -tzvf baz.tgz -rw-r--r-- root/root 0 2011-09-15 19:35 bar tar: Skipping to next header tar: Exiting with failure status due to previous errors
I'm not hallucinating. (This is a reduced test case from larger program; it normally does more work.)

In reply to Re^2: Archive::Tar fails to dereference and save symlinks? by Anonymous Monk
in thread Archive::Tar fails to dereference and save symlinks? by tlhackque

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.