Why can tgz be opened on Linux box but not on Windows?

General Tech Bugs & Fixes . 2 years ago

  0   2   0   0   0 tuteeHUB earn credit +10 pts

5 Star Rating 5 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Write Your Comments or Explanations to Help Others



Tuteehub forum answer Answers (2)


profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

I've received a Tar/GZipped file that was created on an embedded Linux device.

The file can be extracted perfectly fine on a Linux desktop if I run something like tar zxf myFile.tgz. The file extracts to something like

dir1/
  file1
  file2
dir2/
  file1
  file2
  subdir1/
    file1

...but I suspect the specific file content and layout are irrelevant.

When I try to extract this same file in Windows (using either 7-Zip or WinZip), I get:

  myFile/
    file with temp-looking name e.g. "logs_xqUt09">

It's probably relevant that that top-level directory happens to be named "myFile" when the .tgz I received is itself named myFile.tgz...but I don't know with certainty that it's anything more than coincidental.

I browsed SuperUser a bit, and found a few related issues, one of which suggested that 7-Ziphandles .tgz files better than WinZip, but apparently not in this situation.

Does anyone know what gives? Why would a .tgz be fully extractable under Linux but not Windows? What workarounds might there be?

If I rename that extensionless file to a .tar file, then that .tar file is extractable with 7-Zip and/or WinZip.

I'd still like to understand what's going on, and if there's a workaround that doesn't involve that manual file renaming, because ideally the original .tgz file delivered by the embedded device should be extractable under Linux and Windows.

0 views   0 shares
profilepic.png
manpreet 2 years ago

tgz (tar.gz) is a two-level-archive. first a stream of files is saved as tar. second the tar file is compressed with gzip. if you extract a gzip file you will always get a single file - extensionless file with temp-looking name in case of 7-zip. this file can "unpacked" with tar, or with 7-zip again.

besides tar stream contains metadata like file permissions, group id + user id, xattrs or selinux context (and maybe symbolic links) which get lost on windows file system, unpacking linux files may fail or cause trouble because of the ascii charset in file names (all chars except / allowed in linux). usually it makes no sense to extract tar archive to windows disk


0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

tuteehub community

Join Our Community Today

Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.

tuteehub community