flexbackup-1.2.1-spaces-in-filenames.patch 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. Index: flexbackup
  2. ===================================================================
  3. --- flexbackup (.../tags/flexbackup-1.2.1-r5) (revision 784)
  4. +++ flexbackup (.../trunk) (revision 784)
  5. @@ -1301,8 +1301,8 @@
  6. $cmd .= "$::unz";
  7. }
  8. $cmd .= "(";
  9. - $cmd .= "mkdir -p $::device ; ";
  10. - $cmd .= "cd $::device ; ";
  11. + $cmd .= "mkdir -p \"$::device\" ; ";
  12. + $cmd .= "cd \"$::device\" ; ";
  13. $cmd .= "$::path{cpio} -i ";
  14. $cmd .= "-m ";
  15. $cmd .= "-d ";
  16. @@ -1351,9 +1351,8 @@
  17. # Have to take leading './' off to make rsync's include/exclude work right
  18. $cmd .= " | $::path{sed} -e \"s/\\.\\///g\" | ";
  19. -
  20. $cmd .= "$::path{rsync} ";
  21. - $cmd .= "--include-from=- --exclude=* ";
  22. + $cmd .= "--files-from=- ";
  23. $cmd .= "--archive ";
  24. $cmd .= "$::rsync_verb_flag ";
  25. $cmd .= "--delete --delete-excluded ";
  26. @@ -1368,7 +1367,7 @@
  27. $cmd .= "$remote:";
  28. }
  29. }
  30. - $cmd .= "$dir/ $::device";
  31. + $cmd .= "\"$dir/\" \"$::device\"";
  32. push(@cmds, $cmd);
  33. @@ -1658,7 +1657,9 @@
  34. my $tmpfile = "$cfg::tmpdir/ar.$PROCESS_ID";
  35. my $remove = '';
  36. - &log("| NOTE: ar archives will not descend directories");
  37. + &log("| NOTE: ar archives will not recurse into subdirectories,");
  38. + &log("| which makes them inappropriate for most backups.");
  39. + &log("| Be sure this is what you want.");
  40. if (defined($remote) and ($level != 0)) {
  41. my $time = &get_last_date($label, $level, 'numeric');
  42. @@ -1682,11 +1683,13 @@
  43. $cmd = "cd \"$dir\" && ";
  44. $cmd .= &file_list_cmd( $dir, $stamp, 'newline', $level, $remote, '-maxdepth 1 ! -type d');
  45. $cmd .= "> $filelist; ";
  46. + # Escape any spaces in filenames.
  47. + $cmd .= "$::path{sed} -i -e 's/ /\\\\ /g' $filelist; ";
  48. $cmd .= "$::path{ar} rc";
  49. $cmd .= "$::ar_verb_flag ";
  50. $cmd .= "$tmpfile ";
  51. - $cmd .= "`$::path{cat} $filelist`";
  52. + $cmd .= "\@$filelist ";
  53. $cmd .= "; $::path{cat} $tmpfile $::z";
  54. # Buffer both sides if remote
  55. @@ -1800,12 +1803,9 @@
  56. $cmd = "cd \"$dir\" && ";
  57. $cmd .= &file_list_cmd( $dir, $stamp, 'newline', $level, $remote);
  58. - $cmd .= "> $filelist; ";
  59. -
  60. - $cmd .= "$::path{lha} a";
  61. + $cmd .= " | $::path{lha} a";
  62. $cmd .= "$::lha_verb_flag ";
  63. $cmd .= "$tmpfile ";
  64. - $cmd .= "`$::path{cat} $filelist`";
  65. $cmd .= "; $::path{cat} $tmpfile $::z";
  66. # Buffer both sides if remote
  67. @@ -2766,6 +2766,7 @@
  68. $::path{'dd'} = &checkinpath('dd');
  69. $::path{'printf'} = &checkinpath('printf');
  70. $::path{'mkdir'} = &checkinpath('mkdir');
  71. + $::path{'sed'} = &checkinpath('sed');
  72. push(@::remoteprogs,($::path{'touch'},$::path{'rm'},$::path{'find'},$::path{'printf'},$::path{'mkdir'}));
  73. @@ -4894,9 +4895,9 @@
  74. $rex .= '\)"';
  75. }
  76. # Show what the darn thing is constructing for prune expressions.
  77. - &log("| \"find\" regex for pruning is:");
  78. - &log("| $rex");
  79. - &line();
  80. + (my $temp = $rex) =~ s/\\([()|])/$1/g;
  81. + &log("| \"find\" regex for pruning (shell escaping omitted for clarity) is:");
  82. + &log("| $temp");
  83. $cmd .= '-regex ' . $rex . ' -prune -o ';
  84. } else {
  85. # Show what the darn thing is constructing for prune expressions.
  86. @@ -4906,6 +4907,7 @@
  87. # don't have permissions on and are running as non-root)
  88. $cmd .= "-depth ";
  89. }
  90. + &line();
  91. $cmd .= "$::mountpoint_flag ";
  92. $cmd .= "! -type s ";
  93. @@ -5301,12 +5303,14 @@
  94. print $::msg "| Checking '$cfg::buffer' on this machine... ";
  95. $pipecmd = "sh $tmp_script ";
  96. } else {
  97. + $pipecmd =
  98. + "$::remoteshell $host '$::path{mkdir} -p $cfg::tmpdir'; " .
  99. + "cat $tmp_script | ($::remoteshell $host 'cat > $tmp_script; " .
  100. + "sh $tmp_script; rm -rf $cfg::tmpdir')";
  101. print $::msg "| Checking '$cfg::buffer' on host $host... ";
  102. - $pipecmd = "$::remoteshell $host '$::path{mkdir} -p $cfg::tmpdir'; cat $tmp_script | ($::remoteshell $host 'cat > $tmp_script; sh $tmp_script; rm -rf $cfg::tmpdir')";
  103. }
  104. if (!defined($::debug)) {
  105. -
  106. open(PIPE,"$pipecmd |") || die;
  107. $explicit_success = 0;
  108. Index: flexbackup.conf
  109. ===================================================================
  110. --- flexbackup.conf (.../tags/flexbackup-1.2.1-r5) (revision 784)
  111. +++ flexbackup.conf (.../trunk) (revision 784)
  112. @@ -12,19 +12,27 @@
  113. # Configure backup "sets".
  114. # Not needed if you use "-dir <dir>" to backup one tree at a time.
  115. -# Each set is a simple space-separated list of filesystems
  116. -# Remote filesystems should denoted as 'host:dir'
  117. -# You can use anything (other than 'all') as set names
  118. -#
  119. -# Example:
  120. -# $set{'set1'} = "/home /usr";
  121. -# $set{'set2'} = "/dir3 machine2:/dir4 machine3:/dir5";
  122. +# Each set is a simple space-separated list of filesystems. Remote filesystems
  123. +# should denoted as 'host:dir'. If the filesystem name (local or remote)
  124. +# contains spaces, then it should be enclosed in its entirety in double quotes.
  125. +# Multiple quoted filesystems included in a set should be space separated just
  126. +# like unquoted filesystem. The Perl '.' string concatenation operator can be
  127. +# used to split excessively long lines.
  128. +#
  129. +# You can use anything (other than 'all') as set names.
  130. +#
  131. +# Examples:
  132. +# $set{'set1'} = '/home /usr';
  133. +# $set{'set2'} = '/dir3 machine2:/dir4 machine3:/dir5';
  134. +# $set{'set3'} =
  135. +# '"/mnt/winmachine1/Documents and Settings" ' .
  136. +# '"/mnt/winmachine1/Program Files"';
  137. #
  138. # "-set all" will back up all defined sets. If you are doing a full backup
  139. # using tapes, each "set" will go onto a different tape and you will be
  140. # prompted for tape change in between.
  141. #
  142. -$set{'backup'} = "/home";
  143. +$set{'backup'} = '/home';
  144. # Subtree pruning
  145. # A space-separated list of directories to prune from each backup.
  146. @@ -42,7 +50,7 @@
  147. # start with "./". To be helpful, FlexBackup packages each space-separated
  148. # prune directory as follows. If you have a prune list like this
  149. #
  150. -# $prune{'/somedir'} = "one two three";
  151. +# $prune{'/somedir'} = 'one two three';
  152. #
  153. # then, the constructed -regex argument to "find" looks like this
  154. #
  155. @@ -54,31 +62,38 @@
  156. # terms that match the current base directory in the set you're backing
  157. # up. For example, if your backup set definition looks like this
  158. #
  159. -# $set{'daily'} = "/home /root /var /usr";
  160. +# $set{'daily'} = '/home /root /var /usr';
  161. #
  162. # and you want to do some exclusions in "/home" and "/var" (but not the other
  163. # directories), you must set up a prune list for those two directories
  164. # separately. For example, to exclude bert's and ernie's home directories plus
  165. # /var/tmp, you would need the following:
  166. #
  167. -# $prune{'/home'} = "bert ernie";
  168. -# $prune{'/var'} = "tmp";
  169. +# $prune{'/home'} = 'bert ernie';
  170. +# $prune{'/var'} = 'tmp';
  171. #
  172. # In particular, combining these *does not* work. For example, this
  173. #
  174. -# $prune{'/'} = "home/bert home/ernie var/tmp";
  175. +# $prune{'/'} = 'home/bert home/ernie var/tmp';
  176. #
  177. # doesn't work, unless, of course, your backup set is backing up "/",
  178. # which our example is not.
  179. #
  180. +# Like the $set configuration item, special handling is required for
  181. +# directories with spaces in them. Double quotes should surround pruning
  182. +# targets but not the key. Example:
  183. +#
  184. +# $prune{'/mnt/winmachine1/Documents and Settings'} =
  185. +# '"user1/Local Settings/Temp" user2';
  186. +#
  187. # Many other complex and abstruse variations are possible. Here's one
  188. # interesting corner case. If you want to preserve a directory but none of its
  189. # contents, you can do it. Picking on ernie from our previous example, preserve
  190. # only his home directory:
  191. #
  192. -# $prune{'/home'} = "ernie/.*";
  193. +# $prune{'/home'} = 'ernie/.*';
  194. #
  195. -$prune{'/'} = "tmp proc";
  196. +$prune{'/'} = 'tmp proc';
  197. # Compression
  198. $compress = 'gzip'; # one of false/gzip/bzip2/lzop/zip/compress/hardware/lzma
  199. Index: flexbackup.conf.5
  200. ===================================================================
  201. --- flexbackup.conf.5 (.../tags/flexbackup-1.2.1-r5) (revision 784)
  202. +++ flexbackup.conf.5 (.../trunk) (revision 784)
  203. @@ -24,25 +24,51 @@
  204. .TP
  205. \fB$set{\fI'tag'\fR}\fR = \fI'/dir'\fR;
  206. Configure backup \(dqsets\(dq. Not needed if \(dq-dir <dir>\(dq is used to
  207. -backup one tree at a time. Each set is a simple space-separated list of
  208. -filesystems/directories. Remote filesystems should be denoted as
  209. -\(dqhost:directory\(dq. You can use anything (other than \fI'all'\fR) as set
  210. -names. Using \(dq-set all\(dq will back up all defined sets. If you are doing
  211. -a full backup using tapes, each \(dqset\(dq will go onto a different tape and
  212. -you will be prompted for tape change in between. Examples:
  213. +backup one tree at a time.
  214. +Each set is a simple space-separated list of filesystems/directories.
  215. +Remote filesystems should be denoted as \(dqhost:directory\(dq.
  216. +You can use anything (other than \fI'all'\fR) as set names.
  217. +Using \(dq-set all\(dq will back up all defined sets.
  218. +If you are doing a full backup using tapes, each \(dqset\(dq will go onto a
  219. +different tape and you will be prompted for tape change in between.
  220. +Examples:
  221. .RS
  222. .PP
  223. \fB$set{\fI'set1'\fI}\fR = \fI'/home /usr'\fR;
  224. .br
  225. \fB$set{\fI'set2'\fI}\fR = \fI'/dir3 machine2:/dir4 machine3:/dir5'\fR;
  226. +.br
  227. +.PP
  228. +Directories (local or remote) with spaces in their names should be enclosed in
  229. +their entirety in double quotes.
  230. +Multiple quoted directories included in a set should be space separated just
  231. +like unquoted directories.
  232. +The Perl '.' string concatenation operator can be used to split excessively
  233. +long sets.
  234. +Example:
  235. +.PP
  236. +\fB$set{\fI'set3'\fI}\fR = \fI
  237. + '\(dq/mnt/winmachine1/Documents and Settings\(dq ' .
  238. + '\(dq/mnt/winmachine1/Program Files\(dq';\fR
  239. .RE
  240. .TP
  241. \fB$prune{\fI'/'\fR}\fR = \fI'tmp proc'\fR;
  242. Configure subtree pruning. A space-separated list of directories to prune from
  243. each backup. Key is a filesystem/directory or \(dqhost:directory\(dq spec as
  244. -outlined above. Regular expressions allowed (not shell-type wildcards!). There
  245. -is additional explanation (and a lot of examples) in the provided configuration
  246. -file.
  247. +outlined above. Regular expressions allowed (not shell-type wildcards!).
  248. +.RS
  249. +.PP
  250. +Like the \fB$set\fR configuration item, special handling is required for
  251. +directories with spaces in them. Double quotes should surround pruning targets
  252. +but not the key. Example:
  253. +.PP
  254. +\fB$prune{\fI'/mnt/winmachine1/Documents and Settings'\fI}\fR =
  255. + \fI'\(dquser1/Local Settings/Temp\(dq user2'\fR;
  256. +.br
  257. +.PP
  258. +There are lots of examples and additional explanation in the provided sample
  259. +configuration file.
  260. +.RE
  261. .TP
  262. \fB$compress\fR = \fI'false|gzip|bzip2|lzop|zip|compress|hardware'\fR;
  263. .TQ
  264. @@ -207,7 +233,7 @@
  265. .RS
  266. .TP
  267. If GNU \fBtar\fR is called \fB\(dqgtar\(dq\fR on your system:
  268. -\fB$path{'tar'} = 'gtar';
  269. +\fB$path{'tar'} = 'gtar';\fR
  270. .TP
  271. Or it can be used to \fB\(dqsudo\(dq\fR certain commands:
  272. \fB$path{\fI'find'\fR}\fR = \fI'sudo find'\fR;
  273. @@ -304,3 +330,6 @@
  274. Written by Edwin Huffstutler (edwinh@computer.org)
  275. .SH "SEE ALSO"
  276. \fBflexbackup\fR(1)
  277. +.\" Local Variables:
  278. +.\" mode: nroff
  279. +.\" End: