Bug 205358 - bsdtar(1) does not return an error status when an input path is not in the filesystem
Summary: bsdtar(1) does not return an error status when an input path is not in the fi...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.2-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-16 20:38 UTC by Jan Martin Mikkelsen
Modified: 2016-09-29 16:06 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Martin Mikkelsen 2015-12-16 20:38:38 UTC
bsdtar(1) emits a warning but does not return an error status when one of the input files cannot be found. This is a regression vs. the bsdtar in 8.x.

To test:

    tar cf /tmp/file.tar nonexistent-file-name && echo Return value broken

Returning an error is important for unattended scripts that depend on the return value to get failure conditions -- This was discovered after a file was missing from an automated build where the build process completed with a warning only.

The libarchive based cpio(1) does the return an error code in this case.

The difference seems to be that cpio returns and error status for the internal errors ARCHIVE_FAILED and ARCHIVE_FATAL, while tar only returns errors for ARCHIVE_FATAL.
Comment 1 Jan Martin Mikkelsen 2016-06-02 07:05:18 UTC
This has been fixed upstream.

https://github.com/libarchive/libarchive/issues/708

https://github.com/libarchive/libarchive/commit/ba20a8b3b9de1a4baf018ceeb298dfd63bcaccfb

Would be nice to get the fix imported into FreeBSD ...
Comment 2 Jan Martin Mikkelsen 2016-07-06 04:25:19 UTC
Fix from upstream imported to stable/10 in r302075
Comment 3 sega01 2016-09-29 16:06:21 UTC
The fix for this seemed to create an odd behavior. I made a new bug for it:  https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213092

Thank you!