Commit Graph

207 Commits

Author SHA1 Message Date
scottl
b53960c163 Provide missing implementations for archive_entry_ctime() and
archive_entry_ctime_nano()
2005-06-01 18:20:02 +00:00
kientzle
583200b7e6 Remove the C99-specific __func__ that is one of the few barrier to
compiling on IRIX and Solaris.  Remove the "archive_check_magic" macro
that existed only to provide __func__ to the underlying __archive_check_magic
function.

Thanks to: Darin Broady
MFC after: 14 days
2005-06-01 15:52:39 +00:00
kientzle
cae6a1d6e9 <Ooops> Two lines got dropped from the previous commit. Apologies.
MFC after: 14 days
2005-06-01 15:46:47 +00:00
kientzle
326eb5aaed A minor refinement to "pax" output: Remove suid/sgid/sticky bits
from mode before using mode for extended attributes entry, copy
mtime/atime/ctime to extended attributes entry so it's a little more
clear that it corresponds to the like-named regular entry.

MFC after: 14 days
2005-06-01 15:44:23 +00:00
kientzle
3c03499e5b Start to address the race issue between restoring a file's contents
and restoring the metadata.  In particular, the metadata-restore
functions now all accept a file descriptor and a pathname.  If the
file descriptor is set and the platform supports the appropriate
syscall, restore the metadata through the file descriptor.  Otherwise,
restore it through the pathname.  This is complicated by varying
syscall support (FreeBSD has an fchmod(2) but no fchflags(2), for
example) and because non-file entries don't have an fd to use in
restoring attributes (for example, mknod(2) doesn't return a file
handle).

MFC after: 14 days
2005-05-21 19:45:56 +00:00
kientzle
d665dce5d0 Correct return values in myopen() and myclose() in Example code.
Bug: docs/79318
Thanks to: Derek Tattersall
MFC after: 7 days
2005-05-21 19:38:19 +00:00
kientzle
942b7e7d55 archive_entry_set_link is supposed to update whichever link field
(symlink or hardlink) is already set.  Instead, it was always setting
the hardlink field.  In particular, this caused GNU tar format long
symlinks to be interpreted as hardlinks.

Thanks to: Brooks Davis
MFC after: 7 days
2005-05-08 19:10:41 +00:00
kientzle
47cfd711c7 Fix broken ACL configuration on FreeBSD 4 and Linux.
Thanks to: Greg Lewis, Juergen Lock, Jaakko Heinonen for reporting and testing
2005-04-23 17:56:34 +00:00
kientzle
5be5ef99a1 Certain filenames between 245 and 255 characters long would cause an
internal error if pax extended attributes were being generated.  Being
< 255 characters, the first-pass path editing (to generate a
ustar-compatible name for the main entry) wouldn't occur, and the
second-pass path editing (to generate a ustar name for the pax
attributes entry) assumed the input was already < 245 chars.

The core problem here was using an abbreviated algorithm for the
second pass that relied on the first pass having already run.  The
rewritten code is much simpler: It just uses the full path-shortening
algorithm for building both ustar pathnames.  This way, the second
ustar pathname will always be short enough.

Thanks to: Mark Cammidge
Related to: bin/74385
2005-04-23 17:46:51 +00:00
kientzle
a46546658e Portability enhancement: MS Windows won't restore metadata if the file
is still open, so close the file as soon as we've written the
file contents, before we attempt to restore metadata.

Thanks to:  Kees Zeelenberg
2005-04-17 22:49:00 +00:00
kientzle
877f4c482e Update "make distfile" to use newest automake/autoconf from ports.
Thanks to: Juergen Lock
2005-04-17 17:51:05 +00:00
kientzle
3e09e80261 A number of improvements to ZIP support.
* Handles entries with compressed size >2GB (signed/unsigned cleanup)
  * Handles entries with compressed size >4GB ("ZIP64" extension)
  * Handles Unix extensions (ctime, atime, mtime, mode, uid, etc)
  * Format-specific "skip data" override allows ZIP reader to skip
    entries without decompressing them, which makes "tar -t"
    a lot faster.
  * Handles "length-at-end" entries generated by, e.g., "zip -r - foo"

