Skip to content

Commit a14fe90

Browse files
committed
Add manpage entry for archive_read_disk_set_behavior().
Update and alphabetically sort options in archive_write_disk_set_options().
1 parent c20d7a5 commit a14fe90

2 files changed

Lines changed: 112 additions & 42 deletions

File tree

libarchive/archive_read_disk.3

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
.Os
3030
.Sh NAME
3131
.Nm archive_read_disk_new ,
32+
.Nm archive_read_disk_set_behavior ,
3233
.Nm archive_read_disk_set_symlink_logical ,
3334
.Nm archive_read_disk_set_symlink_physical ,
3435
.Nm archive_read_disk_set_symlink_hybrid ,
@@ -46,6 +47,8 @@ Streaming Archive Library (libarchive, -larchive)
4647
.Ft struct archive *
4748
.Fn archive_read_disk_new "void"
4849
.Ft int
50+
.Fn archive_read_disk_set_behavior "struct archive *" "int"
51+
.Ft int
4952
.Fn archive_read_disk_set_symlink_logical "struct archive *"
5053
.Ft int
5154
.Fn archive_read_disk_set_symlink_physical "struct archive *"
@@ -89,6 +92,51 @@ objects.
8992
Allocates and initializes a
9093
.Tn struct archive
9194
object suitable for reading object information from disk.
95+
.It Fn archive_read_disk_set_behavior
96+
Configures various behavior options when reading entries from disk.
97+
The flags field consists of a bitwise OR of one or more of the
98+
following values:
99+
.Bl -tag -compact -width "indent"
100+
.It Cm ARCHIVE_READDISK_HONOR_NODUMP
101+
Skip files and directories with the nodump file attribute (file flag) set.
102+
By default, the nodump file atrribute is ignored.
103+
.It Cm ARCHIVE_READDISK_MAC_COPYFILE
104+
Mac OS X specific. Read metadata (ACLs and extended attributes) with
105+
.Xr copyfile 3 .
106+
By default, metadata is read using
107+
.Xr copyfile 3 .
108+
.It Cm ARCHIVE_READDISK_NO_ACL
109+
Do not read Access Control Lists.
110+
By default, ACLs are read from disk.
111+
.It Cm ARCHIVE_READDISK_NO_FFLAGS
112+
Do not read file attributes (file flags).
113+
By default, file attributes are read from disk.
114+
See
115+
.Xr chattr 1
116+
.Pq Linux
117+
or
118+
.Xr chflags 1
119+
.Pq FreeBSD, Mac OS X
120+
for more information on file attributes.
121+
.It Cm ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS
122+
Do not traverse mount points.
123+
By defaut, moint points are traversed.
124+
.It Cm ARCHIVE_READDISK_NO_XATTR
125+
Do not read extended file attributes (xattrs).
126+
By default, extended file attributes are read from disk.
127+
See
128+
.Xr xattr 7
129+
.Pq Linux ,
130+
.Xr xattr 2
131+
.Pq Mac OS X ,
132+
or
133+
.Xr getextattr 8
134+
.Pq FreeBSD
135+
for more information on extended file attributes.
136+
.It Cm ARCHIVE_READDISK_RESTORE_ATIME
137+
Restore access time of traversed files.
138+
By default, access time of traversed files is not restored.
139+
.El
92140
.It Xo
93141
.Fn archive_read_disk_set_symlink_logical ,
94142
.Fn archive_read_disk_set_symlink_physical ,

libarchive/archive_write_disk.3

