Bug 222891 - /usr/bin/tar exits with INTERNAL ERROR: Function 'archive_read_disk_open'
Summary: /usr/bin/tar exits with INTERNAL ERROR: Function 'archive_read_disk_open'
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 11.1-STABLE
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-10 03:16 UTC by papowell
Modified: 2017-10-10 20:55 UTC (History)
3 users (show)

See Also:


Attachments
Details of the sourrce code (2.88 KB, text/plain)
2017-10-10 03:22 UTC, papowell
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description papowell 2017-10-10 03:16:05 UTC

    
Comment 1 Conrad Meyer freebsd_committer freebsd_triage 2017-10-10 03:21:54 UTC
We need more information, like information about when this error occurred.
Comment 2 papowell 2017-10-10 03:22:47 UTC
Created attachment 187040 [details]
Details of the sourrce code

I have reported this error for FreeBSD 11.0 and it is still present.

Do the following:
+ cd /
+ /usr/bin/tar -vczf files.tgz -T /tmp/rmis_save.tmp49784
a etc/rc.conf
a etc/hosts
a etc/ntp.conf
a etc/crontab
a etc/resolv.conf
a etc/nsswitch.conf
a etc/syslog.conf
a etc/newsyslog.conf
tar: etc/namedb/named.conf: Cannot stat: No such file or directory
tar: INTERNAL ERROR: Function 'archive_read_disk_open' invoked with archive structure in state 'header', should be in state 'new/closed': Unknown error: -1
tar: INTERNAL ERROR: Function 'archive_read_disk_open' invoked with archive structure in state 'header', should be in state 'new/closed': Unknown error: -1
tar: INTERNAL ERROR: Function 'archive_read_disk_open' invoked with archive structure in state 'header', should be in state 'new/closed': Unknown error: -1
tar: INTERNAL ERROR: Function 'archive_read_disk_open' invoked with archive structure in state 'header', should be in state 'new/closed': Unknown error: -1
t

This can be tracked down to code in
/usr/src/contrib/libarchive/libarchive/archive_read_disk_posix.c

line 874 or 2673
        case TREE_REGULAR:
            lst = tree_current_lstat(t);
            if (lst == NULL) {
                archive_set_error(&a->archive, errno,
                    "%s: Cannot stat",
                    tree_current_path(t));
                tree_enter_initial_dir(t);
                return (ARCHIVE_FAILED);
************** This should return a status which will cause the
************** either the archive to fail or the file
************** to be skipped (FreeBSD 10.3 behaviour)
            }

I would provide a bug fix but I am uncertain of how to cause the file to be
skipped.
Comment 3 Conrad Meyer freebsd_committer freebsd_triage 2017-10-10 03:27:34 UTC
Reopening, details were provided.
Comment 4 Martin Matuska freebsd_committer freebsd_triage 2017-10-10 20:54:52 UTC
Dear papowell@astart.com, to reproduce this bug I need more information:

1. Could you provide me with the filelist /tmp/rmis_save.tmp49784? Or at least a minimal part of it to reproduce the bug.
2. Is tar being run as root? If not please tell me the user and if su/sudo are used.
3. What architecture are you running on (e.g. amd64)?
4. What filesystems are traversed? (ZFS, UFS2?)
5. Are there any special security features enabled?
6. FreeBSD and libarchive version
7. If compiled from SVN the svn revision number