Help us shape the future of Go! Take the 2026 Go Developer Survey

unarc

command
v0.69.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Command unarc extracts the archives in a directory, each into its own subdirectory, and never deletes the archive it read.

It exists because the shell cannot reliably address the files it is pointed at. On macOS a filename holding an accented character is stored DECOMPOSED (e + U+0300), and a name typed or quoted in composed form does not match it:

zipinfo: cannot find or open .../Logo IP Paris 6 e<U+0301>coles vertical web.zip

Three of sixty-five archives failed that way under a shell loop. Reading the directory with os.ReadDir hands over the exact bytes, with no quoting and no normalisation in between, so the question does not arise.

⛔ AN ARCHIVE'S NAMES ARE A TRUST BOUNDARY. filepath.Join neutralises a leading slash and does NOT neutralise "..", so every entry is checked against the destination after cleaning. An entry that escapes is REFUSED and named, not silently stripped: a stripped path writes a file somewhere the caller did not ask for, under a name that no longer says where it came from.

⛔ IT SAYS WHAT IT CANNOT DO. 7z, rar and xz need a decompressor this module does not carry, so those are reported as needing an external tool rather than counted as skipped -- a count that mixes "already done" with "cannot do" reads as success.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL