dumpdir.texi 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. @c This is part of the paxutils manual.
  2. @c Copyright (C) 2006--2023 Free Software Foundation, Inc.
  3. @c Written by Sergey Poznyakoff
  4. @c This file is distributed under GFDL 1.1 or any later version
  5. @c published by the Free Software Foundation.
  6. Incremental archives keep information about contents of each
  7. dumped directory in special data blocks called @dfn{dumpdirs}.
  8. Dumpdir is a sequence of entries of the following form:
  9. @smallexample
  10. @var{C} @var{filename} \0
  11. @end smallexample
  12. @noindent
  13. where @var{C} is one of the @dfn{control codes} described below,
  14. @var{filename} is the name of the file @var{C} operates upon, and
  15. @samp{\0} represents a nul character (ASCII 0). The white space
  16. characters were added for readability, real dumpdirs do not contain
  17. them.
  18. Each dumpdir ends with a single nul character.
  19. The following table describes control codes and their meanings:
  20. @table @samp
  21. @item Y
  22. @var{filename} is contained in the archive.
  23. @item N
  24. @var{filename} was present in the directory at the time the archive
  25. was made, yet it was not dumped to the archive, because it had not
  26. changed since the last backup.
  27. @item D
  28. @var{filename} is a directory.
  29. @item R
  30. This code requests renaming of the @var{filename} to the name
  31. specified with the @samp{T} command, that immediately follows it.
  32. @item T
  33. Specify target file name for @samp{R} command (see below).
  34. @item X
  35. Specify @dfn{temporary directory} name for a rename operation (see below).
  36. @end table
  37. Codes @samp{Y}, @samp{N} and @samp{D} require @var{filename} argument
  38. to be a relative file name to the directory this dumpdir describes,
  39. whereas codes @samp{R}, @samp{T} and @samp{X} require their argument
  40. to be an absolute file name.
  41. The three codes @samp{R}, @samp{T} and @samp{X} specify a
  42. @dfn{renaming operation}. In the simplest case it is:
  43. @smallexample
  44. R@file{source}\0T@file{dest}\0
  45. @end smallexample
  46. @noindent
  47. which means ``rename file @file{source} to file @file{dest}''.
  48. However, there are cases that require using a @dfn{temporary
  49. directory}. For example, consider the following scenario:
  50. @enumerate 1
  51. @item
  52. Previous run dumped a directory @file{foo} which contained the
  53. following three directories:
  54. @smallexample
  55. a
  56. b
  57. c
  58. @end smallexample
  59. @item
  60. They were renamed @emph{cyclically}, so that:
  61. @example
  62. @file{a} became @file{b}
  63. @file{b} became @file{c}
  64. @file{c} became @file{a}
  65. @end example
  66. @item
  67. New incremental dump was made.
  68. @end enumerate
  69. This case cannot be handled by three successive renames, since
  70. renaming @file{a} to @file{b} will destroy the existing directory.
  71. To correctly process it, @GNUTAR{} needs a temporary directory, so
  72. it creates the following dumpdir (newlines have been added for
  73. readability):
  74. @smallexample
  75. @group
  76. Xfoo\0
  77. Rfoo/a\0T\0
  78. Rfoo/b\0Tfoo/c\0
  79. Rfoo/c\0Tfoo/a\0
  80. R\0Tfoo/a\0
  81. @end group
  82. @end smallexample
  83. The first command, @samp{Xfoo\0}, instructs the extractor to create a
  84. temporary directory in the directory @file{foo}. Second command,
  85. @samp{Rfoo/aT\0}, says ``rename file @file{foo/a} to the temporary
  86. directory that has just been created'' (empty file name after a
  87. command means use temporary directory). Third and fourth commands
  88. work as usual, and, finally, the last command, @samp{R\0Tfoo/a\0}
  89. tells tar to rename the temporary directory to @file{foo/a}.
  90. The exact placement of a dumpdir in the archive depends on the
  91. archive format (@pxref{Formats}):
  92. @itemize
  93. @item PAX archives
  94. In PAX archives, dumpdir is stored in the extended header of the
  95. corresponding directory, in variable @code{GNU.dumpdir}.
  96. @item GNU and old GNU archives
  97. These formats implement special header type @samp{D}, which is similar
  98. to ustar header @samp{5} (directory), except that it precedes a data
  99. block containing the dumpdir.
  100. @end itemize
  101. @c End of dumpdir.texi