ARCHIVE_WRITE_OPTIONS(3)
πΈ NAME πΈ
archive_write_set_filter_option, archive_write_set_format_option, archive_write_set_option, archive_write_set_options β functions controlling options for writing archives. This is ARCHIVE_WRITE_OPTIONS(3) from the Library Functions Manual, bestie. π
π«Ά LIBRARY π«Ά
Streaming Archive Library (libarchive, -larchive). Iconic behavior only.
β¨ SYNOPSIS β¨
int
archive_write_set_filter_option(struct archive *, const char *module,
const char *option, const char *value);
int
archive_write_set_format_option(struct archive *, const char *module,
const char *option, const char *value);
int
archive_write_set_option(struct archive *, const char *module,
const char *option, const char *value);
int
archive_write_set_options(struct archive *, const char *options);
π DESCRIPTION π
These functions provide a way for libarchive clients to configure specific write modules. Itβs giving βgroup chat, but for write modules,β iykyk.
archive_write_set_filter_option(),archive_write_set_format_option()β specifies an option that will be passed to the currently-registered filters (including decompression filters) or format readers.- If
optionandvalueare bothNULL, these functions will do nothing andARCHIVE_OKwill be returned. - If
optionisNULLbutvalueis not, these functions will do nothing andARCHIVE_FAILEDwill be returned. π - If
moduleis notNULL,optionandvaluewill be provided to the filter or reader namedmodule. The return value will be eitherARCHIVE_OKif the option was successfully handled orARCHIVE_WARNif the option was unrecognized by the module or could otherwise not be handled. If there is no such module,ARCHIVE_FAILEDwill be returned. - If
moduleisNULL,optionandvaluewill be provided to every registered module. If any module returnsARCHIVE_FATAL, this value will be returned immediately. Otherwise,ARCHIVE_OKwill be returned if any module accepts the option, andARCHIVE_FAILEDin all other cases. π
- If
archive_write_set_option()β callsarchive_write_set_format_option(), thenarchive_write_set_filter_option(). If either function returnsARCHIVE_FATAL,ARCHIVE_FATALwill be returned immediately. Otherwise, the greater of the two values will be returned. π₯archive_write_set_options()βoptionsis a comma-separated list of options. IfoptionsisNULLor empty,ARCHIVE_OKwill be returned immediately.
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 of1.!optionβ the option will be provided to every module with aNULLvalue.module:option=value,module:option,module:!optionβ as above, but the corresponding option and value will be provided only to modules whose name matchesmodule. β¨
β¨ OPTIONS β¨
Okay bestie, this is the big one β all the options, filters and format knobs, and we are keeping every single one. The vibe is cute, the facts are not moving. π
π§Ό Filter b64encode
modeβ the value is read as octal digits specifying the file mode.nameβ the value specifies the file name.
π§Ό Filter bzip2
compression-levelβ the value is read as a decimal integer specifying the bzip2 compression level. Supported values are from 1 to 9.
π§Ό Filter gzip
compression-levelβ the value is read as a decimal integer specifying the gzip compression level. Supported values are from 0 to 9.timestampβ store timestamp. This is enabled by default.
π§Ό Filter lrzip
compression=typeβ use type as the compression method. Supported values are βbzip2β, βgzipiβ, βlzoβ (ultra fast), and βzpaqβ (best, extremely slow).compression-levelβ the value is read as a decimal integer specifying the lrzip compression level. Supported values are from 1 to 9.
π§Ό Filter lz4
compression-levelβ the value is read as a decimal integer specifying the lz4 compression level. Supported values are from 0 to 9.stream-checksumβ enable stream checksum. This is enabled by default.block-checksumβ enable block checksum. This is disabled by default.block-sizeβ the value is read as a decimal integer specifying the lz4 compression block size. Supported values are from 4 to 7 (default).block-dependenceβ use the previous block of the block being compressed for a compression dictionary to improve compression ratio. This is disabled by default.
π§Ό Filter lzop
compression-levelβ the value is read as a decimal integer specifying the lzop compression level. Supported values are from 1 to 9.
π§Ό Filter uuencode
modeβ the value is read as octal digits specifying the file mode.nameβ the value specifies the file name.
π§Ό Filter xz
compression-levelβ the value is read as a decimal integer specifying the compression level. Supported values are from 0 to 9.threadsβ the value is read as a decimal integer specifying the number of threads for multi-threaded lzma compression. If supported, the default value is read fromlzma_cputhreads().
π§Ό Filter zstd
compression-levelβ the value is read as a decimal integer specifying the compression level. Supported values depend on the library version, common values are from 1 to 22.longβ enables long distance matching. The value is read as a decimal integer specifying log2 window size in bytes. Values from 10 to 30 for 32 bit, or 31 for 64 bit, are supported.threadsβ the value is read as a decimal integer specifying the number of threads for multi-threaded zstd compression. If set to 0, zstd will attempt to detect and use the number of active physical CPU cores.
π Format 7zip
compressionβ the value is one of βstoreβ, βcopyβ, βdeflateβ, βbzip2β, βlzma1β, βlzma2β, βppmdβ, or βzstdβ to indicate how the following entries should be compressed. The values βstoreβ and βcopyβ are synonyms. Note that this setting is ignored for directories, symbolic links, and other special entries.compression-levelβ the value is read as a decimal integer specifying the compression level. Values between 0 and 9 are supported, with the exception of bzip2 which only supports values between 1 and 9, and zstd which may support negative values depending on the library version and commonly used values 1 through 22. The interpretation of the compression level depends on the chosen compression method.threadsβ the value is read as a decimal integer specifying the number of threads for multi-threaded compression (for compressors like zstd that support it). If set to 0, an attempt will be made to discover the number of CPU cores.
π Format bin
hdrcharsetβ the value is used as a character set name that will be used when translating file names.
π Format gnutar
hdrcharsetβ the value is used as a character set name that will be used when translating file, group and user names.
π Format iso9660 - volume metadata
These options are used to set standard ISO9660 metadata.
abstract-file=filenameβ the file with the specified name will be identified in the ISO9660 metadata as holding the abstract for this volume. Default: none.application-id=filenameβ the file with the specified name will be identified in the ISO9660 metadata as holding the application identifier for this volume. Default: none.biblio-file=filenameβ the file with the specified name will be identified in the ISO9660 metadata as holding the bibliography for this volume. Default: none.copyright-file=filenameβ the file with the specified name will be identified in the ISO9660 metadata as holding the copyright for this volume. Default: none.publisher=filenameβ the file with the specified name will be identified in the ISO9660 metadata as holding the publisher information for this volume. Default: none.volume-id=stringβ the specified string will be used as the Volume Identifier in the ISO9660 metadata. It is limited to 32 bytes. Default: none.
π Format iso9660 - boot support
These options are used to make an ISO9660 image that can be directly booted on various systems.
boot=filenameβ the file matching this name will be used as the El Torito boot image file.boot-catalog=nameβ the name that will be used for the El Torito boot catalog. Default:boot.catalogboot-info-tableβ the boot image file provided by theboot=filenameoption will be edited with appropriate boot information in bytes 8 through 64. Default: disabledboot-load-seg=hexadecimal-numberβ the load segment for a no-emulation boot image.boot-load-size=decimal-numberβ the number of "virtual" 512-byte sectors to be loaded from a no-emulation boot image. Some very old BIOSes can only load very small images, setting this value to 4 will often allow such BIOSes to load the first part of the boot image (which will then need to be intelligent enough to load the rest of itself). This should not be needed unless you are trying to support systems with very old BIOSes. This defaults to the full size of the image.boot-type=valueβ specifies the boot semantics used by the El Torito boot image: If the value isfd, then the boot image is assumed to be a bootable floppy image. If the value ishd, then the boot image is assumed to be a bootable hard disk image. If the value isno-emulation, the boot image is used without floppy or hard disk emulation. If the boot image is exactly 1.2MB, 1.44MB, or 2.88MB, then the default isfd, otherwise the default isno-emulation.
π Format iso9660 - filename and size extensions
Various extensions to the base ISO9660 format.
allow-ldotsβ if enabled, allows filenames to begin with a leading period. If disabled, filenames that begin with a leading period will have that period replaced by an underscore character in the standard ISO9660 namespace. This does not impact names stored in the Rockridge or Joliet extension area. Default: disabled.allow-lowercaseβ if enabled, allows filenames to contain lowercase characters. If disabled, filenames will be forced to uppercase. This does not impact names stored in the Rockridge or Joliet extension area. Default: disabled.allow-multidotβ if enabled, allows filenames to contain multiple period characters, in violation of the ISO9660 specification. If disabled, additional periods will be converted to underscore characters. This does not impact names stored in the Rockridge or Joliet extension area. Default: disabled.allow-periodβ if enabled, allows filenames to contain trailing period characters, in violation of the ISO9660 specification. If disabled, trailing periods will be converted to underscore characters. This does not impact names stored in the Rockridge or Joliet extension area. Default: disabled.allow-pvd-lowercaseβ if enabled, the Primary Volume Descriptor may contain lowercase ASCII characters, in violation of the ISO9660 specification. If disabled, characters will be converted to uppercase ASCII. Default: disabled.allow-sharp-tildeβ if enabled, sharp and tilde characters will be permitted
β¦in filenames, in violation of the ISO9660 specification. If disabled, such characters will be converted to underscore characters. Default: disabled.
allow-vernumβ turn this on and version numbers get included with files π turn it off and version numbers get suppressed, which is literally in violation of the ISO9660 standard. Real ones know it doesn't touch names stored in the Rockridge or Joliet extension area though. Default: enabled.iso-levelβ this is the one that enables support for file size and file name extensions in the core ISO9660 area β¨ heads up: the name extensions you specify here do not affect the names stored in the Rockridge or Joliet extension areas, ok?iso-level=1β the most compliant form of ISO9660 image, the goody-two-shoes of levels π filenames are limited to 8.3 uppercase format, directory names are limited to 8 uppercase characters, files are limited to 4 GiB, and the complete ISO9660 image cannot exceed 4 GiB.iso-level=2β glow-up time: filenames are limited to 30 uppercase characters with a 30-character extension, directory names are limited to 30 characters, files are limited to 4 GiB.iso-level=3β literally same asiso-level=2, except that files may exceed 4 GiB.iso-level=4β as withiso-level=3, except that filenames may be up to 193 characters and may include arbitrary 8-bit characters π₯
jolietβ Microsoft's Joliet extensions store a completely separate set of directory information about each file π¦ and in particular, this information includes Unicode filenames of up to 255 characters. Default: enabled.limit-depthβ if enabled, libarchive will use directory relocation records to ensure that no pathname exceeds the ISO9660 limit of 8 directory levels πΈ if disabled, no relocation will occur. Default: enabled.limit-dirsβ if enabled, libarchive will cause an error if there are more than 65536 directories π if disabled, there is no limit on the number of directories. Default: enabledpadβ if enabled, 300 kiB of zero bytes will be appended to the end of the archive π Default: enabledrelaxed-filenamesβ if enabled, all 7-bit ASCII characters are permitted in filenames (except lowercase characters unlessallow-lowercaseis also specified) β οΈ this violates ISO9660 standards, no cap. This does not impact names stored in the Rockridge or Joliet extension area. Default: disabled.rockridgeβ the Rockridge extensions store an additional set of POSIX-style file information with each file π includingmtime,atime,ctime, permissions, and long filenames with arbitrary 8-bit characters. These extensions also support symbolic links and other POSIX file types. Default: enabled.
π Format iso9660 - zisofs support π
The zisofs extensions permit each file to be independently compressed using a gzip-compatible compression π«Ά this can provide significant size savings, but it requires the reading system to have support for these extensions. These extensions are disabled by default, bestie β you gotta ask for them.
compression-level=numberβ the compression level used by the deflate compressor π ranges from 0 (least effort) to 9 (most effort). Default: 6zisofsβ synonym forzisofs=direct. Simple as that β¨zisofs=directβ compress each file in the archive πΈ unlikezisofs=indirect, this is handled entirely within libarchive and does not require a separate utility. For best results, libarchive tests each file and will store the file uncompressed if the compression does not actually save any space π in particular, files under 2k will never be compressed. Note that boot image files are never compressed β not them, they're exempt.zisofs=indirectβ recognizes files that have already been compressed with themkzftreeutility and sets up the necessary file metadata so that readers will correctly identify these as zisofs-compressed files πzisofs-exclude=filenameβ specifies a filename that should not be compressed when usingzisofs=directπ this option can be provided multiple times to suppress compression on many files.
π¦ 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 themtreeoutput π 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. All of them. Iconic behaviour πuse-setβ enables generation of/setlines that specify default values for the following files and/or directories.indentβ XXX needs explanation XXX π« (that's literally what the page says, bestie, I'm not making it up)
π Format newc π
hdrcharsetβ the value is used as a character set name that will be used when translating file names.
π Format odc π
hdrcharsetβ the value is used as a character set name that will be used when translating file names.
π Format pwb π
hdrcharsetβ the value is used as a character set name that will be used when translating file names.
(yes, it's the same option three times, they're all just like that π)
πΈ Format pax πΈ
hdrcharsetβ the value is used as a character set name that will be used when translating file, group and user names π the value is one of βBINARYβ or βUTF-8β. With βBINARYβ there is no character conversion, with βUTF-8β names are converted to UTF-8.xattrheaderβ when storing extended attributes, this option configures which headers should be written π the value is one of βallβ, βLIBARCHIVEβ, or βSCHILYβ. By default, both βLIBARCHIVE.xattrβ and βSCHILY.xattrβ headers are written.
β Format ustar β
hdrcharsetβ the value is used as a character set name that will be used when translating file, group and user names.
β Format v7tar β
hdrcharsetβ the value is used as a character set name that will be used when translating file, group and user names.
π Format warc π
omit-warcinfoβ set to βtrueβ to disable output of thewarcinforecord π
π§ Format xar π§
checksum=typeβ use type as file checksum method π supported values are βnoneβ, βmd5β, and βsha1β (default).compression=typeβ use type as compression method π supported values are βnoneβ, βbzip2β, βgzipβ (default), βlzmaβ and βxzβ.compression_levelβ the value is a decimal integer from1to9specifying the compression level β¨toc-checksum=typeβ use type as table of contents checksum method π supported values are βnoneβ, βmd5β and βsha1β (default).
π₯ Format zip π₯
compressionβ the value is either βstoreβ, βdeflateβ, βbzip2β, βlzmaβ, βxzβ, or βzstdβ to indicate how the following entries should be compressed π note that this setting is ignored for directories, symbolic links, and other special entries β they're not like the other entries.compression-levelβ the value is interpreted as a decimal integer specifying the compression level πΈ values between0and9are supported. A compression level of0switches the compression method to βstoreβ, other values will enable βdeflateβ, βbzip2β, βlzmaβ, or βzstdβ compression (in order of priority, depending on what libraries are linked) with the given level.threadsβ the value is interpreted as a decimal integer specifying the number of threads to use for compression π it is supported only for βxzβ or βzstdβ compression and ignored for any other. Athreadsvalue of0is a special one requesting to detect and use as many threads as the number of active physical CPU cores β main character scheduling fr fr.encryptionβ enable encryption using traditional zip encryption πencryption=typeβ use type as encryption type π supported values are βzipcryptβ (traditional zip encryption), βaes128β (WinZip AES-128 encryption) and βaes256β (WinZip AES-256 encryption).experimentalβ this boolean option enables or disables experimental Zip features that may not be compatible with other Zip implementations β οΈ you've been warned, bestie.fakecrc32β this boolean option disables CRC calculations, and all CRC fields are set to zero π it should not be used except for testing purposes. Like, only for testing. Periodt.hdrcharsetβ the value is used as a character set name that will be used when translating file names.zip64β Zip64 extensions provide additional file size information for entries larger than 4 GiB β they also provide extended file offset and archive size information when archives exceed 4 GiB. By default, the
So the Zip writer is lowkey picky about these extensions β it only turns them on when it actually needs them π . Specifically: if the file size is unknown, the Zip writer will include Zip64 extensions to guard against the possibility that the file might be larger than 4 GiB. Like, it's just being cautious, bestie, no cap. π‘οΈ
Setting this boolean option will force the writer to use Zip64 extensions even for small files that would not otherwise require them. And what's the point of that? Testing, mostly β that's literally its main use. π¬
Disabling this option with !zip64 will force the Zip writer to avoid Zip64 extensions, and she is strict about it:
- It will reject files with size greater than 4 GiB π«
- It will reject any new entries once the total archive size reaches 4 GiB π«
- It will not use Zip64 extensions for files with unknown size π«
In particular, this can improve compatibility when generating archives where the entry sizes are not known in advance. So it's giving "trade-off queen" β less flexible, but more compatible. β¨
πΈ EXAMPLES πΈ
Okay so this next one is a whole snack π β the following example creates an archive write handle to create a gzip-compressed ISO9660 format image. The two options here specify that the ISO9660 archive will use kernel.img as the boot image for El Torito booting, and that the gzip compressor should use the maximum compression level.
a = archive_write_new();
archive_write_add_filter_gzip(a);
archive_write_set_format_iso9660(a);
archive_write_set_options(a, "boot=kernel.img,compression=9");
archive_write_open_filename(a, filename, blocksize);
Look at that flow π new handle β gzip filter β ISO9660 format β options β open. It's literally a glow-up routine for your archive. π
π ERRORS π
Need the deets on what went wrong? More detailed error codes and textual descriptions are available from the archive_errno() and archive_error_string() functions. Those two are your besties when something's sus β they'll tell you exactly what happened. π«Ά
π SEE ALSO π
Go read those, iykyk πβ¨
π°οΈ HISTORY π°οΈ
The libarchive library first appeared in FreeBSD 5.3. Vintage! Iconic! Old enough to have main character energy in its own right. π
π AUTHORS π
The options support for libarchive was originally implemented by Michihiro NAKAJIMA. Respect the OG, fr fr. π«‘
π BUGS π
Genuinely nothing here β the BUGS section is a whole empty vibe. Not a single bug listed, which is either iconic or deeply suspicious and I'm choosing to believe it's iconic. πβ¨
Okay bestie, that's the whole page β you ate that. Now go make some archives and slay. π₯π¦
Signing off with all the deets: this was the ARCHIVE_WRITE_OPTIONS(3) page, dated January 31, 2020, from the Debian fam. Mwah! π
π¦ where this page comes from
- fedora 43: libarchive-devel 3.8.1-3.fc43 Β· BSD-2-Clause AND FSFULLR AND GPL-2.0-or-later WITH Libtool-exception AND BSD-3-Clause AND FSFUL
- fedora 43: libarchive-devel 3.8.1-3.fc43 Β· BSD-2-Clause AND FSFULLR AND GPL-2.0-or-later WITH Libtool-exception AND BSD-3-Clause AND FSFUL
- fedora 43: libarchive-devel 3.8.4-1.fc43 Β· BSD-2-Clause AND FSFULLR AND GPL-2.0-or-later WITH Libtool-exception AND BSD-3-Clause AND FSFUL
- fedora 43: libarchive-devel 3.8.4-1.fc43 Β· BSD-2-Clause AND FSFULLR AND GPL-2.0-or-later WITH Libtool-exception AND BSD-3-Clause AND FSFUL
- fedora 44: libarchive-devel 3.8.4-2.fc44 Β· BSD-2-Clause AND FSFULLR AND GPL-2.0-or-later WITH Libtool-exception AND BSD-3-Clause AND FSFUL
- fedora 44: libarchive-devel 3.8.4-2.fc44 Β· BSD-2-Clause AND FSFULLR AND GPL-2.0-or-later WITH Libtool-exception AND BSD-3-Clause AND FSFUL
- fedora 44: libarchive-devel 3.8.7-1.fc44 Β· BSD-2-Clause AND FSFULLR AND GPL-2.0-or-later WITH Libtool-exception AND BSD-3-Clause AND FSFUL
- fedora 44: libarchive-devel 3.8.7-1.fc44 Β· BSD-2-Clause AND FSFULLR AND GPL-2.0-or-later WITH Libtool-exception AND BSD-3-Clause AND FSFUL
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- opensuse-leap 16.0: libarchive-devel 3.8.1-160000.4.1 Β· BSD-2-Clause
- opensuse-leap 16.0: libarchive-devel 3.8.1-160000.4.1 Β· BSD-2-Clause
- opensuse-leap 16.0: libarchive-devel 3.8.1-160000.4.1 Β· BSD-2-Clause
- opensuse-leap 16.0: libarchive-devel 3.8.1-160000.4.1 Β· BSD-2-Clause
- ubuntu resolute: libarchive-dev 3.8.5-1ubuntu2 Β· BSD-2-Clause
- ubuntu resolute: libarchive-dev 3.8.5-1ubuntu2.3 Β· BSD-2-Clause
- Copyright (c) 2003-2010 Tim Kientzle
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms