Bug 15346 - tar does not have --format option + aliases for formats
Summary: tar does not have --format option + aliases for formats
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-17 19:31 UTC by anonymous.maarten
Modified: 2023-02-17 19:31 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description anonymous.maarten 2023-02-17 19:31:36 UTC
The -H/--format option allows one to choose an archive format.

GNU tar also provides direct options to select a format.

e.g. --posix as an alias for --format=posix
 or  --portability for --format=v7.

I ran into this issue in a GitHub workflow in an Alpine docker container, which uses busybox by default.

The actions/cache action requires a "Posix-compliant tar".
It looks like busybox already generates posix archives.

I have pasted the error message below. The error is because of an --posix option.

```
/usr/bin/docker exec  fe3da0b58a8d73eeeaa346c3db67e6e1f7f0bf9896d148552db4c9077d01788d sh -c "cat /etc/*release | grep ^ID"
/bin/tar --posix -cf cache.tgz --exclude cache.tgz -P -C /__w/SDL/SDL --files-from manifest.txt -z
/bin/tar: unrecognized option: posix
BusyBox v1.35.0 (2022-11-19 10:13:10 UTC) multi-call binary.

Usage: tar c|x|t [-ZzJjahmvokO] [-f TARFILE] [-C DIR] [-T FILE] [-X FILE] [LONGOPT]... [FILE]...

Create, extract, or list files from a tar file

	c	Create
	x	Extract
	t	List
	-f FILE	Name of TARFILE ('-' for stdin/out)
	-C DIR	Change to DIR before operation
	-v	Verbose
	-O	Extract to stdout
	-m	Don't restore mtime
	-o	Don't restore user:group
	-k	Don't replace existing files
	-Z	(De)compress using compress
	-z	(De)compress using gzip
	-J	(De)compress using xz
	-j	(De)compress using bzip2
	--lzma	(De)compress using lzma
	-a	(De)compress based on extension
	-h	Follow symlinks
	-T FILE	File with names to include
	-X FILE	File with glob patterns to exclude
	--exclude PATTERN	Glob pattern to exclude
	--overwrite		Replace existing files
	--strip-components NUM	NUM of leading components to strip
	--no-recursion		Don't descend in directories
	--numeric-owner		Use numeric user:group
	--no-same-permissions	Don't restore access permissions
Warning: Failed to save: "/bin/tar" failed with error: The process '/bin/tar' failed with exit code 1
Warning: Cache save failed.
```