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/pax.1

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2715 - (show annotations) (download)
Tue Jun 5 14:52:44 2007 UTC (6 years, 8 months ago) by tg
File size: 31860 byte(s)
• 1.0 -> scripts/param.h, paxmirabilis: MFC the new version from trunk
• both 1.0 and trunk: implement “make targz”, “make tarbz2”
  (I like the gzip(1)d versions better though)
• 1.0 -> package/config/Makefile: quieten the “clean” target to be consistent
1 .\" $MirOS: src/bin/pax/pax.1,v 1.7 2006/07/21 17:34:59 tg Exp $
2 .\" $OpenBSD: pax.1,v 1.48 2006/05/12 11:55:58 jmc Exp $
3 .\" $NetBSD: pax.1,v 1.3 1995/03/21 09:07:37 cgd Exp $
4 .\"
5 .\" Copyright (c) 2005, 2006 Thorsten Glaser.
6 .\" Copyright (c) 1992 Keith Muller.
7 .\" Copyright (c) 1992, 1993
8 .\" The Regents of the University of California. All rights reserved.
9 .\"
10 .\" This code is derived from software contributed to Berkeley by
11 .\" Keith Muller of the University of California, San Diego.
12 .\"
13 .\" Redistribution and use in source and binary forms, with or without
14 .\" modification, are permitted provided that the following conditions
15 .\" are met:
16 .\" 1. Redistributions of source code must retain the above copyright
17 .\" notice, this list of conditions and the following disclaimer.
18 .\" 2. Redistributions in binary form must reproduce the above copyright
19 .\" notice, this list of conditions and the following disclaimer in the
20 .\" documentation and/or other materials provided with the distribution.
21 .\" 3. Neither the name of the University nor the names of its contributors
22 .\" may be used to endorse or promote products derived from this software
23 .\" without specific prior written permission.
24 .\"
25 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 .\" SUCH DAMAGE.
36 .\"
37 .\" @(#)pax.1 8.4 (Berkeley) 4/18/94
38 .\"
39 .Dd July 21, 2006
40 .Dt PAX 1
41 .Os MirBSD
42 .\" for portability
43 .de Mx
44 .nr cF \\n(.f
45 .nr cZ \\n(.s
46 .ds aa \&\f\\n(cF\s\\n(cZ
47 .if \\n(aC==0 \{\
48 . if \\n(.$==0 \&MirOS\\*(aa
49 .\}
50 .if \\n(.$==1 \{\
51 . if "\\$1"." \&MirOS\\$1\\*(aa
52 . if "\\$1"," \&MirOS\\$1\\*(aa
53 .\}
54 ..
55 .Sh NAME
56 .Nm pax
57 .Nd read and write file archives and copy directory hierarchies
58 .Sh SYNOPSIS
59 .Bk -words
60 .Nm pax
61 .Op Fl 0cdOnvz
62 .Op Fl E Ar limit
63 .Op Fl f Ar archive
64 .Op Fl G Ar group
65 .Op Fl s Ar replstr
66 .Op Fl T Ar range
67 .Op Fl U Ar user
68 .Op Ar pattern ...
69 .Nm pax
70 .Fl r
71 .Op Fl 0cDdikOnuvYZz
72 .Op Fl E Ar limit
73 .Op Fl f Ar archive
74 .Op Fl G Ar group
75 .Op Fl o Ar options
76 .Op Fl p Ar string
77 .Op Fl s Ar replstr
78 .Op Fl T Ar range
79 .Op Fl U Ar user
80 .Op Ar pattern ...
81 .Nm pax
82 .Fl w
83 .Op Fl 0adHiLOPtuvXz
84 .Op Fl B Ar bytes
85 .Op Fl b Ar blocksize
86 .Op Fl f Ar archive
87 .Op Fl G Ar group
88 .Op Fl M Ar value
89 .Op Fl o Ar options
90 .Op Fl s Ar replstr
91 .Op Fl T Ar range
92 .Op Fl U Ar user
93 .Op Fl x Ar format
94 .Op Ar file ...
95 .Nm pax
96 .Fl r
97 .Fl w
98 .Op Fl 0DdHikLlnOPtuvXYZ
99 .Op Fl G Ar group
100 .Op Fl p Ar string
101 .Op Fl s Ar replstr
102 .Op Fl T Ar range
103 .Op Fl U Ar user
104 .Op Ar file ...
105 .Ar directory
106 .Ek
107 .Sh DESCRIPTION
108 .Nm
109 will read, write, and list the members of an archive file
110 and will copy directory hierarchies.
111 .Nm
112 operation is independent of the specific archive format
113 and supports a wide variety of different archive formats.
114 A list of supported archive formats can be found under the description of the
115 .Fl x
116 option.
117 .Pp
118 The presence of the
119 .Fl r
120 and the
121 .Fl w
122 options specifies which of the following functional modes
123 .Nm
124 will operate under:
125 .Em list , read , write ,
126 and
127 .Em copy .
128 .Bl -tag -width 6n
129 .It \*(Ltnone\*(Gt
130 .Em List .
131 .Nm
132 will write to standard output
133 a table of contents of the members of the archive file read from
134 standard input, whose pathnames match the specified
135 .Ar pattern
136 arguments.
137 The table of contents contains one filename per line
138 and is written using single line buffering.
139 .It Fl r
140 .Em Read .
141 .Nm
142 extracts the members of the archive file read from the standard input,
143 with pathnames matching the specified
144 .Ar pattern
145 arguments.
146 The archive format and blocking is automatically determined on input.
147 When an extracted file is a directory, the entire file hierarchy
148 rooted at that directory is extracted.
149 All extracted files are created relative to the current file hierarchy.
150 The setting of ownership, access and modification times, and file mode of
151 the extracted files are discussed in more detail under the
152 .Fl p
153 option.
154 .It Fl w
155 .Em Write .
156 .Nm
157 writes an archive containing the
158 .Ar file
159 operands to standard output
160 using the specified archive format.
161 When no
162 .Ar file
163 operands are specified, a list of files to copy with one per line is read from
164 standard input.
165 When a
166 .Ar file
167 operand is also a directory, the entire file hierarchy rooted
168 at that directory will be included.
169 .It Fl r Fl w
170 .Em Copy .
171 .Nm
172 copies the
173 .Ar file
174 operands to the destination
175 .Ar directory .
176 When no
177 .Ar file
178 operands are specified, a list of files to copy with one per line is read from
179 the standard input.
180 When a
181 .Ar file
182 operand is also a directory the entire file
183 hierarchy rooted at that directory will be included.
184 The effect of the
185 .Em copy
186 is as if the copied files were written to an archive file and then
187 subsequently extracted, except that there may be hard links between
188 the original and the copied files (see the
189 .Fl l
190 option below).
191 .Pp
192 .Sy Warning :
193 The destination
194 .Ar directory
195 must not be one of the
196 .Ar file
197 operands or a member of a file hierarchy rooted at one of the
198 .Ar file
199 operands.
200 The result of a
201 .Em copy
202 under these conditions is unpredictable.
203 .El
204 .Pp
205 While processing a damaged archive during a
206 .Em read
207 or
208 .Em list
209 operation,
210 .Nm
211 will attempt to recover from media defects and will search through the archive
212 to locate and process the largest number of archive members possible (see the
213 .Fl E
214 option for more details on error handling).
215 .Pp
216 The
217 .Ar directory
218 operand specifies a destination directory pathname.
219 If the
220 .Ar directory
221 operand does not exist, or it is not writable by the user,
222 or it is not of type directory,
223 .Nm
224 will exit with a non-zero exit status.
225 .Pp
226 The
227 .Ar pattern
228 operand is used to select one or more pathnames of archive members.
229 Archive members are selected using the pattern matching notation described
230 by
231 .Xr glob 3 .
232 When the
233 .Ar pattern
234 operand is not supplied, all members of the archive will be selected.
235 When a
236 .Ar pattern
237 matches a directory, the entire file hierarchy rooted at that directory will
238 be selected.
239 When a
240 .Ar pattern
241 operand does not select at least one archive member,
242 .Nm
243 will write these
244 .Ar pattern
245 operands in a diagnostic message to standard error
246 and then exit with a non-zero exit status.
247 .Pp
248 The
249 .Ar file
250 operand specifies the pathname of a file to be copied or archived.
251 When a
252 .Ar file
253 operand does not select at least one archive member,
254 .Nm
255 will write these
256 .Ar file
257 operand pathnames in a diagnostic message to standard error
258 and then exit with a non-zero exit status.
259 .Pp
260 The options are as follows:
261 .Bl -tag -width Ds
262 .It Fl 0
263 Use the NUL
264 .Pq Ql \e0
265 character as a pathname terminator, instead of newline
266 .Pq Ql \en .
267 This applies only to the pathnames read from standard input in
268 the write and copy modes,
269 and to the pathnames written to standard output in list mode.
270 This option is expected to be used in concert with the
271 .Fl print0
272 function in
273 .Xr find 1
274 or the
275 .Fl 0
276 flag in
277 .Xr xargs 1 .
278 .It Fl a
279 Append the given
280 .Ar file
281 operands
282 to the end of an archive that was previously written.
283 If an archive format is not specified with a
284 .Fl x
285 option, the format currently being used in the archive will be selected.
286 Any attempt to append to an archive in a format different from the
287 format already used in the archive will cause
288 .Nm
289 to exit immediately
290 with a non-zero exit status.
291 The blocking size used in the archive volume where writing starts
292 will continue to be used for the remainder of that archive volume.
293 .Pp
294 .Sy Warning :
295 Many storage devices are not able to support the operations necessary
296 to perform an append operation.
297 Any attempt to append to an archive stored on such a device may damage the
298 archive or have other unpredictable results.
299 Tape drives in particular are more likely to not support an append operation.
300 An archive stored in a regular file system file or on a disk device will
301 usually support an append operation.
302 .It Fl B Ar bytes
303 Limit the number of bytes written to a single archive volume to
304 .Ar bytes .
305 The
306 .Ar bytes
307 limit can end with
308 .Sq Li m ,
309 .Sq Li k ,
310 or
311 .Sq Li b
312 to specify multiplication by 1048576 (1M), 1024 (1K) or 512, respectively.
313 A pair of
314 .Ar bytes
315 limits can be separated by
316 .Sq Li x
317 to indicate a product.
318 .Pp
319 .Em Warning :
320 Only use this option when writing an archive to a device which supports
321 an end of file read condition based on last (or largest) write offset
322 (such as a regular file or a tape drive).
323 The use of this option with a floppy or hard disk is not recommended.
324 .It Fl b Ar blocksize
325 When
326 .Em writing
327 an archive,
328 block the output at a positive decimal integer number of
329 bytes per write to the archive file.
330 The
331 .Ar blocksize
332 must be a multiple of 512 bytes with a maximum of 64512 bytes.
333 Archive block sizes larger than 32256 bytes violate the
334 .Tn POSIX
335 standard and will not be portable to all systems.
336 A
337 .Ar blocksize
338 can end with
339 .Sq Li k
340 or
341 .Sq Li b
342 to specify multiplication by 1024 (1K) or 512, respectively.
343 A pair of
344 .Ar blocksizes
345 can be separated by
346 .Sq Li x
347 to indicate a product.
348 A specific archive device may impose additional restrictions on the size
349 of blocking it will support.
350 When blocking is not specified, the default
351 .Ar blocksize
352 is dependent on the specific archive format being used (see the
353 .Fl x
354 option).
355 .It Fl c
356 Match all file or archive members
357 .Em except
358 those specified by the
359 .Ar pattern
360 and
361 .Ar file
362 operands.
363 .It Fl D
364 This option is the same as the
365 .Fl u
366 option, except that the file inode change time is checked instead of the
367 file modification time.
368 The file inode change time can be used to select files whose inode information
369 (e.g., UID, GID, etc.) is newer than a copy of the file in the destination
370 .Ar directory .
371 .It Fl d
372 Cause files of type directory being copied or archived, or archive members of
373 type directory being extracted, to match only the directory file or archive
374 member and not the file hierarchy rooted at the directory.
375 .It Fl E Ar limit
376 Limit the number of consecutive read faults while trying to read a flawed
377 archive to
378 .Ar limit .
379 With a positive
380 .Ar limit ,
381 .Nm
382 will attempt to recover from an archive read error and will
383 continue processing starting with the next file stored in the archive.
384 A
385 .Ar limit
386 of 0 will cause
387 .Nm
388 to stop operation after the first read error is detected on an archive volume.
389 A
390 .Ar limit
391 of
392 .Li NONE
393 will cause
394 .Nm
395 to attempt to recover from read errors forever.
396 The default
397 .Ar limit
398 is a small positive number of retries.
399 .Pp
400 .Em Warning :
401 Using this option with
402 .Li NONE
403 should be used with extreme caution as
404 .Nm
405 may get stuck in an infinite loop on a very badly flawed archive.
406 .It Fl f Ar archive
407 Specify
408 .Ar archive
409 as the pathname of the input or output archive, overriding the default
410 standard input (for
411 .Em list
412 and
413 .Em read )
414 or standard output
415 (for
416 .Em write ) .
417 A single archive may span multiple files and different archive devices.
418 When required,
419 .Nm
420 will prompt for the pathname of the file or device of the next volume in the
421 archive.
422 .It Fl G Ar group
423 Select a file based on its
424 .Ar group
425 name, or when starting with a
426 .Cm # ,
427 a numeric GID.
428 A
429 .Ql \e
430 can be used to escape the
431 .Cm # .
432 Multiple
433 .Fl G
434 options may be supplied and checking stops with the first match.
435 .It Fl H
436 Follow only command-line symbolic links while performing a physical file
437 system traversal.
438 .It Fl i
439 Interactively rename files or archive members.
440 For each archive member matching a
441 .Ar pattern
442 operand or each file matching a
443 .Ar file
444 operand,
445 .Nm
446 will prompt to
447 .Pa /dev/tty
448 giving the name of the file, its file mode, and its modification time.
449 .Nm
450 will then read a line from
451 .Pa /dev/tty .
452 If this line is blank, the file or archive member is skipped.
453 If this line consists of a single period, the
454 file or archive member is processed with no modification to its name.
455 Otherwise, its name is replaced with the contents of the line.
456 .Nm
457 will immediately exit with a non-zero exit status if
458 .Dv EOF
459 is encountered when reading a response or if
460 .Pa /dev/tty
461 cannot be opened for reading and writing.
462 .It Fl k
463 Do not overwrite existing files.
464 .It Fl L
465 Follow all symbolic links to perform a logical file system traversal.
466 .It Fl l
467 (The lowercase letter
468 .Dq ell . )
469 Link files.
470 In the
471 .Em copy
472 mode
473 .Pq Fl r Fl w ,
474 hard links are made between the source and destination file hierarchies
475 whenever possible.
476 .It Fl M Ar value
477 Configure the archive normaliser.
478 .Ar value
479 is either a number or a string, optionally prefixed with
480 .Dq no-
481 to turn the flag off.
482 See
483 .Xr cpio 1
484 for a comprehensive list and compatibility notes.
485 .Pp
486 .Bl -tag -width xxxxxx -compact
487 .It Ar inodes
488 0x0001: Serialise inodes, zero device info.
489 .It Ar links
490 0x0002: Store content of hard links only once.
491 .It Ar mtime
492 0x0004: Zero out the file modification time.
493 .It Ar uidgid
494 0x0008: Set owner to 0:0 (root:wheel).
495 .El
496 .Pp
497 This option is only implemented for the cpio, sv4cpio,
498 sv4crc, and ustar file format writing routines.
499 For the ustar format, the
500 .Ar inodes
501 and
502 .Ar links
503 specifiers are ignored.
504 TODO: The
505 .Nm pax
506 frontend should be using the
507 .Fl o
508 option for handling this feature instead.
509 .It Fl n
510 Select the first archive member that matches each
511 .Ar pattern
512 operand.
513 No more than one archive member is matched for each
514 .Ar pattern .
515 When members of type directory are matched, the file hierarchy rooted at that
516 directory is also matched (unless
517 .Fl d
518 is also specified).
519 .It Fl O
520 Force the archive to be one volume.
521 If a volume ends prematurely,
522 .Nm
523 will not prompt for a new volume.
524 This option can be useful for
525 automated tasks where error recovery cannot be performed by a human.
526 .It Fl o Ar options
527 Information to modify the algorithm for extracting or writing archive files
528 which is specific to the archive format specified by
529 .Fl x .
530 In general,
531 .Ar options
532 take the form:
533 .Ar name Ns = Ns Ar value .
534 .Pp
535 The following options are available for the old
536 .Bx
537 .Em tar
538 format:
539 .Pp
540 .Bl -tag -width Ds -compact
541 .It Cm nodir
542 .It Cm write_opt=nodir
543 When writing archives, omit the storage of directories.
544 .El
545 .It Fl P
546 Do not follow symbolic links, perform a physical file system traversal.
547 This is the default mode.
548 .It Fl p Ar string
549 Specify one or more file characteristic options (privileges).
550 The
551 .Ar string
552 option-argument is a string specifying file characteristics to be retained or
553 discarded on extraction.
554 The string consists of the specification characters
555 .Cm a , e , m , o ,
556 and
557 .Cm p .
558 Multiple characteristics can be concatenated within the same string
559 and multiple
560 .Fl p
561 options can be specified.
562 The meanings of the specification characters are as follows:
563 .Bl -tag -width 2n
564 .It Cm a
565 Do not preserve file access times.
566 By default, file access times are preserved whenever possible.
567 .It Cm e
568 .Dq Preserve everything ,
569 the user ID, group ID, file mode bits,
570 file access time, and file modification time.
571 This is intended to be used by
572 .Em root ,
573 someone with all the appropriate privileges, in order to preserve all
574 aspects of the files as they are recorded in the archive.
575 The
576 .Cm e
577 flag is the sum of the
578 .Cm o
579 and
580 .Cm p
581 flags.
582 .It Cm m
583 Do not preserve file modification times.
584 By default, file modification times are preserved whenever possible.
585 .It Cm o
586 Preserve the user ID and group ID.
587 .It Cm p
588 .Dq Preserve
589 the file mode bits.
590 This is intended to be used by a
591 .Em user
592 with regular privileges who wants to preserve all aspects of the file other
593 than the ownership.
594 The file times are preserved by default, but two other flags are offered to
595 disable this and use the time of extraction instead.
596 .El
597 .Pp
598 In the preceding list,
599 .Sq preserve
600 indicates that an attribute stored in the archive is given to the
601 extracted file, subject to the permissions of the invoking
602 process.
603 Otherwise the attribute of the extracted file is determined as
604 part of the normal file creation action.
605 If neither the
606 .Cm e
607 nor the
608 .Cm o
609 specification character is specified, or the user ID and group ID are not
610 preserved for any reason,
611 .Nm
612 will not set the
613 .Dv S_ISUID
614 .Em ( setuid )
615 and
616 .Dv S_ISGID
617 .Em ( setgid )
618 bits of the file mode.
619 If the preservation of any of these items fails for any reason,
620 .Nm
621 will write a diagnostic message to standard error.
622 Failure to preserve these items will affect the final exit status,
623 but will not cause the extracted file to be deleted.
624 If the file characteristic letters in any of the string option-arguments are
625 duplicated or conflict with each other, the one(s) given last will take
626 precedence.
627 For example, if
628 .Fl p Ar eme
629 is specified, file modification times are still preserved.
630 .It Fl r
631 Read an archive file from standard input
632 and extract the specified
633 .Ar file
634 operands.
635 If any intermediate directories are needed in order to extract an archive
636 member, these directories will be created as if
637 .Xr mkdir 2
638 was called with the bitwise inclusive
639 .Tn OR
640 of
641 .Dv S_IRWXU , S_IRWXG ,
642 and
643 .Dv S_IRWXO
644 as the mode argument.
645 When the selected archive format supports the specification of linked
646 files and these files cannot be linked while the archive is being extracted,
647 .Nm
648 will write a diagnostic message to standard error
649 and exit with a non-zero exit status at the completion of operation.
650 .It Fl s Ar replstr
651 Modify the archive member names according to the substitution expression
652 .Ar replstr ,
653 using the syntax of the
654 .Xr ed 1
655 utility regular expressions.
656 .Ar file
657 or
658 .Ar pattern
659 arguments may be given to restrict the list of archive members to those
660 specified.
661 .Pp
662 The format of these regular expressions is:
663 .Pp
664 .Dl /old/new/[gp]
665 .Pp
666 As in
667 .Xr ed 1 ,
668 .Ar old
669 is a basic regular expression (see
670 .Xr re_format 7 )
671 and
672 .Ar new
673 can contain an ampersand
674 .Pq Ql & ,
675 .Ql \e Ns Em n
676 (where
677 .Em n
678 is a digit) back-references,
679 or subexpression matching.
680 The
681 .Ar old
682 string may also contain newline characters.
683 Any non-null character can be used as a delimiter
684 .Po
685 .Ql /
686 is shown here
687 .Pc .
688 Multiple
689 .Fl s
690 expressions can be specified.
691 The expressions are applied in the order they are specified on the
692 command line, terminating with the first successful substitution.
693 .Pp
694 The optional trailing
695 .Cm g
696 continues to apply the substitution expression to the pathname substring,
697 which starts with the first character following the end of the last successful
698 substitution.
699 The first unsuccessful substitution stops the operation of the
700 .Cm g
701 option.
702 The optional trailing
703 .Cm p
704 will cause the final result of a successful substitution to be written to
705 standard error in the following format:
706 .Pp
707 .D1 Em original-pathname No >> Em new-pathname
708 .Pp
709 File or archive member names that substitute to the empty string
710 are not selected and will be skipped.
711 .It Fl T Ar range
712 Allow files to be selected based on a file modification or inode change
713 time falling within the specified time range.
714 The range has the format:
715 .Sm off
716 .Bd -filled -offset indent
717 .Oo Ar from_date Oc Oo ,
718 .Ar to_date Oc Oo /
719 .Oo Cm c Oc Op Cm m Oc
720 .Ed
721 .Sm on
722 .Pp
723 The dates specified by
724 .Ar from_date
725 to
726 .Ar to_date
727 are inclusive.
728 If only a
729 .Ar from_date
730 is supplied, all files with a modification or inode change time
731 equal to or younger are selected.
732 If only a
733 .Ar to_date
734 is supplied, all files with a modification or inode change time
735 equal to or older will be selected.
736 When the
737 .Ar from_date
738 is equal to the
739 .Ar to_date ,
740 only files with a modification or inode change time of exactly that
741 time will be selected.
742 .Pp
743 When
744 .Nm
745 is in the
746 .Em write
747 or
748 .Em copy
749 mode, the optional trailing field
750 .Oo Cm c Oc Op Cm m
751 can be used to determine which file time (inode change, file modification or
752 both) are used in the comparison.
753 If neither is specified, the default is to use file modification time only.
754 The
755 .Cm m
756 specifies the comparison of file modification time (the time when
757 the file was last written).
758 The
759 .Cm c
760 specifies the comparison of inode change time (the time when the file
761 inode was last changed; e.g., a change of owner, group, mode, etc).
762 When
763 .Cm c
764 and
765 .Cm m
766 are both specified, then the modification and inode change times are
767 both compared.
768 .Pp
769 The inode change time comparison is useful in selecting files whose
770 attributes were recently changed or selecting files which were recently
771 created and had their modification time reset to an older time (as what
772 happens when a file is extracted from an archive and the modification time
773 is preserved).
774 Time comparisons using both file times is useful when
775 .Nm
776 is used to create a time based incremental archive (only files that were
777 changed during a specified time range will be archived).
778 .Pp
779 A time range is made up of six different fields and each field must contain two
780 digits.
781 The format is:
782 .Pp
783 .Dl [[[[[cc]yy]mm]dd]HH]MM[.SS]
784 .Pp
785 Where
786 .Ar cc
787 is the first two digits of the year (the century),
788 .Ar yy
789 is the last two digits of the year,
790 the first
791 .Ar mm
792 is the month (from 01 to 12),
793 .Ar dd
794 is the day of the month (from 01 to 31),
795 .Ar HH
796 is the hour of the day (from 00 to 23),
797 .Ar MM
798 is the minute (from 00 to 59),
799 and
800 .Ar SS
801 is the seconds (from 00 to 59).
802 The minute field
803 .Ar MM
804 is required, while the other fields are optional and must be added in the
805 following order:
806 .Ar HH , dd , mm ,
807 .Ar yy , cc .
808 .Pp
809 The
810 .Ar SS
811 field may be added independently of the other fields.
812 Time ranges are relative to the current time, so
813 .Ic -T 1234/cm
814 would select all files with a modification or inode change time
815 of 12:34 PM today or later.
816 Multiple
817 .Fl T
818 time range can be supplied and checking stops with the first match.
819 .It Fl t
820 Reset the access times of any file or directory read or accessed by
821 .Nm
822 to be the same as they were before being read or accessed by
823 .Nm pax .
824 .It Fl U Ar user
825 Select a file based on its
826 .Ar user
827 name, or when starting with a
828 .Cm # ,
829 a numeric UID.
830 A
831 .Ql \e
832 can be used to escape the
833 .Cm # .
834 Multiple
835 .Fl U
836 options may be supplied and checking stops with the first match.
837 .It Fl u
838 Ignore files that are older (having a less recent file modification time)
839 than a pre-existing file or archive member with the same name.
840 During
841 .Em read ,
842 an archive member with the same name as a file in the file system will be
843 extracted if the archive member is newer than the file.
844 During
845 .Em write ,
846 a file system member with the same name as an archive member will be
847 written to the archive if it is newer than the archive member.
848 During
849 .Em copy ,
850 the file in the destination hierarchy is replaced by the file in the source
851 hierarchy or by a link to the file in the source hierarchy if the file in
852 the source hierarchy is newer.
853 .It Fl v
854 During a
855 .Em list
856 operation, produce a verbose table of contents using the format of the
857 .Xr ls 1
858 utility with the
859 .Fl l
860 option.
861 For pathnames representing a hard link to a previous member of the archive,
862 the output has the format:
863 .Pp
864 .Dl Em ls -l listing Li == Em link-name
865 .Pp
866 For pathnames representing a symbolic link, the output has the format:
867 .Pp
868 .Dl Em ls -l listing Li =\*(Gt Em link-name
869 .Pp
870 Where
871 .Em ls -l listing
872 is the output format specified by the
873 .Xr ls 1
874 utility when used with the
875 .Fl l
876 option.
877 Otherwise for all the other operational modes
878 .Po Em read , write , No and Em copy
879 .Pc ,
880 pathnames are written and flushed to standard error
881 without a trailing newline
882 as soon as processing begins on that file or
883 archive member.
884 The trailing newline
885 is not buffered and is written only after the file has been read or written.
886 .It Fl w
887 Write files to the standard output
888 in the specified archive format.
889 When no
890 .Ar file
891 operands are specified, standard input
892 is read for a list of pathnames with one per line without any leading or
893 trailing
894 .Aq blanks .
895 .It Fl X
896 When traversing the file hierarchy specified by a pathname,
897 do not descend into directories that have a different device ID.
898 See the
899 .Li st_dev
900 field as described in
901 .Xr stat 2
902 for more information about device IDs.
903 .It Fl x Ar format
904 Specify the output archive format, with the default format being
905 .Cm ustar .
906 .Nm
907 currently supports the following formats:
908 .Bl -tag -width "sv4cpio"
909 .It Cm cpio
910 The extended cpio interchange format specified in the
911 .St -p1003.2
912 standard.
913 The default blocksize for this format is 5120 bytes.
914 Inode and device information about a file (used for detecting file hard links
915 by this format), which may be truncated by this format, is detected by
916 .Nm
917 and is repaired.
918 .It Cm bcpio
919 The old binary cpio format.
920 The default blocksize for this format is 5120 bytes.
921 This format is not very portable and should not be used when other formats
922 are available.
923 Inode and device information about a file (used for detecting file hard links
924 by this format), which may be truncated by this format, is detected by
925 .Nm
926 and is repaired.
927 .It Cm sv4cpio
928 The System V release 4 cpio.
929 The default blocksize for this format is 5120 bytes.
930 Inode and device information about a file (used for detecting file hard links
931 by this format), which may be truncated by this format, is detected by
932 .Nm
933 and is repaired.
934 .It Cm sv4crc
935 The System V release 4 cpio with file CRC checksums.
936 The default blocksize for this format is 5120 bytes.
937 Inode and device information about a file (used for detecting file hard links
938 by this format), which may be truncated by this format, is detected by
939 .Nm
940 and is repaired.
941 .It Cm tar
942 The old
943 .Bx
944 tar format as found in
945 .Bx 4.3 .
946 The default blocksize for this format is 10240 bytes.
947 Pathnames stored by this format must be 100 characters or less in length.
948 Only
949 .Em regular
950 files,
951 .Em hard links , soft links ,
952 and
953 .Em directories
954 will be archived (other file system types are not supported).
955 For backwards compatibility with even older tar formats, a
956 .Fl o
957 option can be used when writing an archive to omit the storage of directories.
958 This option takes the form:
959 .Pp
960 .Dl Fl o Cm write_opt=nodir
961 .It Cm ustar
962 The extended tar interchange format specified in the
963 .St -p1003.2
964 standard.
965 The default blocksize for this format is 10240 bytes.
966 Filenames stored by this format must be 100 characters or less in length;
967 the total pathname must be 255 characters or less.
968 .El
969 .Pp
970 .Nm
971 will detect and report any file that it is unable to store or extract
972 as the result of any specific archive format restrictions.
973 The individual archive formats may impose additional restrictions on use.
974 Typical archive format restrictions include (but are not limited to):
975 file pathname length, file size, link pathname length, and the type of the
976 file.
977 .It Fl Y
978 This option is the same as the
979 .Fl D
980 option, except that the inode change time is checked using the
981 pathname created after all the file name modifications have completed.
982 .It Fl Z
983 This option is the same as the
984 .Fl u
985 option, except that the modification time is checked using the
986 pathname created after all the file name modifications have completed.
987 .It Fl z
988 Use
989 .Xr gzip 1
990 to compress (decompress) the archive while writing (reading).
991 Incompatible with
992 .Fl a .
993 .El
994 .Pp
995 The options that operate on the names of files or archive members
996 .Po Fl c ,
997 .Fl i ,
998 .Fl n ,
999 .Fl s ,
1000 .Fl u ,
1001 .Fl v ,
1002 .Fl D ,
1003 .Fl G ,
1004 .Fl T ,
1005 .Fl U ,
1006 .Fl Y ,
1007 and
1008 .Fl Z
1009 .Pc
1010 interact as follows.
1011 .Pp
1012 When extracting files during a
1013 .Em read
1014 operation, archive members are
1015 .Sq selected ,
1016 based only on the user specified pattern operands as modified by the
1017 .Fl c ,
1018 .Fl n ,
1019 .Fl u ,
1020 .Fl D ,
1021 .Fl G ,
1022 .Fl T ,
1023 .Fl U
1024 options.
1025 Then any
1026 .Fl s
1027 and
1028 .Fl i
1029 options will modify in that order, the names of these selected files.
1030 Then the
1031 .Fl Y
1032 and
1033 .Fl Z
1034 options will be applied based on the final pathname.
1035 Finally, the
1036 .Fl v
1037 option will write the names resulting from these modifications.
1038 .Pp
1039 When archiving files during a
1040 .Em write
1041 operation, or copying files during a
1042 .Em copy
1043 operation, archive members are
1044 .Sq selected ,
1045 based only on the user specified pathnames as modified by the
1046 .Fl n ,
1047 .Fl u ,
1048 .Fl D ,
1049 .Fl G ,
1050 .Fl T ,
1051 and
1052 .Fl U
1053 options (the
1054 .Fl D
1055 option only applies during a copy operation).
1056 Then any
1057 .Fl s
1058 and
1059 .Fl i
1060 options will modify in that order, the names of these selected files.
1061 Then during a
1062 .Em copy
1063 operation the
1064 .Fl Y
1065 and the
1066 .Fl Z
1067 options will be applied based on the final pathname.
1068 Finally, the
1069 .Fl v
1070 option will write the names resulting from these modifications.
1071 .Pp
1072 When one or both of the
1073 .Fl u
1074 or
1075 .Fl D
1076 options are specified along with the
1077 .Fl n
1078 option, a file is not considered selected unless it is newer
1079 than the file to which it is compared.
1080 .Sh ENVIRONMENT
1081 .Bl -tag -width Fl
1082 .It Ev TMPDIR
1083 Path in which to store temporary files.
1084 .El
1085 .Sh EXAMPLES
1086 Copy the contents of the current directory to the device
1087 .Pa /dev/rst0 :
1088 .Pp
1089 .Dl $ pax -w -f /dev/rst0 \&.
1090 .Pp
1091 Give the verbose table of contents for an archive stored in
1092 .Pa filename :
1093 .Pp
1094 .Dl $ pax -v -f filename
1095 .Pp
1096 This sequence of commands will copy the entire
1097 .Pa olddir
1098 directory hierarchy to
1099 .Pa newdir :
1100 .Bd -literal -offset indent
1101 $ mkdir newdir
1102 $ cd olddir
1103 $ pax -rw . ../newdir
1104 .Ed
1105 .Pp
1106 Read the archive
1107 .Pa a.pax ,
1108 with all files rooted in
1109 .Pa /usr
1110 into the archive extracted relative to the current directory:
1111 .Pp
1112 .Dl $ pax -r -s ',^//*usr//*,,' -f a.pax
1113 .Pp
1114 This can be used to interactively select the files to copy from the
1115 current directory to
1116 .Pa dest_dir :
1117 .Pp
1118 .Dl $ pax -rw -i \&. dest_dir
1119 .Pp
1120 Extract all files from the archive
1121 .Pa a.pax
1122 which are owned by
1123 .Em root
1124 with group
1125 .Em bin
1126 and preserve all file permissions:
1127 .Pp
1128 .Dl "$ pax -r -pe -U root -G bin -f a.pax"
1129 .Pp
1130 Update (and list) only those files in the destination directory
1131 .Pa /backup
1132 which are older (less recent inode change or file modification times) than
1133 files with the same name found in the source file tree
1134 .Pa home :
1135 .Pp
1136 .Dl "$ pax -r -w -v -Y -Z home /backup"
1137 .Sh DIAGNOSTICS
1138 .Nm
1139 will exit with one of the following values:
1140 .Bl -tag -width 2n -offset indent
1141 .It 0
1142 All files were processed successfully.
1143 .It 1
1144 An error occurred.
1145 .El
1146 .Pp
1147 Whenever
1148 .Nm
1149 cannot create a file or a link when reading an archive or cannot
1150 find a file when writing an archive, or cannot preserve the user ID,
1151 group ID, or file mode when the
1152 .Fl p
1153 option is specified, a diagnostic message is written to standard error
1154 and a non-zero exit status will be returned, but processing will continue.
1155 In the case where
1156 .Nm
1157 cannot create a link to a file,
1158 .Nm
1159 will not create a second copy of the file.
1160 .Pp
1161 If the extraction of a file from an archive is prematurely terminated by
1162 a signal or error,
1163 .Nm
1164 may have only partially extracted a file the user wanted.
1165 Additionally, the file modes of extracted files and directories
1166 may have incorrect file bits, and the modification and access times may be
1167 wrong.
1168 .Pp
1169 If the creation of an archive is prematurely terminated by a signal or error,
1170 .Nm
1171 may have only partially created the archive, which may violate the specific
1172 archive format specification.
1173 .Pp
1174 If while doing a
1175 .Em copy ,
1176 .Nm
1177 detects a file is about to overwrite itself, the file is not copied,
1178 a diagnostic message is written to standard error
1179 and when
1180 .Nm
1181 completes it will exit with a non-zero exit status.
1182 .Sh SEE ALSO
1183 .Xr cpio 1 ,
1184 .Xr tar 1
1185 .Sh STANDARDS
1186 The
1187 .Nm
1188 utility is a superset of the
1189 .St -p1003.2
1190 standard.
1191 The options
1192 .Fl 0 ,
1193 .Fl B ,
1194 .Fl D ,
1195 .Fl E ,
1196 .Fl G ,
1197 .Fl H ,
1198 .Fl L ,
1199 .Fl M ,
1200 .Fl O ,
1201 .Fl P ,
1202 .Fl T ,
1203 .Fl U ,
1204 .Fl Y ,
1205 .Fl Z ,
1206 the archive formats
1207 .Em bcpio ,
1208 .Em sv4cpio ,
1209 .Em sv4crc ,
1210 .Em tar ,
1211 and the flawed archive handling during
1212 .Em list
1213 and
1214 .Em read
1215 operations are extensions to the
1216 .Tn POSIX
1217 standard.
1218 .Sh AUTHORS
1219 Keith Muller at the University of California, San Diego.
1220 .Pp
1221 .Mx
1222 extensions by
1223 .An Thorsten Glaser Aq tg@mirbsd.de .

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