head 1.10; access; symbols libarchive-3-8-8:1.1.1.12 pkgsrc-2026Q2:1.10.0.14 pkgsrc-2026Q2-base:1.10 libarchive-3-8-7:1.1.1.12 libarchive-3-8-6:1.1.1.12 pkgsrc-2026Q1:1.10.0.12 pkgsrc-2026Q1-base:1.10 libarchive-3-8-5:1.1.1.12 libarchive-3-8-4:1.1.1.12 pkgsrc-2025Q4:1.10.0.10 pkgsrc-2025Q4-base:1.10 libarchive-3-8-3:1.1.1.12 libarchive-3-8-2:1.1.1.12 pkgsrc-2025Q3:1.10.0.8 pkgsrc-2025Q3-base:1.10 libarchive-3-8-1:1.1.1.12 pkgsrc-2025Q2:1.10.0.6 pkgsrc-2025Q2-base:1.10 libarchive-3-8-0:1.1.1.12 libarchive-3-7-9:1.1.1.12 pkgsrc-2025Q1:1.10.0.4 pkgsrc-2025Q1-base:1.10 pkgsrc-2024Q4:1.10.0.2 pkgsrc-2024Q4-base:1.10 libarchive-3-7-7:1.1.1.12 pkgsrc-2024Q3:1.9.0.6 pkgsrc-2024Q3-base:1.9 libarchive-3-7-5:1.1.1.11 pkgsrc-2024Q2:1.9.0.4 pkgsrc-2024Q2-base:1.9 libarchive-3-7-4:1.1.1.11 libarchive-3-7-3:1.1.1.11 pkgsrc-2024Q1:1.9.0.2 pkgsrc-2024Q1-base:1.9 libarchive-3-7-2:1.1.1.11 pkgsrc-2023Q4:1.8.0.30 pkgsrc-2023Q4-base:1.8 pkgsrc-2023Q3:1.8.0.28 pkgsrc-2023Q3-base:1.8 pkgsrc-2023Q2:1.8.0.26 pkgsrc-2023Q2-base:1.8 pkgsrc-2023Q1:1.8.0.24 pkgsrc-2023Q1-base:1.8 pkgsrc-2022Q4:1.8.0.22 pkgsrc-2022Q4-base:1.8 pkgsrc-2022Q3:1.8.0.20 pkgsrc-2022Q3-base:1.8 pkgsrc-2022Q2:1.8.0.18 pkgsrc-2022Q2-base:1.8 pkgsrc-2022Q1:1.8.0.16 pkgsrc-2022Q1-base:1.8 pkgsrc-2021Q4:1.8.0.14 pkgsrc-2021Q4-base:1.8 pkgsrc-2021Q3:1.8.0.12 pkgsrc-2021Q3-base:1.8 pkgsrc-2021Q2:1.8.0.10 pkgsrc-2021Q2-base:1.8 pkgsrc-2021Q1:1.8.0.8 pkgsrc-2021Q1-base:1.8 pkgsrc-2020Q4:1.8.0.6 pkgsrc-2020Q4-base:1.8 pkgsrc-2020Q3:1.8.0.4 pkgsrc-2020Q3-base:1.8 pkgsrc-2020Q2:1.8.0.2 pkgsrc-2020Q2-base:1.8 pkgsrc-2020Q1:1.7.0.4 pkgsrc-2020Q1-base:1.7 pkgsrc-2019Q4:1.7.0.6 pkgsrc-2019Q4-base:1.7 pkgsrc-2019Q3:1.7.0.2 pkgsrc-2019Q3-base:1.7 libarchive-3-4-0:1.1.1.10 libarchive-3-3-3:1.1.1.9 pkgsrc-2019Q2:1.6.0.2 pkgsrc-2019Q2-base:1.6 pkgsrc-2019Q1:1.5.0.16 pkgsrc-2019Q1-base:1.5 pkgsrc-2018Q4:1.5.0.14 pkgsrc-2018Q4-base:1.5 pkgsrc-2018Q3:1.5.0.12 pkgsrc-2018Q3-base:1.5 pkgsrc-2018Q2:1.5.0.10 pkgsrc-2018Q2-base:1.5 pkgsrc-2018Q1:1.5.0.8 pkgsrc-2018Q1-base:1.5 pkgsrc-2017Q4:1.5.0.6 pkgsrc-2017Q4-base:1.5 pkgsrc-2017Q3:1.5.0.4 pkgsrc-2017Q3-base:1.5 libarchive-3-3-2:1.1.1.8 pkgsrc-2017Q2:1.4.0.4 pkgsrc-2017Q2-base:1.4 pkgsrc-2017Q1:1.4.0.2 pkgsrc-2017Q1-base:1.4 libarchive-3-3-1:1.1.1.7 pkgsrc-2016Q4:1.3.0.6 pkgsrc-2016Q4-base:1.3 pkgsrc-2016Q3:1.3.0.4 pkgsrc-2016Q3-base:1.3 pkgsrc-2016Q2:1.3.0.2 pkgsrc-2016Q2-base:1.3 libarchive-3-2-1:1.1.1.6 pkgsrc-2016Q1:1.2.0.10 pkgsrc-2016Q1-base:1.2 pkgsrc-2015Q4:1.2.0.8 pkgsrc-2015Q4-base:1.2 pkgsrc-2015Q3:1.2.0.6 pkgsrc-2015Q3-base:1.2 pkgsrc-2015Q2:1.2.0.4 pkgsrc-2015Q2-base:1.2 pkgsrc-2015Q1:1.2.0.2 pkgsrc-2015Q1-base:1.2 pkgsrc-2014Q4:1.1.1.5.0.36 pkgsrc-2014Q4-base:1.1.1.5 pkgsrc-2014Q3:1.1.1.5.0.34 pkgsrc-2014Q3-base:1.1.1.5 pkgsrc-2014Q2:1.1.1.5.0.32 pkgsrc-2014Q2-base:1.1.1.5 pkgsrc-2014Q1:1.1.1.5.0.30 pkgsrc-2014Q1-base:1.1.1.5 pkgsrc-2013Q4:1.1.1.5.0.28 pkgsrc-2013Q4-base:1.1.1.5 pkgsrc-2013Q3:1.1.1.5.0.26 pkgsrc-2013Q3-base:1.1.1.5 pkgsrc-2013Q2:1.1.1.5.0.24 pkgsrc-2013Q2-base:1.1.1.5 pkgsrc-2013Q1:1.1.1.5.0.22 pkgsrc-2013Q1-base:1.1.1.5 pkgsrc-2012Q4:1.1.1.5.0.20 pkgsrc-2012Q4-base:1.1.1.5 pkgsrc-2012Q3:1.1.1.5.0.18 pkgsrc-2012Q3-base:1.1.1.5 pkgsrc-2012Q2:1.1.1.5.0.16 pkgsrc-2012Q2-base:1.1.1.5 pkgsrc-2012Q1:1.1.1.5.0.14 pkgsrc-2012Q1-base:1.1.1.5 pkgsrc-2011Q4:1.1.1.5.0.12 pkgsrc-2011Q4-base:1.1.1.5 pkgsrc-2011Q3:1.1.1.5.0.10 pkgsrc-2011Q3-base:1.1.1.5 pkgsrc-2011Q2:1.1.1.5.0.8 pkgsrc-2011Q2-base:1.1.1.5 pkgsrc-2011Q1:1.1.1.5.0.6 pkgsrc-2011Q1-base:1.1.1.5 pkgsrc-2010Q4:1.1.1.5.0.4 pkgsrc-2010Q4-base:1.1.1.5 pkgsrc-2010Q3:1.1.1.5.0.2 pkgsrc-2010Q3-base:1.1.1.5 libarchive-2-8-4:1.1.1.5 pkgsrc-2010Q2:1.1.1.4.0.4 pkgsrc-2010Q2-base:1.1.1.4 pkgsrc-2010Q1:1.1.1.4.0.2 pkgsrc-2010Q1-base:1.1.1.4 libarchive-2-8-3:1.1.1.4 libarchive-2-8-2:1.1.1.3 libarchive-2-8-0:1.1.1.2 pkgsrc-2009Q4:1.1.1.1.0.22 pkgsrc-2009Q4-base:1.1.1.1 pkgsrc-2009Q3:1.1.1.1.0.20 pkgsrc-2009Q3-base:1.1.1.1 pkgsrc-2009Q2:1.1.1.1.0.18 pkgsrc-2009Q2-base:1.1.1.1 pkgsrc-2009Q1:1.1.1.1.0.16 pkgsrc-2009Q1-base:1.1.1.1 pkgsrc-2008Q4:1.1.1.1.0.14 pkgsrc-2008Q4-base:1.1.1.1 pkgsrc-2008Q3:1.1.1.1.0.12 pkgsrc-2008Q3-base:1.1.1.1 cube-native-xorg:1.1.1.1.0.10 cube-native-xorg-base:1.1.1.1 pkgsrc-2008Q2:1.1.1.1.0.8 pkgsrc-2008Q2-base:1.1.1.1 cwrapper:1.1.1.1.0.6 pkgsrc-2008Q1:1.1.1.1.0.4 pkgsrc-2008Q1-base:1.1.1.1 pkgsrc-2007Q4:1.1.1.1.0.2 pkgsrc-2007Q4-base:1.1.1.1 libarchive-2-4-0:1.1.1.1 KIENTZLE:1.1.1; locks; strict; comment @# @; 1.10 date 2024.10.19.05.39.57; author adam; state Exp; branches; next 1.9; commitid fYRSlpIWMYluweuF; 1.9 date 2024.01.18.18.00.16; author adam; state Exp; branches; next 1.8; commitid hNXpsHx3SuHqsXUE; 1.8 date 2020.05.26.09.16.41; author nia; state Exp; branches; next 1.7; commitid nNhsdZACz3PjmJ9C; 1.7 date 2019.09.22.09.55.08; author joerg; state Exp; branches; next 1.6; commitid FdPvRjF4OzwBwZDB; 1.6 date 2019.04.10.08.24.05; author adam; state Exp; branches; next 1.5; commitid LnliQ9ieqYkikMiB; 1.5 date 2017.08.01.22.26.23; author joerg; state Exp; branches; next 1.4; commitid 32clTfkmVE8bPy1A; 1.4 date 2017.02.25.21.11.19; author joerg; state Exp; branches; next 1.3; commitid rW8QfCWrsCO1snHz; 1.3 date 2016.06.20.17.24.57; author joerg; state Exp; branches; next 1.2; commitid ArUvympBjfBseebz; 1.2 date 2015.01.17.12.44.49; author adam; state Exp; branches; next 1.1; commitid yy7e1hLrfmA2pn6y; 1.1 date 2007.11.30.21.25.33; author joerg; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2007.11.30.21.25.33; author joerg; state Exp; branches; next 1.1.1.2; 1.1.1.2 date 2010.02.20.03.50.03; author joerg; state Exp; branches; next 1.1.1.3; 1.1.1.3 date 2010.03.14.17.57.21; author joerg; state Exp; branches; next 1.1.1.4; 1.1.1.4 date 2010.03.16.17.07.33; author joerg; state Exp; branches; next 1.1.1.5; 1.1.1.5 date 2010.07.09.11.53.32; author joerg; state Exp; branches; next 1.1.1.6; 1.1.1.6 date 2016.06.20.17.12.01; author joerg; state Exp; branches; next 1.1.1.7; commitid rRgm3BqbmbI8aebz; 1.1.1.7 date 2017.02.25.20.54.12; author joerg; state Exp; branches; next 1.1.1.8; commitid ReqPI0ibLYjdmnHz; 1.1.1.8 date 2017.08.01.22.21.12; author joerg; state Exp; branches; next 1.1.1.9; commitid XQwPAFJku336Ny1A; 1.1.1.9 date 2019.09.22.09.47.03; author joerg; state Exp; branches; next 1.1.1.10; commitid N0KxAXOYyULduZDB; 1.1.1.10 date 2019.09.22.09.51.33; author joerg; state Exp; branches; next 1.1.1.11; commitid 5kDbfPbiV3INvZDB; 1.1.1.11 date 2024.01.18.17.37.46; author adam; state Exp; branches; next 1.1.1.12; commitid zDULEPUODGjTkXUE; 1.1.1.12 date 2024.10.19.05.27.34; author adam; state Exp; branches; next ; commitid v1iXM4j1Na52seuF; desc @@ 1.10 log @libarchive: updated to 3.7.7 Libarchive 3.7.7 is a bugfix and security release Security fixes: gzip: prevent a hang when processing a malformed gzip inside a gzip tar: don't crash on truncated tar archives tar: fix two leaks in tar header parsing Important bugfixes: 7-zip: read/write symlink paths as UTF-8 cpio: exit with an error code if an entry could not be extracted rar5: report encrypted entries tar: fix truncation of entry pathnames in specific archives windows: fix ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS Libarchive 3.7.6 is a bugfix and security release. This release fixes a tar regression introduced in libarchive 3.7.5 Important bugfixes. tar: clean up linkpath between entries tar: fix memory leaks when processing symlinks or parsing pax headers iso: be more cautious about parsing ISO-9660 timestamps @ text @4mARCHIVE_WRITE24m(3) Library Functions Manual 4mARCHIVE_WRITE24m(3) 1mNAME0m archive_write — functions for creating archives 1mLIBRARY0m Streaming Archive Library (libarchive, -larchive) 1mSYNOPSIS0m 1m#include 0m 1mDESCRIPTION0m These functions provide a complete API for creating streaming archive files. The general process is to first create the struct archive ob‐ ject, set any desired options, initialize the archive, append entries, then close the archive and release all resources. 1mCreate archive object0m See 4marchive_write_new24m(3). To write an archive, you must first obtain an initialized struct archive object from 1marchive_write_new22m(). 1mEnable filters and formats, configure block size and padding0m See 4marchive_write_filter24m(3), 4marchive_write_format24m(3) and 4marchive_write_blocksize24m(3). You can then modify this object for the desired operations with the various 1marchive_write_set_XXX22m() functions. In particular, you will need to invoke appropriate 1marchive_write_add_XXX22m() and 1marchive_write_set_XXX22m() functions to enable the corresponding compres‐ sion and format support. 1mSet options0m See 4marchive_write_set_options24m(3). 1mOpen archive0m See 4marchive_write_open24m(3). Once you have prepared the struct archive object, you call 1marchive_write_open22m() to actually open the archive and prepare it for writing. There are several variants of this function; the most basic expects you to provide pointers to several functions that can provide blocks of bytes from the archive. There are convenience forms that al‐ low you to specify a filename, file descriptor, 4mFILE24m 4m*24m object, or a block of memory from which to write the archive data. 1mProduce archive0m See 4marchive_write_header24m(3) and 4marchive_write_data24m(3). Individual archive entries are written in a three-step process: You first initialize a struct archive_entry structure with information about the new entry. At a minimum, you should set the pathname of the entry and provide a 4mstruct24m 4mstat24m with a valid 4mst_mode24m field, which spec‐ ifies the type of object and 4mst_size24m field, which specifies the size of the data portion of the object. 1mRelease resources0m See 4marchive_write_free24m(3). After all entries have been written, use the 1marchive_write_free22m() func‐ tion to release all resources. 1mEXAMPLES0m The following sketch illustrates basic usage of the library. In this example, the callback functions are simply wrappers around the standard 4mopen24m(2), 4mwrite24m(2), and 4mclose24m(2) system calls. #ifdef __linux__ #define _FILE_OFFSET_BITS 64 #endif #include #include #include #include #include #include struct mydata { const char *name; int fd; }; int myopen(struct archive *a, void *client_data) { struct mydata *mydata = client_data; mydata->fd = open(mydata->name, O_WRONLY | O_CREAT, 0644); if (mydata->fd >= 0) return (ARCHIVE_OK); else return (ARCHIVE_FATAL); } la_ssize_t mywrite(struct archive *a, void *client_data, const void *buff, size_t n) { struct mydata *mydata = client_data; return (write(mydata->fd, buff, n)); } int myclose(struct archive *a, void *client_data) { struct mydata *mydata = client_data; if (mydata->fd > 0) close(mydata->fd); return (0); } void write_archive(const char *outname, const char **filename) { struct mydata *mydata = malloc(sizeof(struct mydata)); struct archive *a; struct archive_entry *entry; struct stat st; char buff[8192]; int len; int fd; a = archive_write_new(); mydata->name = outname; /* Set archive format and filter according to output file extension. * If it fails, set default format. Platform depended function. * See supported formats in archive_write_set_format_filter_by_ext.c */ if (archive_write_set_format_filter_by_ext(a, outname) != ARCHIVE_OK) { archive_write_add_filter_gzip(a); archive_write_set_format_ustar(a); } archive_write_open(a, mydata, myopen, mywrite, myclose); while (*filename) { stat(*filename, &st); entry = archive_entry_new(); archive_entry_copy_stat(entry, &st); archive_entry_set_pathname(entry, *filename); archive_write_header(a, entry); if ((fd = open(*filename, O_RDONLY)) != -1) { len = read(fd, buff, sizeof(buff)); while (len > 0) { archive_write_data(a, buff, len); len = read(fd, buff, sizeof(buff)); } close(fd); } archive_entry_free(entry); filename++; } archive_write_free(a); } int main(int argc, const char **argv) { const char *outname; argv++; outname = *argv++; write_archive(outname, argv); return 0; } 1mSEE ALSO0m 4mtar24m(1), 4marchive_write_set_options24m(3), 4mlibarchive24m(3), 4mcpio24m(5), 4mmtree24m(5), 4mtar24m(5) 1mHISTORY0m The 1mlibarchive 22mlibrary first appeared in FreeBSD 5.3. 1mAUTHORS0m The 1mlibarchive 22mlibrary was written by Tim Kientzle . 1mBUGS0m There are many peculiar bugs in historic tar implementations that may cause certain programs to reject archives written by this library. For example, several historic implementations calculated header checksums incorrectly and will thus reject valid archives; GNU tar does not fully support pax interchange format; some old tar implementations required specific field terminations. The default pax interchange format eliminates most of the historic tar limitations and provides a generic key/value attribute facility for vendor-defined extensions. One oversight in POSIX is the failure to provide a standard attribute for large device numbers. This library uses “SCHILY.devminor” and “SCHILY.devmajor” for device numbers that exceed the range supported by the backwards-compatible ustar header. These keys are compatible with Joerg Schilling's 1mstar 22marchiver. Other implementations may not recognize these keys and will thus be unable to correctly restore device nodes with large device numbers from archives created by this library. Debian February 2, 2012 4mARCHIVE_WRITE24m(3) @ 1.9 log @libarchive: updated to 3.7.2 Libarchive 3.7.2 is a security, bugfix and feature release. Security fixes: Multiple vulnerabilities have been fixed in the PAX writer (1b4e0d0) Important bugfixes: bsdunzip(1) now correctly handles arguments following an -x after the zipfile New features: bsdunzip(1) now supports the "--version" flag 7-zip reader now translates Windows permissions into UNIX permissions uudecode filter in raw mode now supports file name and file mode zstd filter now supports the "long" write option Libarchive 3.7.1 is a security, feature and bugfix release. Security fixes: SEGV and stack buffer overflow in verbose mode of cpio Feature updates: bsdunzip updated to match latest upstream code Important bugfixes: miscellaneous functional bugfixes build fixes on multiple platforms Libarchive 3.7.0 is a feature and bugfix release. New features: bsdunzip: new tool ported from FreeBSD drop-in replacement for Info-ZIP unzip, not yet ported for Windows 7zip reader: support for Zstandard compression 7zip reader: support for ARM64 filter zstd filter: support for multi-frame zstd archives Other notable bugfixes and improvements: pax: fix year 2038 problem on platforms with 64-bit time_t Windows: Universal Windows Platform (UWP) fixes and improvements Windows: bcrypt usage fixes and improvements Windows: time function usage fixes and improvements @ text @d1 1 a1 1 ARCHIVE_WRITE(3) BSD Library Functions Manual ARCHIVE_WRITE(3) d3 2 a4 2 NAME archive_write — functions for creating archives d6 2 a7 2 LIBRARY Streaming Archive Library (libarchive, -larchive) d9 85 a93 123 SYNOPSIS #include DESCRIPTION These functions provide a complete API for creating streaming archive files. The general process is to first create the struct archive object, set any desired options, initialize the archive, append entries, then close the archive and release all resources. Create archive object See archive_write_new(3). To write an archive, you must first obtain an initialized struct archive object from archive_write_new(). Enable filters and formats, configure block size and padding See archive_write_filter(3), archive_write_format(3) and archive_write_blocksize(3). You can then modify this object for the desired operations with the vari‐ ous archive_write_set_XXX() functions. In particular, you will need to invoke appropriate archive_write_add_XXX() and archive_write_set_XXX() functions to enable the corresponding compression and format support. Set options See archive_write_set_options(3). Open archive See archive_write_open(3). Once you have prepared the struct archive object, you call archive_write_open() to actually open the archive and prepare it for writing. There are several variants of this function; the most basic ex‐ pects you to provide pointers to several functions that can provide blocks of bytes from the archive. There are convenience forms that allow you to specify a filename, file descriptor, FILE * object, or a block of memory from which to write the archive data. Produce archive See archive_write_header(3) and archive_write_data(3). Individual archive entries are written in a three-step process: You first initialize a struct archive_entry structure with information about the new entry. At a minimum, you should set the pathname of the entry and provide a struct stat with a valid st_mode field, which specifies the type of object and st_size field, which specifies the size of the data portion of the object. Release resources See archive_write_free(3). After all entries have been written, use the archive_write_free() func‐ tion to release all resources. EXAMPLES The following sketch illustrates basic usage of the library. In this ex‐ ample, the callback functions are simply wrappers around the standard open(2), write(2), and close(2) system calls. #ifdef __linux__ #define _FILE_OFFSET_BITS 64 #endif #include #include #include #include #include #include struct mydata { const char *name; int fd; }; int myopen(struct archive *a, void *client_data) { struct mydata *mydata = client_data; mydata->fd = open(mydata->name, O_WRONLY | O_CREAT, 0644); if (mydata->fd >= 0) return (ARCHIVE_OK); else return (ARCHIVE_FATAL); } la_ssize_t mywrite(struct archive *a, void *client_data, const void *buff, size_t n) { struct mydata *mydata = client_data; return (write(mydata->fd, buff, n)); } int myclose(struct archive *a, void *client_data) { struct mydata *mydata = client_data; if (mydata->fd > 0) close(mydata->fd); return (0); } void write_archive(const char *outname, const char **filename) { struct mydata *mydata = malloc(sizeof(struct mydata)); struct archive *a; struct archive_entry *entry; struct stat st; char buff[8192]; int len; int fd; a = archive_write_new(); mydata->name = outname; /* Set archive format and filter according to output file extension. * If it fails, set default format. Platform depended function. * See supported formats in archive_write_set_format_filter_by_ext.c */ if (archive_write_set_format_filter_by_ext(a, outname) != ARCHIVE_OK) { archive_write_add_filter_gzip(a); archive_write_set_format_ustar(a); d95 47 a141 11 archive_write_open(a, mydata, myopen, mywrite, myclose); while (*filename) { stat(*filename, &st); entry = archive_entry_new(); archive_entry_copy_stat(entry, &st); archive_entry_set_pathname(entry, *filename); archive_write_header(a, entry); if ((fd = open(*filename, O_RDONLY)) != -1) { len = read(fd, buff, sizeof(buff)); while (len > 0) { archive_write_data(a, buff, len); d143 5 d149 2 a150 1 close(fd); d152 10 a161 2 archive_entry_free(entry); filename++; a162 2 archive_write_free(a); } d164 28 a191 37 int main(int argc, const char **argv) { const char *outname; argv++; outname = *argv++; write_archive(outname, argv); return 0; } SEE ALSO tar(1), archive_write_set_options(3), libarchive(3), cpio(5), mtree(5), tar(5) HISTORY The libarchive library first appeared in FreeBSD 5.3. AUTHORS The libarchive library was written by Tim Kientzle . BUGS There are many peculiar bugs in historic tar implementations that may cause certain programs to reject archives written by this library. For example, several historic implementations calculated header checksums in‐ correctly and will thus reject valid archives; GNU tar does not fully support pax interchange format; some old tar implementations required specific field terminations. The default pax interchange format eliminates most of the historic tar limitations and provides a generic key/value attribute facility for ven‐ dor-defined extensions. One oversight in POSIX is the failure to provide a standard attribute for large device numbers. This library uses “SCHILY.devminor” and “SCHILY.devmajor” for device numbers that exceed the range supported by the backwards-compatible ustar header. These keys are compatible with Joerg Schilling's star archiver. Other implementa‐ tions may not recognize these keys and will thus be unable to correctly restore device nodes with large device numbers from archives created by this library. d193 1 a193 1 BSD February 2, 2012 BSD @ 1.8 log @libarchive: Update to 3.4.3 Libarchive 3.4.3 is a feature and bugfix release. New features: support for pzstd compressed files (#1357) support for RHT.security.selinux tar extended attribute (#1348) Important bugfixes: various zstd fixes and improvements (#1342 #1352 #1359) child process handling fixes (#1372) Libarchive 3.4.2 is a feature and security release. New features: support for atomic file extraction (bsdtar -x --safe-writes) (#1289) support for mbed TLS (PolarSSL) (#1301) Important bugfixes: security fixes in RAR5 reader (#1280 #1326) compression buffer fix in XAR writer (#1317) fix uname and gname longer than 32 characters in PAX writer (#1319) fix segfault when archiving hard links in ISO9660 and XAR writers (#1325) fix support for extracting 7z archive entries with Delta filter (#987) Libarchive 3.4.1 is a feature and security release. New features: Unicode filename support for reading lha/lzh archives New pax write option "xattrhdr" Important bugfixes: security fixes in wide string processing (#1276 #1298) security fixes in RAR5 reader (#1212 #1217 #1296) security fixes and optimizations to write filter logic (#351) security fix related to use of readlink(2) (1dae5a5) sparse file handling fixes (#1218 #1260) Thanks to all contributors and bug reporters. Special thanks to Christos Zoulas (@@zoulasc) from NetBSD for the atomic file extraction feature. @ text @d4 1 a4 1 archive_write -- functions for creating archives d28 1 a28 1 You can then modify this object for the desired operations with the vari- d41 2 a42 2 writing. There are several variants of this function; the most basic expects you to provide pointers to several functions that can provide d52 1 a52 1 new entry. At a minimum, you should set the pathname of the entry and d60 1 a60 1 After all entries have been written, use the archive_write_free() func- d64 2 a65 2 The following sketch illustrates basic usage of the library. In this example, the callback functions are simply wrappers around the standard d175 3 a177 3 cause certain programs to reject archives written by this library. For example, several historic implementations calculated header checksums incorrectly and will thus reject valid archives; GNU tar does not fully d182 1 a182 1 limitations and provides a generic key/value attribute facility for ven- d185 6 a190 6 ``SCHILY.devminor'' and ``SCHILY.devmajor'' for device numbers that exceed the range supported by the backwards-compatible ustar header. These keys are compatible with Joerg Schilling's star archiver. Other implementations may not recognize these keys and will thus be unable to correctly restore device nodes with large device numbers from archives created by this library. d192 1 a192 1 BSD February 2, 2012 BSD @ 1.7 log @Update for libarchive-3.4.0: - improvements for Android APK and JAR archives - better support for non-recursive list and extract - tar --exclude-vcs support - fixes for file attributes and flags handling - zipx support - rar 5.0 reader @ text @d4 1 a4 1 archive_write — functions for creating archives d28 1 a28 1 You can then modify this object for the desired operations with the vari‐ d41 2 a42 2 writing. There are several variants of this function; the most basic ex‐ pects you to provide pointers to several functions that can provide d60 1 a60 1 After all entries have been written, use the archive_write_free() func‐ d63 3 a65 3 EXAMPLE The following sketch illustrates basic usage of the library. In this ex‐ ample, the callback functions are simply wrappers around the standard d164 1 a164 1 tar(1), libarchive(3), archive_write_set_options(3), cpio(5), mtree(5), d176 2 a177 2 example, several historic implementations calculated header checksums in‐ correctly and will thus reject valid archives; GNU tar does not fully d182 1 a182 1 limitations and provides a generic key/value attribute facility for ven‐ d185 6 a190 6 “SCHILY.devminor” and “SCHILY.devmajor” for device numbers that exceed the range supported by the backwards-compatible ustar header. These keys are compatible with Joerg Schilling's star archiver. Other implementa‐ tions may not recognize these keys and will thus be unable to correctly restore device nodes with large device numbers from archives created by this library. @ 1.6 log @libarchive: updated to 3.3.3 libarchive 3.3.3: Avoid super-linear slowdown on malformed mtree files Many fixes for building with Visual Studio NO_OVERWRITE doesn't change existing directory attributes New support for Zstandard read and write filters @ text @d41 2 a42 2 writing. There are several variants of this function; the most basic expects you to provide pointers to several functions that can provide d64 2 a65 2 The following sketch illustrates basic usage of the library. In this example, the callback functions are simply wrappers around the standard d176 2 a177 2 example, several historic implementations calculated header checksums incorrectly and will thus reject valid archives; GNU tar does not fully @ 1.5 log @Merge for libarchive-3.3.2. @ text @d34 1 a34 1 See archive_read_set_options(3). @ 1.4 log @Merge libarchive-3.3.1. @ text @d3 2 a4 2 1mNAME0m 1marchive_write 22m— functions for creating archives d6 1 a6 1 1mLIBRARY0m d9 2 a10 2 1mSYNOPSIS0m 1m#include 0m d12 1 a12 1 1mDESCRIPTION0m d18 1 a18 1 1mCreate archive object0m d22 1 a22 1 object from 1marchive_write_new22m(). d24 1 a24 1 1mEnable filters and formats, configure block size and padding0m d29 2 a30 2 ous 1marchive_write_set_XXX22m() functions. In particular, you will need to invoke appropriate 1marchive_write_add_XXX22m() and 1marchive_write_set_XXX22m() d33 1 a33 1 1mSet options0m d36 1 a36 1 1mOpen archive0m d40 1 a40 1 1marchive_write_open22m() to actually open the archive and prepare it for d44 1 a44 1 you to specify a filename, file descriptor, 4mFILE24m 4m*24m object, or a block of d47 1 a47 1 1mProduce archive0m d53 2 a54 2 provide a 4mstruct24m 4mstat24m with a valid 4mst_mode24m field, which specifies the type of object and 4mst_size24m field, which specifies the size of the data d57 1 a57 1 1mRelease resources0m d60 1 a60 1 After all entries have been written, use the 1marchive_write_free22m() func‐ d63 1 a63 1 1mEXAMPLE0m d163 1 a163 1 1mSEE ALSO0m d167 2 a168 2 1mHISTORY0m The 1mlibarchive 22mlibrary first appeared in FreeBSD 5.3. d170 2 a171 2 1mAUTHORS0m The 1mlibarchive 22mlibrary was written by Tim Kientzle . d173 1 a173 1 1mBUGS0m d187 1 a187 1 are compatible with Joerg Schilling's 1mstar 22marchiver. Other implementa‐ @ 1.3 log @Update for libarchive 3.2.1. @ text @d3 2 a4 2 NAME archive_write — functions for creating archives d6 1 a6 1 LIBRARY d9 2 a10 2 SYNOPSIS #include d12 1 a12 1 DESCRIPTION d18 1 a18 1 Create archive object d22 1 a22 1 object from archive_write_new(). d24 1 a24 1 Enable filters and formats, configure block size and padding d29 2 a30 2 ous archive_write_set_XXX() functions. In particular, you will need to invoke appropriate archive_write_add_XXX() and archive_write_set_XXX() d33 1 a33 1 Set options d36 1 a36 1 Open archive d40 1 a40 1 archive_write_open() to actually open the archive and prepare it for d44 1 a44 1 you to specify a filename, file descriptor, FILE * object, or a block of d47 1 a47 1 Produce archive d53 2 a54 2 provide a struct stat with a valid st_mode field, which specifies the type of object and st_size field, which specifies the size of the data d57 1 a57 1 Release resources d60 1 a60 1 After all entries have been written, use the archive_write_free() func‐ d63 1 a63 1 EXAMPLE d163 1 a163 1 SEE ALSO d167 2 a168 2 HISTORY The libarchive library first appeared in FreeBSD 5.3. d170 2 a171 2 AUTHORS The libarchive library was written by Tim Kientzle . d173 1 a173 1 BUGS d187 1 a187 1 are compatible with Joerg Schilling's star archiver. Other implementa‐ @ 1.2 log @Changes 3.1.2: This is a maintenance update to fix issues with the new RAR seeking feature. This new release also contains fixes for build failures when building libarchive using Visual Studio 2012 and MinGW. @ text @d95 1 a95 1 ssize_t d126 7 a132 2 archive_write_add_filter_gzip(a); archive_write_set_format_ustar(a); d142 1 a142 1 while ( len > 0 ) { d158 1 a158 1 outname = argv++; d171 1 a171 1 The libarchive library was written by Tim Kientzle ⟨kientzle@@acm.org⟩. @ 1.1 log @Initial revision @ text @d1 1 a1 1 archive_write(3) FreeBSD Library Functions Manual archive_write(3) d4 4 a7 13 archive_write_new, archive_write_set_format_cpio, archive_write_set_format_pax, archive_write_set_format_pax_restricted, archive_write_set_format_shar, archive_write_set_format_shar_binary, archive_write_set_format_ustar, archive_write_get_bytes_per_block, archive_write_set_bytes_per_block, archive_write_set_bytes_in_last_block, archive_write_set_compression_bzip2, archive_write_set_compression_gzip, archive_write_set_compression_none, archive_write_set_compression_program, archive_write_open, archive_write_open_fd, archive_write_open_FILE, archive_write_open_filename, archive_write_open_memory, archive_write_header, archive_write_data, archive_write_finish_entry, archive_write_close, archive_write_finish -- functions for creating ar- chives d12 5 a16 33 struct archive * archive_write_new(void); int archive_write_get_bytes_per_block(struct archive *); int archive_write_set_bytes_per_block(struct archive *, int bytes_per_block); int archive_write_set_bytes_in_last_block(struct archive *, int); int archive_write_set_compression_bzip2(struct archive *); int archive_write_set_compression_gzip(struct archive *); int archive_write_set_compression_none(struct archive *); int archive_write_set_compression_program(struct archive *, const char * cmd); int archive_write_set_format_cpio(struct archive *); int archive_write_set_format_pax(struct archive *); int archive_write_set_format_pax_restricted(struct archive *); d18 2 a19 2 int archive_write_set_format_shar(struct archive *); d21 2 a22 2 int archive_write_set_format_shar_binary(struct archive *); d24 32 a55 2 int archive_write_set_format_ustar(struct archive *); d57 2 a58 4 int archive_write_open(struct archive *, void *client_data, archive_open_callback *, archive_write_callback *, archive_close_callback *); d60 2 a61 209 int archive_write_open_fd(struct archive *, int fd); int archive_write_open_FILE(struct archive *, FILE *file); int archive_write_open_filename(struct archive *, const char *filename); int archive_write_open_memory(struct archive *, void *buffer, size_t bufferSize, size_t *outUsed); int archive_write_header(struct archive *, struct archive_entry *); ssize_t archive_write_data(struct archive *, const void *, size_t); int archive_write_finish_entry(struct archive *); int archive_write_close(struct archive *); int archive_write_finish(struct archive *); DESCRIPTION These functions provide a complete API for creating streaming archive files. The general process is to first create the struct archive object, set any desired options, initialize the archive, append entries, then close the archive and release all resources. The following summary describes the functions in approximately the order they are ordinarily used: archive_write_new() Allocates and initializes a struct archive object suitable for writing a tar archive. archive_write_set_bytes_per_block() Sets the block size used for writing the archive data. Every call to the write callback function, except possibly the last one, will use this value for the length. The third parameter is a boolean that specifies whether or not the final block written will be padded to the full block size. If it is zero, the last block will not be padded. If it is non-zero, padding will be added both before and after compression. The default is to use a block size of 10240 bytes and to pad the last block. Note that a block size of zero will suppress internal blocking and cause writes to be sent directly to the write callback as they occur. archive_write_get_bytes_per_block() Retrieve the block size to be used for writing. A value of -1 here indicates that the library should use default values. A value of zero indicates that internal blocking is suppressed. archive_write_set_bytes_in_last_block() Sets the block size used for writing the last block. If this value is zero, the last block will be padded to the same size as the other blocks. Otherwise, the final block will be padded to a multiple of this size. In particular, setting it to 1 will cause the final block to not be padded. For compressed output, any padding generated by this option is applied only after the com- pression. The uncompressed data is always unpadded. The default is to pad the last block to the full block size (note that archive_write_open_filename() will set this based on the file type). Unlike the other ``set'' functions, this function can be called after the archive is opened. archive_write_get_bytes_in_last_block() Retrieve the currently-set value for last block size. A value of -1 here indicates that the library should use default values. archive_write_set_format_cpio(), archive_write_set_format_pax(), archive_write_set_format_pax_restricted(), archive_write_set_format_shar(), archive_write_set_format_shar_binary(), archive_write_set_format_ustar() Sets the format that will be used for the archive. The library can write POSIX octet-oriented cpio format archives, POSIX-stan- dard ``pax interchange'' format archives, traditional ``shar'' archives, enhanced ``binary'' shar archives that store a variety of file attributes and handle binary files, and POSIX-standard ``ustar'' archives. The pax interchange format is a backwards- compatible tar format that adds key/value attributes to each entry and supports arbitrary filenames, linknames, uids, sizes, etc. ``Restricted pax interchange format'' is the library default; this is the same as pax format, but suppresses the pax extended header for most normal files. In most cases, this will result in ordinary ustar archives. archive_write_set_compression_bzip2(), archive_write_set_compression_gzip(), archive_write_set_compression_none() The resulting archive will be compressed as specified. Note that the compressed output is always properly blocked. archive_write_set_compression_program() The archive will be fed into the specified compression program. The output of that program is blocked and written to the client write callbacks. archive_write_open() Freeze the settings, open the archive, and prepare for writing entries. This is the most generic form of this function, which accepts pointers to three callback functions which will be invoked by the compression layer to write the constructed ar- chive. archive_write_open_fd() A convenience form of archive_write_open() that accepts a file descriptor. The archive_write_open_fd() function is safe for use with tape drives or other block-oriented devices. archive_write_open_FILE() A convenience form of archive_write_open() that accepts a FILE * pointer. Note that archive_write_open_FILE() is not safe for writing to tape drives or other devices that require correct blocking. archive_write_open_file() A deprecated synonym for archive_write_open_filename(). archive_write_open_filename() A convenience form of archive_write_open() that accepts a file- name. A NULL argument indicates that the output should be writ- ten to standard output; an argument of ``-'' will open a file with that name. If you have not invoked archive_write_set_bytes_in_last_block(), then archive_write_open_filename() will adjust the last-block padding depending on the file: it will enable padding when writing to standard output or to a character or block device node, it will disable padding otherwise. You can override this by manually invoking archive_write_set_bytes_in_last_block() before calling archive_write_open(). The archive_write_open_filename() function is safe for use with tape drives or other block-oriented devices. archive_write_open_memory() A convenience form of archive_write_open() that accepts a pointer to a block of memory that will receive the archive. The final size_t * argument points to a variable that will be updated after each write to reflect how much of the buffer is currently in use. You should be careful to ensure that this variable remains allo- cated until after the archive is closed. archive_write_header() Build and write a header using the data in the provided struct archive_entry structure. See archive_entry(3) for information on creating and populating struct archive_entry objects. archive_write_data() Write data corresponding to the header just written. Returns number of bytes written or -1 on error. archive_write_finish_entry() Close out the entry just written. In particular, this writes out the final padding required by some formats. Ordinarily, clients never need to call this, as it is called automatically by archive_write_next_header() and archive_write_close() as needed. archive_write_close() Complete the archive and invoke the close callback. archive_write_finish() Invokes archive_write_close() if it was not invoked manually, then releases all resources. Note that this function was declared to return void in libarchive 1.x, which made it impossi- ble to detect errors when archive_write_close() was invoked implicitly from this function. This is corrected beginning with libarchive 2.0. More information about the struct archive object and the overall design of the library can be found in the libarchive(3) overview. IMPLEMENTATION Compression support is built-in to libarchive, which uses zlib and bzlib to handle gzip and bzip2 compression, respectively. CLIENT CALLBACKS To use this library, you will need to define and register callback func- tions that will be invoked to write data to the resulting archive. These functions are registered by calling archive_write_open(): typedef int archive_open_callback(struct archive *, void *client_data) The open callback is invoked by archive_write_open(). It should return ARCHIVE_OK if the underlying file or data source is successfully opened. If the open fails, it should call archive_set_error() to register an error code and message and return ARCHIVE_FATAL. typedef ssize_t archive_write_callback(struct archive *, void *client_data, void *buffer, size_t length) The write callback is invoked whenever the library needs to write raw bytes to the archive. For correct blocking, each call to the write call- back function should translate into a single write(2) system call. This is especially critical when writing archives to tape drives. On success, the write callback should return the number of bytes actually written. On error, the callback should invoke archive_set_error() to register an error code and message and return -1. typedef int archive_close_callback(struct archive *, void *client_data) The close callback is invoked by archive_close when the archive process- ing is complete. The callback should return ARCHIVE_OK on success. On failure, the callback should invoke archive_set_error() to register an error code and message and return ARCHIVE_FATAL. d68 3 d79 2 a80 2 const char *name; int fd; d96 1 a96 1 mywrite(struct archive *a, void *client_data, void *buff, size_t n) d126 1 a126 1 archive_write_set_compression_gzip(a); d135 3 a137 3 fd = open(*filename, O_RDONLY); len = read(fd, buff, sizeof(buff)); while ( len > 0 ) { d140 2 d146 1 a146 1 archive_write_finish(a); d151 5 a155 5 const char *outname; argv++; outname = argv++; write_archive(outname, argv); return 0; a157 23 RETURN VALUES Most functions return ARCHIVE_OK (zero) on success, or one of several non-zero error codes for errors. Specific error codes include: ARCHIVE_RETRY for operations that might succeed if retried, ARCHIVE_WARN for unusual conditions that do not prevent further operations, and ARCHIVE_FATAL for serious errors that make remaining operations impossi- ble. The archive_errno() and archive_error_string() functions can be used to retrieve an appropriate error code and a textual error message. archive_write_new() returns a pointer to a newly-allocated struct archive object. archive_write_data() returns a count of the number of bytes actually written. On error, -1 is returned and the archive_errno() and archive_error_string() functions will return appropriate values. Note that if the client-provided write callback function returns a non-zero value, that error will be propagated back to the caller through whatever API function resulted in that call, which may include archive_write_header(), archive_write_data(), archive_write_close(), or archive_write_finish(). The client callback can call archive_set_error() to provide values that can then be retrieved by archive_errno() and archive_error_string(). d159 2 a160 1 tar(1), libarchive(3), tar(5) d166 1 a166 1 The libarchive library was written by Tim Kientzle . d177 1 a177 1 limitations and provides a generic key/value attribute facility for ven- d180 6 a185 6 ``SCHILY.devminor'' and ``SCHILY.devmajor'' for device numbers that exceed the range supported by the backwards-compatible ustar header. These keys are compatible with Joerg Schilling's star archiver. Other implementations may not recognize these keys and will thus be unable to correctly restore device nodes with large device numbers from archives created by this library. d187 1 a187 1 FreeBSD 6.0 August 19, 2006 FreeBSD 6.0 @ 1.1.1.1 log @Import libarchive-2.4.0 @ text @@ 1.1.1.2 log @Import libarchive 2.8.0: - Infrastructure: - Allow command line tools as fallback for missing compression libraries. If compiled without gzip for example, gunzip will be used automatically. - Improved support for a number of platforms like high-resolution timestamps and Extended Attributes on various Unix systems - New convience interface for creating archives based on disk content, complement of the archive_write_disk interface. - Frontends: - bsdcpio ready for public consumption - hand-written date parser replaces the yacc code - Filter system: - Simplified read filter chains - Option support for filters - LZMA, XZ, uudecode handled - Format support: - Write support for mtree files based on file system or archive content - Basic read support for Joliet - Write support for zip files - Write support for shar archives, both text-only and binary-safe @ text @d9 8 a16 10 archive_write_set_compression_bzip2, archive_write_set_compression_compress, archive_write_set_compression_gzip, archive_write_set_compression_none, archive_write_set_compression_program, archive_write_set_compressor_options, archive_write_set_format_options, archive_write_set_options, archive_write_open, archive_write_open_fd, archive_write_open_FILE, archive_write_open_filename, archive_write_open_memory, archive_write_header, archive_write_data, archive_write_finish_entry, archive_write_close, archive_write_finish -- functions for creating archives a36 3 archive_write_set_compression_compress(struct archive *); int a64 9 archive_write_set_format_options(struct archive *, const char *); int archive_write_set_compressor_options(struct archive *, const char *); int archive_write_set_options(struct archive *, const char *); int a161 1 archive_write_set_compression_compress(), a171 48 archive_write_set_compressor_options(), archive_write_set_format_options(), archive_write_set_options() Specifies options that will be passed to the currently-enabled compressor and/or format writer. The argument is a comma-sepa- rated list of individual options. Individual options have one of the following forms: option=value The option/value pair will be provided to every module. Modules that do not accept an option with this name will ignore it. option The option will be provided to every module with a value of ``1''. !option The option will be provided to every module with a NULL value. module:option=value, module:option, module:!option As above, but the corresponding option and value will be provided only to modules whose name matches module. The return value will be ARCHIVE_OK if any module accepts the option, or ARCHIVE_WARN if no module accepted the option, or ARCHIVE_FATAL if there was a fatal error while attempting to process the option. The currently supported options are: Compressor gzip compression-level The value is interpreted as a decimal integer specifying the gzip compression level. Compressor xz compression-level The value is interpreted as a decimal integer specifying the compression level. Format mtree cksum, device, flags, gid, gname, indent, link, md5, mode, nlink, rmd160, sha1, sha256, sha384, sha512, size, time, uid, uname Enable a particular keyword in the mtree output. Prefix with an exclamation mark to disable the corresponding keyword. The default is equivalent to ``device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname''. all Enables all of the above keywords. use-set Enables generation of /set lines that specify default values for the following files and/or directories. indent XXX needs explanation XXX d260 2 a261 2 typedef ssize_t archive_write_callback(struct archive *, void *client_data, const void *buffer, size_t length) a283 3 #ifdef __linux__ #define _FILE_OFFSET_BITS 64 #endif d309 1 a309 1 mywrite(struct archive *a, void *client_data, const void *buff, size_t n) d420 1 a420 1 FreeBSD 8.0 May 11, 2008 FreeBSD 8.0 @ 1.1.1.3 log @libarchive-2.8.2: - Fix NULL deference for short self-extracting zip archives - Don't dereference symlinks on Linux when reading ACLs - Better detection of SHA2 support for old OpenSSL versions - Fix parsing of input files for bsdtar -T - Do not leak setup_xattr into the global namespace - Fix build when an older libarchive is already installed - Use O_BINARY opening files in bsdtar - Include missing archive_crc32.h - Correctly include iconv.h required by libxml2 @ text @d1 1 a1 1 archive_write(3) NetBSD Library Functions Manual archive_write(3) d137 1 a137 1 here indicates that the library should use default values. A d162 1 a162 1 Sets the format that will be used for the archive. The library d265 1 a265 1 disable padding otherwise. You can override this by manually d312 1 a312 1 tions that will be invoked to write data to the resulting archive. These d328 1 a328 1 back function should translate into a single write(2) system call. This d469 1 a469 1 cause certain programs to reject archives written by this library. For d486 1 a486 1 NetBSD 5.0 May 11, 2008 NetBSD 5.0 @ 1.1.1.4 log @libarchive-2.8.3: Build fix for Linux @ text @d1 1 a1 1 archive_write(3) FreeBSD Library Functions Manual archive_write(3) d137 1 a137 1 here indicates that the library should use default values. A d162 1 a162 1 Sets the format that will be used for the archive. The library d265 1 a265 1 disable padding otherwise. You can override this by manually d312 1 a312 1 tions that will be invoked to write data to the resulting archive. These d328 1 a328 1 back function should translate into a single write(2) system call. This d469 1 a469 1 cause certain programs to reject archives written by this library. For d486 1 a486 1 FreeBSD 9.0 May 11, 2008 FreeBSD 9.0 @ 1.1.1.5 log @Import libarchive-2.8.4: - Improved reliability of hash function detection - Fix issues on ancient FreeBSD, QNX, ancient NetBSD and Minix @ text @d1 1 a1 1 archive_write(3) NetBSD Library Functions Manual archive_write(3) d137 1 a137 1 here indicates that the library should use default values. A d162 1 a162 1 Sets the format that will be used for the archive. The library d265 1 a265 1 disable padding otherwise. You can override this by manually d312 1 a312 1 tions that will be invoked to write data to the resulting archive. These d328 1 a328 1 back function should translate into a single write(2) system call. This d469 1 a469 1 cause certain programs to reject archives written by this library. For d486 1 a486 1 NetBSD 5.0 May 11, 2008 NetBSD 5.0 @ 1.1.1.6 log @Import libarchive-3.2.1: - security fixes and other bugfixes - support for multhreading in xz 5.2+ @ text @d1 1 a1 1 ARCHIVE_WRITE(3) BSD Library Functions Manual ARCHIVE_WRITE(3) d4 15 a18 4 archive_write — functions for creating archives LIBRARY Streaming Archive Library (libarchive, -larchive) d23 75 a97 5 DESCRIPTION These functions provide a complete API for creating streaming archive files. The general process is to first create the struct archive object, set any desired options, initialize the archive, append entries, then close the archive and release all resources. d99 2 a100 2 Create archive object See archive_write_new(3). d102 2 a103 2 To write an archive, you must first obtain an initialized struct archive object from archive_write_new(). d105 2 a106 32 Enable filters and formats, configure block size and padding See archive_write_filter(3), archive_write_format(3) and archive_write_blocksize(3). You can then modify this object for the desired operations with the vari‐ ous archive_write_set_XXX() functions. In particular, you will need to invoke appropriate archive_write_add_XXX() and archive_write_set_XXX() functions to enable the corresponding compression and format support. Set options See archive_read_set_options(3). Open archive See archive_write_open(3). Once you have prepared the struct archive object, you call archive_write_open() to actually open the archive and prepare it for writing. There are several variants of this function; the most basic expects you to provide pointers to several functions that can provide blocks of bytes from the archive. There are convenience forms that allow you to specify a filename, file descriptor, FILE * object, or a block of memory from which to write the archive data. Produce archive See archive_write_header(3) and archive_write_data(3). Individual archive entries are written in a three-step process: You first initialize a struct archive_entry structure with information about the new entry. At a minimum, you should set the pathname of the entry and provide a struct stat with a valid st_mode field, which specifies the type of object and st_size field, which specifies the size of the data portion of the object. d108 2 a109 2 Release resources See archive_write_free(3). d111 230 a340 2 After all entries have been written, use the archive_write_free() func‐ tion to release all resources. d358 2 a359 2 const char *name; int fd; d374 1 a374 1 la_ssize_t d405 2 a406 7 /* Set archive format and filter according to output file extension. * If it fails, set default format. Platform depended function. * See supported formats in archive_write_set_format_filter_by_ext.c */ if (archive_write_set_format_filter_by_ext(a, outname) != ARCHIVE_OK) { archive_write_add_filter_gzip(a); archive_write_set_format_ustar(a); } d414 3 a416 3 if ((fd = open(*filename, O_RDONLY)) != -1) { len = read(fd, buff, sizeof(buff)); while (len > 0) { a418 2 } close(fd); d423 1 a423 1 archive_write_free(a); d428 5 a432 5 const char *outname; argv++; outname = *argv++; write_archive(outname, argv); return 0; d435 23 d459 1 a459 2 tar(1), libarchive(3), archive_write_set_options(3), cpio(5), mtree(5), tar(5) d469 1 a469 1 cause certain programs to reject archives written by this library. For d476 1 a476 1 limitations and provides a generic key/value attribute facility for ven‐ d479 6 a484 6 “SCHILY.devminor” and “SCHILY.devmajor” for device numbers that exceed the range supported by the backwards-compatible ustar header. These keys are compatible with Joerg Schilling's star archiver. Other implementa‐ tions may not recognize these keys and will thus be unable to correctly restore device nodes with large device numbers from archives created by this library. d486 1 a486 1 BSD February 2, 2012 BSD @ 1.1.1.7 log @Import libarchive-3.3.1. @ text @d3 2 a4 2 1mNAME0m 1marchive_write 22m— functions for creating archives d6 1 a6 1 1mLIBRARY0m d9 2 a10 2 1mSYNOPSIS0m 1m#include 0m d12 1 a12 1 1mDESCRIPTION0m d18 1 a18 1 1mCreate archive object0m d22 1 a22 1 object from 1marchive_write_new22m(). d24 1 a24 1 1mEnable filters and formats, configure block size and padding0m d29 2 a30 2 ous 1marchive_write_set_XXX22m() functions. In particular, you will need to invoke appropriate 1marchive_write_add_XXX22m() and 1marchive_write_set_XXX22m() d33 1 a33 1 1mSet options0m d36 1 a36 1 1mOpen archive0m d40 1 a40 1 1marchive_write_open22m() to actually open the archive and prepare it for d44 1 a44 1 you to specify a filename, file descriptor, 4mFILE24m 4m*24m object, or a block of d47 1 a47 1 1mProduce archive0m d53 2 a54 2 provide a 4mstruct24m 4mstat24m with a valid 4mst_mode24m field, which specifies the type of object and 4mst_size24m field, which specifies the size of the data d57 1 a57 1 1mRelease resources0m d60 1 a60 1 After all entries have been written, use the 1marchive_write_free22m() func‐ d63 1 a63 1 1mEXAMPLE0m d163 1 a163 1 1mSEE ALSO0m d167 2 a168 2 1mHISTORY0m The 1mlibarchive 22mlibrary first appeared in FreeBSD 5.3. d170 2 a171 2 1mAUTHORS0m The 1mlibarchive 22mlibrary was written by Tim Kientzle . d173 1 a173 1 1mBUGS0m d187 1 a187 1 are compatible with Joerg Schilling's 1mstar 22marchiver. Other implementa‐ @ 1.1.1.8 log @Import libarchive-3.3.2 + 9de5f3 + f9dacbf: - Support NFS4 ACLs on Linux - Bugfixes @ text @d3 2 a4 2 NAME archive_write — functions for creating archives d6 1 a6 1 LIBRARY d9 2 a10 2 SYNOPSIS #include d12 1 a12 1 DESCRIPTION d18 1 a18 1 Create archive object d22 1 a22 1 object from archive_write_new(). d24 1 a24 1 Enable filters and formats, configure block size and padding d29 2 a30 2 ous archive_write_set_XXX() functions. In particular, you will need to invoke appropriate archive_write_add_XXX() and archive_write_set_XXX() d33 1 a33 1 Set options d36 1 a36 1 Open archive d40 1 a40 1 archive_write_open() to actually open the archive and prepare it for d44 1 a44 1 you to specify a filename, file descriptor, FILE * object, or a block of d47 1 a47 1 Produce archive d53 2 a54 2 provide a struct stat with a valid st_mode field, which specifies the type of object and st_size field, which specifies the size of the data d57 1 a57 1 Release resources d60 1 a60 1 After all entries have been written, use the archive_write_free() func‐ d63 1 a63 1 EXAMPLE d163 1 a163 1 SEE ALSO d167 2 a168 2 HISTORY The libarchive library first appeared in FreeBSD 5.3. d170 2 a171 2 AUTHORS The libarchive library was written by Tim Kientzle . d173 1 a173 1 BUGS d187 1 a187 1 are compatible with Joerg Schilling's star archiver. Other implementa‐ @ 1.1.1.9 log @Import libarchive-3.3.3 as should have done originally. @ text @d34 1 a34 1 See archive_write_set_options(3). @ 1.1.1.10 log @Import libarchive 3.4.0 @ text @d41 2 a42 2 writing. There are several variants of this function; the most basic ex‐ pects you to provide pointers to several functions that can provide d64 2 a65 2 The following sketch illustrates basic usage of the library. In this ex‐ ample, the callback functions are simply wrappers around the standard d176 2 a177 2 example, several historic implementations calculated header checksums in‐ correctly and will thus reject valid archives; GNU tar does not fully @ 1.1.1.11 log @Import libarchive 3.7.2 @ text @d52 1 a52 1 new entry. At a minimum, you should set the pathname of the entry and d63 1 a63 1 EXAMPLES d164 1 a164 1 tar(1), archive_write_set_options(3), libarchive(3), cpio(5), mtree(5), d175 1 a175 1 cause certain programs to reject archives written by this library. For d192 1 a192 1 BSD February 2, 2012 BSD @ 1.1.1.12 log @libarchove: import version 3.7.7 @ text @d1 1 a1 1 4mARCHIVE_WRITE24m(3) Library Functions Manual 4mARCHIVE_WRITE24m(3) d3 2 a4 2 1mNAME0m archive_write — functions for creating archives d6 2 a7 2 1mLIBRARY0m Streaming Archive Library (libarchive, -larchive) d9 123 a131 85 1mSYNOPSIS0m 1m#include 0m 1mDESCRIPTION0m These functions provide a complete API for creating streaming archive files. The general process is to first create the struct archive ob‐ ject, set any desired options, initialize the archive, append entries, then close the archive and release all resources. 1mCreate archive object0m See 4marchive_write_new24m(3). To write an archive, you must first obtain an initialized struct archive object from 1marchive_write_new22m(). 1mEnable filters and formats, configure block size and padding0m See 4marchive_write_filter24m(3), 4marchive_write_format24m(3) and 4marchive_write_blocksize24m(3). You can then modify this object for the desired operations with the various 1marchive_write_set_XXX22m() functions. In particular, you will need to invoke appropriate 1marchive_write_add_XXX22m() and 1marchive_write_set_XXX22m() functions to enable the corresponding compres‐ sion and format support. 1mSet options0m See 4marchive_write_set_options24m(3). 1mOpen archive0m See 4marchive_write_open24m(3). Once you have prepared the struct archive object, you call 1marchive_write_open22m() to actually open the archive and prepare it for writing. There are several variants of this function; the most basic expects you to provide pointers to several functions that can provide blocks of bytes from the archive. There are convenience forms that al‐ low you to specify a filename, file descriptor, 4mFILE24m 4m*24m object, or a block of memory from which to write the archive data. 1mProduce archive0m See 4marchive_write_header24m(3) and 4marchive_write_data24m(3). Individual archive entries are written in a three-step process: You first initialize a struct archive_entry structure with information about the new entry. At a minimum, you should set the pathname of the entry and provide a 4mstruct24m 4mstat24m with a valid 4mst_mode24m field, which spec‐ ifies the type of object and 4mst_size24m field, which specifies the size of the data portion of the object. 1mRelease resources0m See 4marchive_write_free24m(3). After all entries have been written, use the 1marchive_write_free22m() func‐ tion to release all resources. 1mEXAMPLES0m The following sketch illustrates basic usage of the library. In this example, the callback functions are simply wrappers around the standard 4mopen24m(2), 4mwrite24m(2), and 4mclose24m(2) system calls. #ifdef __linux__ #define _FILE_OFFSET_BITS 64 #endif #include #include #include #include #include #include struct mydata { const char *name; int fd; }; int myopen(struct archive *a, void *client_data) { struct mydata *mydata = client_data; mydata->fd = open(mydata->name, O_WRONLY | O_CREAT, 0644); if (mydata->fd >= 0) return (ARCHIVE_OK); else return (ARCHIVE_FATAL); d133 11 a143 47 la_ssize_t mywrite(struct archive *a, void *client_data, const void *buff, size_t n) { struct mydata *mydata = client_data; return (write(mydata->fd, buff, n)); } int myclose(struct archive *a, void *client_data) { struct mydata *mydata = client_data; if (mydata->fd > 0) close(mydata->fd); return (0); } void write_archive(const char *outname, const char **filename) { struct mydata *mydata = malloc(sizeof(struct mydata)); struct archive *a; struct archive_entry *entry; struct stat st; char buff[8192]; int len; int fd; a = archive_write_new(); mydata->name = outname; /* Set archive format and filter according to output file extension. * If it fails, set default format. Platform depended function. * See supported formats in archive_write_set_format_filter_by_ext.c */ if (archive_write_set_format_filter_by_ext(a, outname) != ARCHIVE_OK) { archive_write_add_filter_gzip(a); archive_write_set_format_ustar(a); } archive_write_open(a, mydata, myopen, mywrite, myclose); while (*filename) { stat(*filename, &st); entry = archive_entry_new(); archive_entry_copy_stat(entry, &st); archive_entry_set_pathname(entry, *filename); archive_write_header(a, entry); if ((fd = open(*filename, O_RDONLY)) != -1) { a144 5 while (len > 0) { archive_write_data(a, buff, len); len = read(fd, buff, sizeof(buff)); } close(fd); d146 1 a146 2 archive_entry_free(entry); filename++; d148 2 a149 10 archive_write_free(a); } int main(int argc, const char **argv) { const char *outname; argv++; outname = *argv++; write_archive(outname, argv); return 0; d151 2 d154 37 a190 28 1mSEE ALSO0m 4mtar24m(1), 4marchive_write_set_options24m(3), 4mlibarchive24m(3), 4mcpio24m(5), 4mmtree24m(5), 4mtar24m(5) 1mHISTORY0m The 1mlibarchive 22mlibrary first appeared in FreeBSD 5.3. 1mAUTHORS0m The 1mlibarchive 22mlibrary was written by Tim Kientzle . 1mBUGS0m There are many peculiar bugs in historic tar implementations that may cause certain programs to reject archives written by this library. For example, several historic implementations calculated header checksums incorrectly and will thus reject valid archives; GNU tar does not fully support pax interchange format; some old tar implementations required specific field terminations. The default pax interchange format eliminates most of the historic tar limitations and provides a generic key/value attribute facility for vendor-defined extensions. One oversight in POSIX is the failure to provide a standard attribute for large device numbers. This library uses “SCHILY.devminor” and “SCHILY.devmajor” for device numbers that exceed the range supported by the backwards-compatible ustar header. These keys are compatible with Joerg Schilling's 1mstar 22marchiver. Other implementations may not recognize these keys and will thus be unable to correctly restore device nodes with large device numbers from archives created by this library. d192 1 a192 1 Debian February 2, 2012 4mARCHIVE_WRITE24m(3) @