~nilium/mtar

Satisfy linter and remove unneeded code

- changeDir doesn't do anything special. I suspect it once did, but no
  longer the case.

- Remove startupDir since it's not used.

- Add a few explicit error result discards.
Add -A[file] option to concatenate tar files

Add a -A flag to allow concatenating tar files from either standard
input or files. Concatenating gtar files may not be handled correctly
with cases like hard links, so some caution should be exercised.
Reading multiple tar files from mtar on standard input should work
correctly, however.

Global flags all still apply to concatenated files.
Add -D, -d option to control duplicate entry skipping

This adds an option to skip (-D) or allow (-d) duplicate entries in
the output stream. By default, duplicates are skipped (a change from
mtar's prior behavior, which was to not check).
Add ref=LINK header option

This allows turning a file into a hard link.
Add -Fformat flag to change tar header format

Add a -Fformat (or -F format) flag to mtar to allow changing the tar
header for the output stream. If the header format changes mid-stream,
a warning is issued.

By default, mtar already uses PAX and will continue to use PAX by
default. This flag is added specifically to support older software that
may not handle PAX.
Add nouser, -U, -u options

This adds a global flag to disable collection of file user/group
information for the tar header. In addition, user info can be disabled
per-file by setting nouser. If any user-mode options are passed,
however, the nouser flag is disabled for the file.
b6f79495 — Noel Cower 5 years ago v1.0.1
Handle bash <() redirection

There's probably a better way to detect these specifically, but since
mtar preserves symlinks by default, it's a special case.
a901f805 — Noel Cower 5 years ago
Add go.mod
2c7c0fc8 — Noel Cower 6 years ago v1.0.0
Fix double-recording of recursively-added dirs

Previously, if you added a directory, the directory header would be
written once, and then written again during the file walk stage.

Change-Id: I111e720e2c449411759fffff7808a0871d06b4ac
6f36c4f6 — Noel Cower 6 years ago
Adjust how owner/uid/group/gid function

They'll now look up existing entities on the system to use for
names/IDs, rather than taking arbitrary values. This is less flexible
than before, but makes it easier to construct tar files, especially
since you can now do owner=root and get the uid set by doing so.

In addition, when setting owner=NAME or uid=ID, if no group/gid is
provided, the owner's primary group will be used.

Change-Id: I38479d107238b17a92c819d3ca5032826f765269
4983050f — Noel Cower 6 years ago
Add a few general sanitization checks

- When replacing the prefix on a directory (added recursively), use
  a prefix with a trailing slash to only replace directory components.

- Omit files named './', '.', '..', and '/' in archive.

Change-Id: Id19bbcd3656d158629de9e5b839ae7e0904dbfe7
3730d69c — Noel Cower 6 years ago
Add per-file options, allow adding non-regular files

- Allow reading non-regular files so they can be added to an archive.
  Non-regular files include, primarily, named pipes and devices, as
  well as stdin as a special case (via '-' -- /dev/stdin doesn't get
  special treatment).

  This is supported mainly by buffering those files into memory, since
  the actual size of those files when stat'd is not necessarily useful
  (especially for pipes). I'd like to try to avoid buffering things
  into memory in the future, but my particular use case right now isn't
  harmed by this. It might be worse for people using it in ways I'm not
  expecting.

- File options are supported as a means of changing the properties of
  files as they're added to the archive. This allows you to synthesize
  some files, like directories and links, by doing, for example,
  '-:/etc:dir,owner=root,uid=0' or something along those lines.

  Currently, mtime, atime, and ctime can be modified using options, but
  if they're passed as integers, there's currently nothing to prevent
  integer overflow (and this isn't an error in Go, so it'll just
  silently overflow). This needs to be fixed, but also doesn't affect
  me right now.

Change-Id: I9aca08609c1df5c57c18db5d13894f8c9510fb9e
ffbe98b8 — Noel Cower 6 years ago
Initial commit

This program is a horrifying mess but I really wanted it for.. some
reason. Yeah. It should surprise nobody.

Change-Id: I5a2498a09c5dbbd379b37b71404d7982753b7f8a
Do not follow this link