summaryrefslogtreecommitdiff
path: root/doc/dumpdir.texi
blob: 9ded73d857ed01b5f25959a24ddc97fe6d57c8df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
@c This is part of the paxutils manual.
@c Copyright (C) 2006-2007, 2014, 2016 Free Software Foundation, Inc.
@c Written by Sergey Poznyakoff
@c This file is distributed under GFDL 1.1 or any later version
@c published by the Free Software Foundation.

  Incremental archives keep information about contents of each
dumped directory in special data blocks called @dfn{dumpdirs}.

  Dumpdir is a sequence of entries of the following form:

@smallexample
@var{C} @var{filename} \0
@end smallexample

@noindent
where @var{C} is one of the @dfn{control codes} described below,
@var{filename} is the name of the file @var{C} operates upon, and
@samp{\0} represents a nul character (ASCII 0).  The white space
characters were added for readability, real dumpdirs do not contain
them.

  Each dumpdir ends with a single nul character.

  The following table describes control codes and their meanings:

@table @samp
@item Y
@var{filename} is contained in the archive.

@item N
@var{filename} was present in the directory at the time the archive
was made, yet it was not dumped to the archive, because it had not
changed since the last backup.

@item D
@var{filename} is a directory.

@item R
This code requests renaming of the @var{filename} to the name
specified with the @samp{T} command, that immediately follows it.

@item T
Specify target file name for @samp{R} command (see below).

@item X
Specify @dfn{temporary directory} name for a rename operation (see below).
@end table

  Codes @samp{Y}, @samp{N} and @samp{D} require @var{filename} argument
to be a relative file name to the directory this dumpdir describes,
whereas codes @samp{R}, @samp{T} and @samp{X} require their argument
to be an absolute file name.

 The three codes @samp{R}, @samp{T} and @samp{X} specify a
@dfn{renaming operation}.  In the simplest case it is:

@smallexample
R@file{source}\0T@file{dest}\0
@end smallexample

@noindent
which means ``rename file @file{source} to file @file{dest}''.

  However, there are cases that require using a @dfn{temporary
directory}.  For example, consider the following scenario:

@enumerate 1
@item
Previous run dumped a directory @file{foo} which contained the
following three directories:

@smallexample
a
b
c
@end smallexample

@item
They were renamed @emph{cyclically}, so that:

@example
@file{a} became @file{b}
@file{b} became @file{c}
@file{c} became @file{a}
@end example

@item
New incremental dump was made.
@end enumerate

  This case cannot be handled by three successive renames, since
renaming @file{a} to @file{b} will destroy the existing directory.
To correctly process it, @GNUTAR{} needs a temporary directory, so
it creates the following dumpdir (newlines have been added for
readability):

@smallexample
@group
Xfoo\0
Rfoo/a\0T\0
Rfoo/b\0Tfoo/c\0
Rfoo/c\0Tfoo/a\0
R\0Tfoo/a\0
@end group
@end smallexample

  The first command, @samp{Xfoo\0}, instructs the extractor to create a
temporary directory in the directory @file{foo}.  Second command,
@samp{Rfoo/aT\0}, says ``rename file @file{foo/a} to the temporary
directory that has just been created'' (empty file name after a
command means use temporary directory).  Third and fourth commands
work as usual, and, finally, the last command, @samp{R\0Tfoo/a\0}
tells tar to rename the temporary directory to @file{foo/a}.

  The exact placement of a dumpdir in the archive depends on the
archive format (@pxref{Formats}):

@itemize
@item PAX archives

In PAX archives, dumpdir is stored in the extended header of the
corresponding directory, in variable @code{GNU.dumpdir}.

@item GNU and old GNU archives

These formats implement special header type @samp{D}, which is similar
to ustar header @samp{5} (directory), except that it precedes a data
block containing the dumpdir.
@end itemize

@c End of dumpdir.texi