When the archive path is "-", read archives from stdin for list and
extract, and write archive data to stdout for create.
Route create status output to stderr when writing the archive to
stdout so verbose output does not corrupt the stream. Add CLI tests
for create-to-stdout, list-from-stdin, extract-from-stdin, and the
stderr routing cases.
Added support for -P and --absolute-names flags to preserve absolute
paths when creating archives, matching GNU tar behavior.
* CLI: Added -P / --absolute-names options to uu_app.
* Operations: Configured tar::Builder to preserve absolute paths
based on the new flag.
* Normalization: Updated normalize_path to skip stripping root
and prefix components when absolute paths are allowed.
* Tests: Added integration tests for path preservation and trimming
during archive creation and extraction.
Implement the list operation. Non-verbose (-t) prints one entry path
per line. Verbose (-tv) prints permissions, owner/group, size,
modification time, and path — matching GNU tar's ls-l style output.
Adds conflict group so -c, -x, and -t are mutually exclusive.
Pulls in chrono for timestamp formatting in verbose output. chrono is
already in the workspace dependency set and will also be needed for
date parsing when --newer=DATE is implemented.
Point uucore/uutests at the coreutils git repo while we're iterating
quickly on basic functionality.
Support traditional key syntax (for example `tar cvf archive.tar file`)
by rewriting a leading key operand into clap-compatible short options
before argument parsing.
- detect valid keystrings in argv[1]
- expand key letters into `-<opt>` arguments
- consume operands for `f` and `b` in key order
- forward `-b` (currently unsupported) so key/dash forms fail consistently
- update usage text to document key syntax
- add unit tests for key detection/expansion
- add integration tests for create/extract parity and `-b` failure parity
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
* Implement minimal create and extract operations
Adds basic tar archive functionality using tar-rs library with proper
error handling infrastructure.
Core Implementation:
- TarError enum implementing UError for uucore integration
- Extract operation (-x) for unpacking tar archives
- Create operation (-c) for creating tar archives from files/directories
- Verbose mode (-v) for both operations
- Proper CLI argument parsing with -f flag for archive file
Error Handling:
- Comprehensive error types (IoError, InvalidArchive, FileNotFound, etc.)
- Proper error conversion from io::Error
- UError trait implementation for exit code handling
This provides the minimal foundation for tar functionality. Both create
and extract are included together since they depend on each other for
testing purposes.
Includes 18 tests total:
- 8 integration tests (CLI basics, create/extract operations, error handling)
- 10 unit tests (CLI flag parsing, error type handling)
- Unit tests organized in src/uu/tar/tests/ separate from implementation
Note: Run `cargo test --workspace` to execute all tests including unit tests.
* Re-add cognitive complexity warning suppression for uu_app function
* Sort out tar/tarapp conflict
Rename package from "tar" to "tarapp" in Cargo.toml and update
dependencies to use workspace for tar.
* fix(errors): improve error handling and exit codes for tar operations
- Updated error messages for file not found and permission denied cases.
- Fix exit codes for various TarError types to conform to standard.
- Refactored extract_archive to use new error handling.
- Adjusted tests to reflect updated exit codes.
* Update for error changes (fixes cargo test --all)
* Use arg! macro and comment out rather than remove the unimplemented items.
* fix(create): Remove duplicate message for missing files in create_archive
---------
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>