:: [DNG] Globbing rsync != tar ?
Top Pagina
Delete this message
Reply to this message
Auteur: Ken Dibble
Datum:  
Aan: dng
Onderwerp: [DNG] Globbing rsync != tar ?
In my never ending quest to cause myself headaches, I have been
experimenting with
different backup methods.

What I am seeing is as follows:
rsync using a .gitignore file and tar using a the same.gitignore file
have different opinions
about globbing.

Here are the commands for reference

rsync -a -r -t -p -o -g -s --exclude-from=.gitignore /home/kdibble
/tmp/backup_test

tar --exclude-vcs-ignores -c /home/kdibble > /tmp/kdibble.tar



According to gnu.org tar 1.34 section 6.4

‘--exclude-vcs-ignores’

    Before archiving a directory, see if it contains any of the
following files: ‘cvsignore’, ‘.gitignore’, ‘.bzrignore’, or
‘.hgignore’. If so, read ignore patterns from these files.

    The patterns are treated much as the corresponding VCS would treat
them, i.e.:


‘.gitignore’

    Contains shell-style globbing patterns. Applies to the directory
where ‘.gitfile’ is located         and all its subdirectories.

    Any line beginning with a ‘#’ is a comment. Backslash escapes the
comment character.



here is /home/kdibble/.gitignore

#.gitignore for home directory
#
.*
Downloads/
vmware/
#
bin/checkhosts/etc_hosts
bin/checkhosts/hosts
!/.gitignore
**/core
**/*.o
**/*.d
**/*.class
**/a.out
**/binary_data
**/perf_data
**/quotient.txt

After rsync:
  $ ls /tmp/backup_test | grep binary_data
  $
  $ ls /tmp/backup_test | grep "o.d"
  $

After tar:
  $ tar tf /tmp/kdibble.tar | grep binary_data
   home/kdibble/NetBeansProjects/factor/binary_data

  $ tar tf /tmp/kdibble.tar | grep "o.d"
home/kdibble/NetBeansProjects/Pell/build/Debug/GNU-Linux-x86/main.o.d
home/kdibble/NetBeansProjects/PollardRho/build/Debug/GNU-Linux/main.o.d
home/kdibble/NetBeansProjects/PollardRho/build/Debug/GNU-Linux-x86/main.o.d

   I understand that the documentation says "much as the corresponding
VCS would treat them"

   but,

   IMHO,

   IF they are not going to work the same, don't make it sound as
though they do work
   the same or name the command line switch like they do. Especially on
utilities used
   for backing up data, where there is an expectation of being able to
restore what
   you intended to back up.

   For reference the '**' glob was apparently introduced with Bash 4 in
2009,
   so it isn't something new.

   Then again, maybe I am missing something....

   Hoping to be enlightened,

   Ken