English Language flag
// Log In
// CVSweb
Project: FreeWRT
// Summary // Activity // Search // Tracker // Lists // News // SCM // Wiki

SCM Repository

ViewVC logotype

Contents of /branches/freewrt_1_0/tools/paxmirabilis/src/tar.1

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3816 - (show annotations) (download)
Wed Oct 29 17:58:40 2008 UTC (5 years, 3 months ago) by tg
File size: 12782 byte(s)
FreeWRT trunk:

• merge new MirCPIO upstream, changes:
  – allow multiple -v options not only for tar but also for cpio, pax
  – add code to work around broken archives such as the CPIO archive inside
    Fedora Core 4 glibc-common-2.3.6-3.i386.rpm which carry the actual data
    of hardlinks not in the first but a later (here, the last) occurence of
    the file in question: iff hardlinking succeeds (no cross-device!), size
    of the linked files is 0, size of the archive member is greater than 0,
    we are extracting, but not to stdout, proceed writing out the data.
• add mircpio, mirpax, mirtar links in order to prevent interfering with
  native tools when both are in $PATH (this has worked since the last
  update, can be used now)

FreeWRT 1.0-stable:

• merge paxmirabilis complete from trunk

note: untested

1 .\" $MirOS: src/bin/pax/tar.1,v 1.10 2008/03/14 17:05:06 tg Exp $
2 .\" $OpenBSD: tar.1,v 1.48 2007/05/31 19:19:15 jmc Exp $
3 .\"
4 .\" Copyright (c) 1996 SigmaSoft, Th. Lockert
5 .\" All rights reserved.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 .\"
27 .\" $OpenBSD: tar.1,v 1.48 2007/05/31 19:19:15 jmc Exp $
28 .\"
29 .\"-
30 .\" Try to make GNU groff and AT&T nroff more compatible
31 .\" * ` generates ‘ in groff, so use \`
32 .\" * ' generates ’ in groff, \' generates ´, so use \*(aq
33 .\" * - generates ‐ in groff, \- generates −, fixed in tmac/mdoc/doc-groff
34 .\" thus use - for hyphens and \- for minus signs and option dashes
35 .\" * ~ is size-reduced and placed atop in groff, so use \*(TI
36 .\" * ^ is size-reduced and placed atop in groff, so use \*(ha
37 .\" * \(en does not work in nroff, so use \*(en
38 .ie \n(.g \{\
39 . ds aq \(aq
40 . ds TI \(ti
41 . ds ha \(ha
42 . ds en \(en
43 .\}
44 .el \{\
45 . ds aq '
46 . ds TI ~
47 . ds ha ^
48 . ds en \(em
49 .\}
50 .\"
51 .\" Implement .Dd with the Mdocdate RCS keyword
52 .rn Dd xD
53 .de Dd
54 .ie \\$1$Mdocdate: \{\
55 . xD \\$2 \\$3, \\$4
56 .\}
57 .el .xD \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
58 ..
59 .\"
60 .\" .Dd must come before definition of .Mx, because when called
61 .\" with -mandoc, it might implement .Mx itself, but we want to
62 .\" use our own definition. And .Dd must come *first*, always.
63 .Dd $Mdocdate: March 14 2008 $
64 .\"
65 .\" Implement .Mx (MirBSD)
66 .de Mx
67 .nr cF \\n(.f
68 .nr cZ \\n(.s
69 .ds aa \&\f\\n(cF\s\\n(cZ
70 .if \\n(aC==0 \{\
71 . ie \\n(.$==0 \&MirOS\\*(aa
72 . el .aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
73 .\}
74 .if \\n(aC>\\n(aP \{\
75 . nr aP \\n(aP+1
76 . ie \\n(C\\n(aP==2 \{\
77 . as b1 \&MirOS\ #\&\\*(A\\n(aP\\*(aa
78 . ie \\n(aC>\\n(aP \{\
79 . nr aP \\n(aP+1
80 . nR
81 . \}
82 . el .aZ
83 . \}
84 . el \{\
85 . as b1 \&MirOS\\*(aa
86 . nR
87 . \}
88 .\}
89 ..
90 .Dt TAR 1
91 .Os MirBSD
92 .Sh NAME
93 .Nm tar
94 .Nd tape archiver
95 .Sh SYNOPSIS
96 .Nm tar
97 .Sm off
98 .No { Cm crtux No } Op Cm 014578befHhLmOoPRSpqsvwXZz
99 .Sm on
100 .Bk -words
101 .Op Ar blocking-factor | archive | replstr
102 .Op Fl C Ar directory
103 .Op Fl I Ar file
104 .Op Ar file ...
105 .Ek
106 .Pp
107 .Nm tar
108 .No { Ns Fl crtux Ns }
109 .Op Fl 014578eHhLmOoPpqRSvwXZz
110 .Op Fl b Ar blocking-factor
111 .Op Fl C Ar directory
112 .Op Fl f Ar archive
113 .Op Fl I Ar file
114 .Op Fl M Ar flag
115 .Op Fl s Ar replstr
116 .Op Ar file ...
117 .Sh DESCRIPTION
118 The
119 .Nm
120 command creates, adds files to, or extracts files from an
121 archive file in
122 .Dq tar
123 format.
124 A tar archive is often stored on a magnetic tape, but can be
125 stored equally well on a floppy, CD-ROM, or in a regular disk file.
126 .Pp
127 In the first (legacy) form, all option flags except for
128 .Fl C
129 and
130 .Fl I
131 must be contained within the first argument to
132 .Nm
133 and must not be prefixed by a hyphen
134 .Pq Sq - .
135 Option arguments, if any, are processed as subsequent arguments to
136 .Nm
137 and are processed in the order in which their corresponding option
138 flags have been presented on the command line.
139 .Pp
140 In the second and preferred form, option flags may be given in any order
141 and are immediately followed by their corresponding option argument
142 values.
143 .Pp
144 One of the following flags must be present:
145 .Bl -tag -width Ds
146 .It Fl c
147 Create new archive, or overwrite an existing archive,
148 adding the specified files to it.
149 .It Fl r
150 Append the named new files to existing archive.
151 Note that this will only work on media on which an end-of-file mark
152 can be overwritten.
153 .It Fl t
154 List contents of archive.
155 If any files are named on the
156 command line, only those files will be listed.
157 The
158 .Ar file
159 arguments may be specified as glob patterns (see
160 .Xr glob 3
161 for more information), in which case
162 .Nm
163 will list all archive members that match each pattern.
164 .It Fl u
165 Alias for
166 .Fl r .
167 .It Fl x
168 Extract files from archive.
169 If any files are named on the
170 command line, only those files will be extracted from the
171 archive.
172 The
173 .Ar file
174 arguments may be specified as glob patterns (see
175 .Xr glob 3
176 for more information), in which case
177 .Nm
178 will extract all archive members that match each pattern.
179 .Pp
180 If more than one copy of a file exists in the
181 archive, later copies will overwrite earlier copies during
182 extraction.
183 The file mode and modification time are preserved
184 if possible.
185 The file mode is subject to modification by the
186 .Xr umask 2 .
187 .El
188 .Pp
189 In addition to the flags mentioned above, any of the following
190 flags may be used:
191 .Bl -tag -width Ds
192 .It Fl b Ar blocking-factor
193 Set blocking factor to use for the archive.
194 .Nm
195 uses 512-byte blocks.
196 The default is 20, the maximum is 126.
197 Archives with a blocking factor larger than 63 violate the
198 .Tn POSIX
199 standard and will not be portable to all systems.
200 .It Fl C Ar directory
201 This is a positional argument which sets the working directory for the
202 following files.
203 When extracting, files will be extracted into
204 the specified directory; when creating, the specified files will be matched
205 from the directory.
206 .It Fl e
207 Stop after the first error.
208 .It Fl f Ar archive
209 Filename where the archive is stored.
210 Defaults to
211 .Pa /dev/rst0 .
212 .It Fl H
213 Follow symlinks given on the command line only.
214 .It Fl h
215 Follow symbolic links as if they were normal files
216 or directories.
217 In extract mode this means that a directory entry in the archive
218 will not overwrite an existing symbolic link, but rather what the
219 link ultimately points to.
220 .It Fl I Ar file
221 This is a positional argument which reads the names of files to
222 archive or extract from the given file, one per line.
223 .It Fl L
224 Synonym for the
225 .Fl h
226 option.
227 .It Fl M Ar flag
228 Configure the archive normaliser.
229 .Ar flag
230 is either a number or a string, optionally prefixed with
231 .Dq no-
232 to turn it off.
233 See
234 .Xr cpio 1
235 for a comprehensive list and compatibility notes.
236 .Pp
237 .Bl -tag -width xxxxxx -compact
238 .It Ar inodes
239 0x0001: Serialise inodes, zero device info.
240 .It Ar links
241 0x0002: Store content of hard links only once.
242 .It Ar mtime
243 0x0004: Zero out the file modification time.
244 .It Ar uidgid
245 0x0008: Set owner to 0:0 (root:wheel).
246 .El
247 .Pp
248 This option is only implemented for the cpio, sv4cpio,
249 sv4crc, and ustar file format writing routines.
250 For the ustar format, the
251 .Ar inodes
252 and
253 .Ar links
254 specifiers are ignored.
255 .It Fl m
256 Do not preserve modification time.
257 .It Fl O
258 If reading, extract files to standard output.
259 .br
260 If writing, write old-style (non-POSIX) archives.
261 .It Fl o
262 Don't write directory information that the older (V7) style
263 .Nm
264 is unable to decode.
265 This implies the
266 .Fl O
267 flag.
268 .It Fl P
269 Do not strip leading slashes
270 .Pq Sq /
271 from pathnames.
272 The default is to strip leading slashes.
273 .It Fl p
274 Preserve user and group ID as well as file mode regardless of
275 the current
276 .Xr umask 2 .
277 The setuid and setgid bits are only preserved if the user is
278 the superuser.
279 Only meaningful in conjunction with the
280 .Fl x
281 flag.
282 .It Fl q
283 Select the first archive member that matches each
284 .Ar file
285 operand.
286 No more than one archive member is matched for each
287 .Ar file .
288 When members of type directory are matched, the file hierarchy rooted at that
289 directory is also matched.
290 .It Fl R
291 Write SysVR4 CPIO files instead of tar or POSIX ustar files.
292 Serialise inode numbers, zero out device information.
293 The file content of hard links is stored only once.
294 .It Fl S
295 Write SysVR4 CPIO files with CRC instead of tar or POSIX ustar files.
296 Serialise inode numbers, zero out device information.
297 The file content of hard links is stored only once.
298 .It Fl s Ar replstr
299 Modify the archive member names according to the substitution expression
300 .Ar replstr ,
301 using the syntax of the
302 .Xr ed 1
303 utility regular expressions.
304 .Ar file
305 arguments may be given to restrict the list of archive members to those
306 specified.
307 .Pp
308 The format of these regular expressions is
309 .Pp
310 .Dl /old/new/[gp]
311 .Pp
312 As in
313 .Xr ed 1 ,
314 .Va old
315 is a basic regular expression (see
316 .Xr re_format 7 )
317 and
318 .Va new
319 can contain an ampersand
320 .Pq Ql & ,
321 .Ql \e Ns Em n
322 (where
323 .Em n
324 is a digit) back-references,
325 or subexpression matching.
326 The
327 .Va old
328 string may also contain newline characters.
329 Any non-null character can be used as a delimiter
330 .Po
331 .Ql /
332 is shown here
333 .Pc .
334 Multiple
335 .Fl s
336 expressions can be specified.
337 The expressions are applied in the order they are specified on the
338 command line, terminating with the first successful substitution.
339 .Pp
340 The optional trailing
341 .Cm g
342 continues to apply the substitution expression to the pathname substring,
343 which starts with the first character following the end of the last successful
344 substitution.
345 The first unsuccessful substitution stops the operation of the
346 .Cm g
347 option.
348 The optional trailing
349 .Cm p
350 will cause the final result of a successful substitution to be written to
351 standard error in the following format:
352 .Pp
353 .D1 Em original-pathname No >> Em new-pathname
354 .Pp
355 File or archive member names that substitute to the empty string
356 are not selected and will be skipped.
357 .It Fl v
358 Verbose operation mode.
359 .It Fl w
360 Interactively rename files.
361 This option causes
362 .Nm
363 to prompt the user for the filename to use when storing or
364 extracting files in an archive.
365 .It Fl X
366 Do not cross mount points in the file system.
367 .It Fl Z
368 Compress archive using
369 .Xr compress 1 .
370 .It Fl z
371 Compress archive using
372 .Xr gzip 1 .
373 .El
374 .Pp
375 The options
376 .Op Fl 014578
377 can be used to select one of the compiled-in backup devices,
378 .Pa /dev/rstN .
379 .Sh ENVIRONMENT
380 .Bl -tag -width Fl
381 .It Ev TMPDIR
382 Path in which to store temporary files.
383 .It Ev TAPE
384 Default tape device to use instead of
385 .Pa /dev/rst0 .
386 .El
387 .Sh FILES
388 .Bl -tag -width "/dev/rst0"
389 .It Pa /dev/rst0
390 default archive name
391 .El
392 .Sh EXAMPLES
393 Create an archive on the default tape drive, containing the files named
394 .Pa bonvole
395 and
396 .Pa sekve :
397 .Pp
398 .Dl $ tar c bonvole sekve
399 .Pp
400 Output a
401 .Xr gzip 1
402 compressed archive containing the files
403 .Pa bonvole
404 and
405 .Pa sekve
406 to a file called
407 .Pa foriru.tar.gz :
408 .Pp
409 .Dl $ tar zcf foriru.tar.gz bonvole sekve
410 .Pp
411 Verbosely create an archive, called
412 .Pa backup.tar.gz ,
413 of all files matching the shell
414 .Xr glob 3
415 function
416 .Pa *.c :
417 .Pp
418 .Dl $ tar zcvf backup.tar.gz *.c
419 .Pp
420 Verbosely list, but do not extract, all files ending in
421 .Pa .jpeg
422 from a compressed archive named
423 .Pa backup.tar.gz .
424 Note that the glob pattern has been quoted to avoid expansion by the shell:
425 .Pp
426 .Dl $ tar tvzf backup.tar.gz '*.jpeg'
427 .Pp
428 For more detailed examples, see
429 .Xr pax 1 .
430 .Sh DIAGNOSTICS
431 .Nm
432 will exit with one of the following values:
433 .Bl -tag -width 2n -offset indent
434 .It 0
435 All files were processed successfully.
436 .It 1
437 An error occurred.
438 .El
439 .Pp
440 Whenever
441 .Nm
442 cannot create a file or a link when extracting an archive or cannot
443 find a file while writing an archive, or cannot preserve the user
444 ID, group ID, file mode, or access and modification times when the
445 .Fl p
446 option is specified, a diagnostic message is written to standard
447 error and a non-zero exit value will be returned, but processing
448 will continue.
449 In the case where
450 .Nm
451 cannot create a link to a file,
452 .Nm
453 will not create a second copy of the file.
454 .Pp
455 If the extraction of a file from an archive is prematurely terminated
456 by a signal or error,
457 .Nm
458 may have only partially extracted the file the user wanted.
459 Additionally, the file modes of extracted files and directories may
460 have incorrect file bits, and the modification and access times may
461 be wrong.
462 .Pp
463 If the creation of an archive is prematurely terminated by a signal
464 or error,
465 .Nm
466 may have only partially created the archive, which may violate the
467 specific archive format specification.
468 .Sh SEE ALSO
469 .Xr cpio 1 ,
470 .Xr pax 1
471 .Sh HISTORY
472 A
473 .Nm
474 command first appeared in
475 .At v7 .
476 .Sh AUTHORS
477 Keith Muller at the University of California, San Diego.
478 .Sh CAVEATS
479 The
480 .Fl L
481 flag is not portable to other versions of
482 .Nm
483 where it may have a different meaning.
484 The
485 .Fl R ,
486 .Fl S ,
487 and
488 .Fl M
489 options are extensions specific to
490 .Mx .

root@freewrt.org:443
ViewVC Help
Powered by ViewVC 1.1.20