Comments (3)
Hi,
I am a bit confused about what kind of an issue you are describing here. SWCompression APIs are not aware of such concepts as relative or absolute paths. They just faithfully the contents of the supplied archive in a convenient form (this includes TarEntryInfo.linkName
), and it's up to the user to interpret these values as either kind of a path.
I suppose you're talking about the usage of these APIs in swcomp, specifically, this line here. If that's the case, then I should emphasize once again that swcomp command-line tool is not intended for general use. It serves only two purposes: demonstration of how SWCompression APIs can be used (and not how they should be used), and as an "internal" testing facility. To illustrate this, note that "hard" links are completely ignored in swcomp and rejected as an "unknown" entry type.
On the subject of the actual issue, I do not know what behavior (the current one with absolute paths or the proposed with relative ones) is more correct. I've skimmed through the various TAR-related material listed in the README to refresh my knowledge on the subject matter and to my understanding the absolute/relative path issue is not specified.
I am interested in any other references that may explicitly specify the proper way of handling links, and no, the Mac's Archive Utility's current behavior does not count, as it may change at any point and I do not fully trust them with the correctness of their implementation.
from swcompression.
Sorry, yes, I was referring to swcomp
as I was using it as a reference while working on my own project.
The archive that started me down this path is at: https://github.com/Homebrew/brew/tarball/master
Looking at the GitHub repo, I can see that the original symlinks were relative:
https://github.com/Homebrew/brew/blob/master/Library/Homebrew/test/support/fixtures/bottles/testball_bottle-0.1.x86_64_linux.bottle.tar.gz
but upon extraction with swcomp, they are written as absolute links.
Dumping the TAR's table of contents, I can see the destination was recorded as relative:
lrwxrwxrwx 0 root root 0 Sep 20 12:36 Homebrew-brew-a6aab4b/Library/Homebrew/test/support/fixtures/bottles/testball_bottle-0.1.aarch64_linux.bottle.tar.gz -> testball_bottle-0.1.yosemite.bottle.tar.gz
While I can't find any documentation that discusses this, it seems like relative is defined in the archive itself. 🤷
from swcompression.
After thinking a bit more about this and some experimentation, I am inclined to agree that the current behavior is not ideal. It has been fixed in f191db2.
While working on this I've uncovered a couple of more issues with the current TAR implementation:
- The PAX extended header records values that contain newline characters were parsed incorrectly resulting in an error being thrown.
- The PAX extended header records values that are not UTF-8 strings were also causing an error to be thrown. The existence of such headers is quite surprising considering that one of the PAX specifications specifically says that "the value field shall be encoded using UTF-8". Apparently, the Apple-supplied TAR implementation on macOS does not respect this and just writes binary data in these records.
All of these were fixed in 4.8.3.
In addition, I have also discovered that the Apple-supplied TAR implementation on macOS actually reverses the direction of hard links. Basically, if you have a "link" hardlink that links to a "file" then in the resulting TAR archive it will be the other way around, "file" will be a hardlink to a "link"...
While it may be possible that I am wrong and I am missing something here, but generally speaking this is why I do not consider Apple's Archive Utility as a reference implementation (GNU Tar behaves the expected way).
P.S. The last two issues I decided to report to Apple as FB11712450 and FB11712441.
from swcompression.
Related Issues (20)
- [CRASH] LittleEndianByteReader.swift:33:20 HOT 2
- Progress when decompression is needed HOT 1
- Memory issues when working with larger files HOT 8
- [CRASH] MsbBitReader.bit() HOT 4
- AR Format Support HOT 7
- Can Gzip unarchive return Member? HOT 1
- GzipArchive.unarchive wrongMagic for short data HOT 1
- Brotli Support? HOT 2
- BZip2Error.wrongCRC when decompressing HOT 2
- Support File I/O for large archives and resource-constrained environments
- Error when decompressing a certain 7z file HOT 2
- Some zip files can't be extracted HOT 2
- LZ4 format not compatible? HOT 8
- Compiling for watchOS fails HOT 1
- LZ4 decompress speed HOT 10
- Support splitting zips into multiple files
- Is there a way to extract a single file from a 7z compressed archive? HOT 4
- LZFSE Support
- Please update BitByteData dependency HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swcompression.