Lines changed: 64 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,33 @@ performance optimization in practice.
9696
The options field consists of a bitwise OR of one or more of the
9797
following values:
9898
.Bl -tag -compact -width "indent"
99+
.It Cm ARCHIVE_EXTRACT_ACL
100+
Attempt to restore Access Control Lists.
101+
By default, extended ACLs are ignored.
102+
.It Cm ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS
103+
Before removing a file system object prior to replacing it, clear
104+
platform-specific file flags which might prevent its removal.
105+
.It Cm ARCHIVE_EXTRACT_FFLAGS
106+
Attempt to restore file attributes (file flags).
107+
By default, file attributes are ignored.
108+
See
109+
.Xr chattr 1
110+
.Pq Linux
111+
or
112+
.Xr chflags 1
113+
.Pq FreeBSD, Mac OS X
114+
for more information on file attributes.
115+
.It Cm ARCHIVE_EXTRACT_MAC_METADATA
116+
Mac OS X specific. Restore metadata using
117+
.Xr copyfile 3 .
118+
By default,
119+
.Xr copyfile 3
120+
metadata is ignored.
121+
.It Cm ARCHIVE_EXTRACT_NO_OVERWRITE
122+
Existing files on disk will not be overwritten.
123+
By default, existing regular files are truncated and overwritten;
124+
existing directories will have their permissions updated;
125+
other pre-existing objects are unlinked and recreated from scratch.
99126
.It Cm ARCHIVE_EXTRACT_OWNER
100127
The user and group IDs should be set on the restored file.
101128
By default, the user and group IDs are not restored.
@@ -111,61 +138,56 @@ is not specified, then SUID and SGID bits will only be restored
111138
if the default user and group IDs of newly-created objects on disk
112139
happen to match those specified in the archive entry.
113140
By default, only basic permissions are restored, and umask is obeyed.
141+
.It Cm ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS
142+
Refuse to extract an absolute path.
143+
The default is to not refuse such paths.
144+
.It Cm ARCHIVE_EXTRACT_SECURE_NODOTDOT
145+
Refuse to extract a path that contains a
146+
.Pa ..
147+
element anywhere within it.
148+
The default is to not refuse such paths.
149+
Note that paths ending in
150+
.Pa ..
151+
always cause an error, regardless of this flag.
152+
.It Cm ARCHIVE_EXTRACT_SECURE_SYMLINKS
153+
Refuse to extract any object whose final location would be altered
154+
by a symlink on disk.
155+
This is intended to help guard against a variety of mischief
156+
caused by archives that (deliberately or otherwise) extract
157+
files outside of the current directory.
158+
The default is not to perform this check.
159+
If
160+
.It Cm ARCHIVE_EXTRACT_SPARSE
161+
Scan data for blocks of NUL bytes and try to recreate them with holes.
162+
This results in sparse files, independent of whether the archive format
163+
supports or uses them.
164+
.Cm ARCHIVE_EXTRACT_UNLINK
165+
is specified together with this option, the library will
166+
remove any intermediate symlinks it finds and return an
167+
error only if such symlink could not be removed.
114168
.It Cm ARCHIVE_EXTRACT_TIME
115169
The timestamps (mtime, ctime, and atime) should be restored.
116170
By default, they are ignored.
117171
Note that restoring of atime is not currently supported.
118-
.It Cm ARCHIVE_EXTRACT_NO_OVERWRITE
119-
Existing files on disk will not be overwritten.
120-
By default, existing regular files are truncated and overwritten;
121-
existing directories will have their permissions updated;
122-
other pre-existing objects are unlinked and recreated from scratch.
123172
.It Cm ARCHIVE_EXTRACT_UNLINK
124173
Existing files on disk will be unlinked before any attempt to
125174
create them.
126175
In some cases, this can prove to be a significant performance improvement.
127176
By default, existing files are truncated and rewritten, but
128177
the file is not recreated.
129178
In particular, the default behavior does not break existing hard links.
130-
.It Cm ARCHIVE_EXTRACT_ACL
131-
Attempt to restore ACLs.
132-
By default, extended ACLs are ignored.
133-
.It Cm ARCHIVE_EXTRACT_FFLAGS
134-
Attempt to restore extended file flags.
135-
By default, file flags are ignored.
136179
.It Cm ARCHIVE_EXTRACT_XATTR
137-
Attempt to restore POSIX.1e extended attributes.
180+
Attempt to restore extended file attributes.
138181
By default, they are ignored.
139-
.It Cm ARCHIVE_EXTRACT_SECURE_SYMLINKS
140-
Refuse to extract any object whose final location would be altered
141-
by a symlink on disk.
142-
This is intended to help guard against a variety of mischief
143-
caused by archives that (deliberately or otherwise) extract
144-
files outside of the current directory.
145-
The default is not to perform this check.
146-
If
147-
.Cm ARCHIVE_EXTRACT_UNLINK
148-
is specified together with this option, the library will
149-
remove any intermediate symlinks it finds and return an
150-
error only if such symlink could not be removed.
151-
.It Cm ARCHIVE_EXTRACT_SECURE_NODOTDOT
152-
Refuse to extract a path that contains a
153-
.Pa ..
154-
element anywhere within it.
155-
The default is to not refuse such paths.
156-
Note that paths ending in
157-
.Pa ..
158-
always cause an error, regardless of this flag.
159-
.It Cm ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS
160-
Refuse to extract an absolute path.
161-
The default is to not refuse such paths.
162-
.It Cm ARCHIVE_EXTRACT_SPARSE
163-
Scan data for blocks of NUL bytes and try to recreate them with holes.
164-
This results in sparse files, independent of whether the archive format
165-
supports or uses them.
166-
.It Cm ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS
167-
Before removing a file system object prior to replacing it, clear
168-
platform-specific file flags which might prevent its removal.
182+
See
183+
.Xr xattr 7
184+
.Pq Linux ,
185+
.Xr xattr 2
186+
.Pq Mac OS X ,
187+
or
188+
.Xr getextattr 8
189+
.Pq FreeBSD
190+
for more information on extended file attributes.
169191
.El
170192
.It Xo
171193
.Fn archive_write_disk_set_group_lookup ,

0 commit comments

Comments
 (0)