Many thanks to: Dan Nelson, who contributed the code and test files for
   the first three items above and suggested the fourth.
2005-04-06 04:19:30 +00:00
kientzle
886428519a Clean up the support for extracting very long pathnames. 2005-03-29 05:24:08 +00:00
kientzle
4f2d6bca6d Support extracting entries with pathnames longer than PATH_MAX. In
testing, I've archived and restored dir trees with ~1MB pathnames.
Most formats, of course, have much smaller limits.
2005-03-13 02:53:42 +00:00
kientzle
57f7478012 When rejecting rediculously large pax attributes (such as pathnames
over 1MB), issue a warning instead of forcing an internal assertion
failure.
2005-03-13 02:35:52 +00:00
kientzle
816c5be744 Correctly pass low-level I/O errors back up to the caller when
reading cpio format.
2005-03-13 01:52:35 +00:00
kientzle
3d74129d7e Better error messages on read and file-open errors. 2005-03-13 01:51:16 +00:00
kientzle
b1a33585f7 Include detailed error message from zlib after a decompression error. 2005-03-13 01:48:33 +00:00
kientzle
ebf75b4df5 If the output is not a regular file, it's okay to add it to the archive.
In particular, /dev/st0 can be added to an archive being written to /dev/st0.

Thanks to: Jaakko Heinonen
2005-03-13 01:47:31 +00:00
kientzle
7c8883e740 Use correct byte order when parsing the size of the gzip "Extra data" field.
In particular, this correctly allows bsdtar (and pkg_add) to skip
package signatures.

Thanks to: Theo Schlossnagle
2005-03-02 05:34:05 +00:00
kientzle
7d5dce8695 Fix a misplaced .El 2005-02-23 06:58:09 +00:00
kientzle
5558a3650b Don't return NULL if there's no error message;
return a generic text message instead.
(Someday, I'll track down all the places that
are generating errors but not recording messages. ;-/

Thanks to: Jaakko Heinonen
2005-02-23 06:57:04 +00:00
ru
6b6b8c04f6 Expand contractions. 2005-02-13 23:45:54 +00:00
kientzle
2896c0ddcb Fix a buffer overflow in the "none" decompression handler that
occurred with large read-ahead requests.  This only affected
formats that incorrectly make large requests (ZIP did this until
recently) or with block sizes over 32k.
2005-02-13 23:29:54 +00:00
ru
1541af42f1 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
kientzle
9ae66c1865 Oops. I missed a 0 => '\0' correction.
Thanks to: Ruslan
2005-02-12 23:33:31 +00:00
kientzle
c17dc84307 Clear the error message buffer on entry to major routines.
This avoids having error messages get concatenated over multiple calls.
2005-02-12 23:11:29 +00:00
kientzle
d7de376121 Update the format descriptions to include ISO9660 and ZIP support.
Also remove some unnecessary blank lines from archive_read.3.
2005-02-12 23:09:44 +00:00
kientzle
51b8ea9c30 Performance optimization, code clarification, and bug workaround.
When reading the bodies of Zip archive entries, request a minimum of 1
byte, rather than a minimum of the full entry size.  This is faster
(since it does not force the decompression layer to combine reads) and
works around a bug in the "none" decompression handler (which I'm
testing a separate fix for now).  I've also renamed "bytes_read" to
"bytes_avail" in several places to more accurately reflect that the
value returned from (a->compression_read_ahead) is the number of bytes
available, not necessarily the number of bytes requested.
2005-02-12 23:00:31 +00:00
kientzle
31107ff9be Fill in some more Rockridge details in ISO9660 support: Ignore PD
(padding) entries, extract inode value from PX entry, recognize SP and
ST (start/end of SUSP extensions).

I don't enforce SP yet, as I've seen CDROMs which use Rockridge
extensions but don't have the SP record (which is officially
required).

The ISO9660 support is now mature enough to extract FreeBSD
distribution CDROMs created with mkisofs.
2005-02-12 22:48:38 +00:00
kientzle
c8ffa65148 Flush input when reading from pipe to avoid "broken pipe" warnings.
For example, when using 'gunzip | tar' to decompress.
Also, fix some style issues (write null character as '\0').

Thanks to: Jaakko Heinonen
2005-02-12 22:44:50 +00:00
kientzle
20b49aeb76 This should (finally) fix the 64-bit build. <sigh> 2005-01-26 03:28:37 +00:00
kientzle
634c300ead Fix some signed/unsigned mismatches.
Reported by: tinderbox
Pointy hat: me
2005-01-25 16:55:28 +00:00
kientzle
973eae31d4 Basic support for ZIP archives.
Only supports "deflate" and "none" compression for now.

Also, add a few clarifications to the archive_read.3 manpage as
requested by William Dean DeVries.
2005-01-25 06:07:28 +00:00
charnier
aafdd446f9 spell "file system" correctly
Approved by:	ru
2005-01-24 19:58:05 +00:00
kientzle
3d727e0e24 Set the format code and name correctly for:
* ISO9660 CDROM images
  * ISO9660 images with Rockridge extensions
2005-01-23 03:02:14 +00:00
ru
22937d31bc Fixed xrefs. 2005-01-21 20:50:39 +00:00
kientzle
8685dc0202 Support 'CE' records in Rockridge extensions
(specifies that record is extended elsewhere on
the disk).
2005-01-20 04:16:55 +00:00
kientzle
c78b57210e Implement a custom print formatter (archive_string_vsprintf)
for libarchive error messages.  Mostly, this
avoids a portability headache related to
copying va_list arguments (some FreeBSD 5
platforms require va_copy; FreeBSD 4 doesn't
support va_copy at all).  It also dramatically reduces the
size of libarchive for embedded applications:
a minimal "untar" program using libarchive can now be
under 64k statically linked (as opposed to ~100k
using library *printf() functions).

MFC after: 14 days
2005-01-16 22:13:51 +00:00
ru
29dd0f8076 Removed empty line. 2005-01-15 12:45:24 +00:00
kientzle
e49f75e9e4 Bring some file descriptions in line with reality.
Also, add some hints to help people understand which
functions are most appropriate for typical uses.
2005-01-12 05:56:49 +00:00
ru
5384a04b6a Scheduled mdoc(7) sweep. 2005-01-11 20:50:51 +00:00
kientzle
13e3045122 libarchive does much more than just tar ;-) 2005-01-10 05:11:15 +00:00
kientzle
bec0cf2f38 Recognize and parse symlinks in ISO9660 CDROM images with Rockridge extensions. 2005-01-08 19:56:07 +00:00
kientzle
03cce8d9d5 Documentation improvements. In particular,
expand and clarify the description of the client
callback functions and how they should handle errors.

Thanks to: Antony Dovgal
2005-01-08 19:51:04 +00:00
kientzle
9bbb1dc91d Correctly document the order of arguments
to archive_read_open and archive_write_open.

Thanks to: Antony Dovgal
2005-01-08 18:32:49 +00:00
kientzle
031211eb44 Clear the error buffer on entry
to archive_read_next_header so the
next error doesn't just get appended.

MFC after: 7 days
2005-01-08 18:28:11 +00:00
kientzle
44153c6433 First cut at RockRidge support.
Large thanks to the easy-to-read and well-documented
sys/isofs/cd9660 source code, which provided many of the
details I needed for this exercise.
2005-01-03 05:51:33 +00:00
kientzle
06cfd21d61 Next round of work on ISO9660 support:
* Reference-count the directory data so that
    we don't leak memory.
  * Correctly step through the directory records
    (skipping unrecognized extensions)
  * Use better defaults for file modes
  * Sort directory entries by offset of the end of the file
    rather than the beginning of the file.  This fixes a
    lot of "out-of-order" problems with zero-length files,
    in particular.
  * Style fixes, remove some debug code, add some error messages.
2005-01-03 01:24:13 +00:00
kientzle
3fc0b6292f Enable ISO9660 support in "read_support_format_all".
In particular, bsdtar should now recognize ISO9660 images.
2005-01-02 05:22:21 +00:00