compressing icon indicating copy to clipboard operation
compressing copied to clipboard

Use '/' path separator on Windows for tar archives

Open Infiltrator opened this issue 6 years ago • 4 comments

Creating a tar archive on Windows with a directory results instead in the file having '\' in its name, and on extraction on POSIX, does not create the appropriate directory.

To fix this, use path.posix to force the '/' path separator even if creating the archive on Windows.

Infiltrator avatar Mar 20 '19 05:03 Infiltrator

Fixes #22 .

Infiltrator avatar Mar 20 '19 05:03 Infiltrator

Hmmm. How do I squash commits in the browser?

Infiltrator avatar Mar 20 '19 06:03 Infiltrator

Will this be merged? Currently tgz created on windows are not readable on linux.

zevero avatar Feb 05 '21 10:02 zevero

@Infiltrator Can you add a test case for this bug fix?

fengmk2 avatar Jul 11 '22 00:07 fengmk2

I know this issue is old, but I confirmed that this fixes issues on Windows 10. I am generating a tgz using:

compressing.tgz.compressDir(stagingDir, outputDest);

Tools like 7Zip are unable to correctly extract the folder structure. When I apply the changes in this PR, everything works as expected.

DesignByOnyx avatar Aug 02 '23 17:08 DesignByOnyx

Codecov Report

Merging #24 (72651bb) into master (290b7b3) will not change coverage. Report is 1 commits behind head on master. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master      #24   +/-   ##
=======================================
  Coverage   96.64%   96.64%           
=======================================
  Files          19       19           
  Lines         597      597           
  Branches      112      112           
=======================================
  Hits          577      577           
  Misses         20       20           
Files Changed Coverage Δ
lib/tar/stream.js 96.51% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Aug 02 '23 17:08 codecov[bot]

:tada: This PR is included in version 1.9.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] avatar Aug 02 '23 17:08 github-actions[bot]

Thanks @fengmk2 for pushing this along. I'm trying to create a test for this, but there are a couple issues which fall into the "not worth it" category for me:

  • The tests will need to run on Windows to make sure it truly passes.
  • The bug doesn't happen using this library alone - meaning, this tool can uncompress files that it created. In order to actually test this, we will need to run tar commands (if it exists) or 3rd party tools to uncompress the files.

None of this seems worth it for what appears to be a reasonable and simple fix. Thanks for getting this in!

DesignByOnyx avatar Aug 02 '23 18:08 DesignByOnyx