1

When unpacking a tar archive with a symlink under Solaris 10, I get this error:

tar: lib/jre/: symbolic link failed: Not a directory

The lib/jre symlink points to lib/jre1.8.0_46 which is in the tar archive as well. I can unpack the tar just fine with GNU tar. So what's the problem here?

  • Obviously Solaris tar is not like Gnu tar. Aren't there any hints on the Solaris man page for tar? – ott-- Mar 18 '16 at 16:49
  • 2
    So what's the problem here? GNU tar is not POSIX-compliant. By default it does not make standard-compliant archives. See also ftp.gnu.org/old-gnu/Manuals/tar/html_node/tar_113.html#SEC108 and ftp.gnu.org/old-gnu/Manuals/tar/html_node/tar_117.html#SEC112 – Andrew Henle Mar 19 '16 at 2:07
  • 1
    On some of the Solaris systems I've worked on tar has been aliased to gtar. Don't know if it was a good idea really, but never seen any problems with it. Also: The fact that it is actually GNU tar and not Solaris' tar which is dis-respecting the standard is of less importance to most people as GNU has in many ways become a de-facto standard. – peterh Mar 19 '16 at 12:12
  • Can you tell us the exact command line you are using to extract the tar archive? – Mark Plotnick Mar 19 '16 at 13:30
  • @MarkPlotnick Sure: gunzip -c foo.tar.gz | tar -xvf - – Arne Mar 21 '16 at 11:28
2

If you want to use the gnu tar under Solaris. Then see inline:

  • Solaris 10: check if you have it by doing pkginfo SUNWgtar Usual path is: /usr/sfw/bin/gtar
  • Solaris 11: check if you have it by doing pkg info gnu-tar Usual path is /usr/gnu/bin/tar with two symlinks to/usr/sfw/bin/gtar and /usr/bin/gtar

Updating the info according to the comment. In case gnu tar is not available, you can create tar POSIX compliant with --format=posix option.

this is available from GNU tar version 1.14. More info can be found at GNU TAR

  • Ok, so our customer does not have GNU tar and cannot install it. In the future I will make sure that I use Solaris tar instead. BUT: is it possible to create a Solaris tar compatible file using GNUT tar? – Arne Mar 21 '16 at 11:29
  • please check the updated answer. – BitsOfNix Mar 22 '16 at 11:18
-1

Given that you get the error Not a directory, it is obvious that the symlink in the tar archive is

lib/jre/ -> lib/jre1.8.0_46

which is different from what you tell us in your text.

If gtar does not complain about that link, it is broken.

Unfortunately, you did not give sufficient information about your constraints.

We need to know:

  • what type of tar archive are you talking about. You get the type via star -t -print-artype < foo.tar.gz
  • what is the exact entry in the archive. You get the answer via star -tv < foo.tar.gz pat='*jre*'

Archives created with gtar are not POSIX compliant and may even change the archive type in the middle of the archive. You should understand that this may have really strange results.

To get star, I recommend to fetch the latest schilytools from: https://sourceforge.net/projects/schilytools/files/ and compile them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.