bugrdiff-backup - Bugs: bug #25684, Lost ownership data even when...

 
 

bug #25684: Lost ownership data even when using --preserve-numerical-ids option

Submitted by:  None
Submitted on:  Mon 23 Feb 2009 07:43:43 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Invalid
Privacy: PublicAssigned to: None
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 23 Mar 2009 03:21:26 PM UTC, comment #5:

Closing based on last comment.

Andrew Ferguson <owsla>
Project Administrator
Wed 25 Feb 2009 09:17:20 PM UTC, comment #4:

As Chris Wilson says because he has time to write this paragraph:

"As Damon Timm pointed out, preserving any kind of ownership does not work when you run the restore as a non-root user. Unix does not allow non-root users (including rdiff-backup when run on your behalf) to change the owner of files. They will always be owned by the user that you are running as. If you run the restore as root, then ownership should be preserved either by name or by UID."

I've try with the tests done before as root, and they work fine. So its clear that this is not a bug on rdiff-backup, just a security related feature of UNiX systems.

Anonymous
Wed 25 Feb 2009 03:49:04 PM UTC, comment #3:

Well, I can say right up front that the most recent comment is simply not true. It is used. The preserve_numerical_ids flag is used in the function init_user_group_mapping() in Main.py, which passes it to init_user_mapping() in user_group.py from there, it has a new variable name, numerical_ids. Please try reading the source code before making alarming comments.

Sorry I haven't had the time to explain what's going on with this "bug", or why I don't think it is one, but hopefully I can get to it soon.

Andrew Ferguson <owsla>
Project Administrator
Wed 25 Feb 2009 02:27:15 PM UTC, comment #2:

More on this. I do not know nothin about Python -or too less that can be
called "nothing"- but I'm a bit concerned about this grep:

fmmarzoa@durruti:/usr/share/python-support/rdiff-backup/rdiff_backup$ ls
total 496
drwxr-xr-x 2 root root 4096 2008-06-17 22:33 .
drwxr-xr-x 3 root root 4096 2008-06-17 22:33 ..
-rw-r--r-- 1 root root 26566 2008-01-03 16:36 backup.py
-rw-r--r-- 1 root root 9528 2008-01-03 16:36 compare.py
-rw-r--r-- 1 root root 17780 2008-01-03 16:36 connection.py
-rw-r--r-- 1 root root 18700 2008-01-03 16:36 eas_acls.py
-rw-r--r-- 1 root root 8441 2008-01-03 16:36 FilenameMapping.py
-rw-r--r-- 1 root root 27297 2008-01-03 16:36 fs_abilities.py
-rw-r--r-- 1 root root 10577 2008-01-03 16:36 Globals.py
-rw-r--r-- 1 root root 5104 2008-01-03 16:36 Hardlink.py
-rw-r--r-- 1 root root 2141 2008-01-03 16:36 hash.py
-rw-r--r-- 1 root root 3995 2008-01-03 16:36 increment.py
-rw-r--r-- 1 root root 0 2008-01-03 16:36 _init_.py
-rw-r--r-- 1 root root 13185 2008-01-03 16:36 iterfile.py
-rw-r--r-- 1 root root 6037 2008-01-03 16:36 lazy.py
-rw-r--r-- 1 root root 6741 2008-01-03 16:36 librsync.py
-rw-r--r-- 1 root root 9427 2008-01-03 16:36 log.py
-rw-r--r-- 1 root root 9637 2008-01-03 16:36 longname.py
-rw-r--r-- 1 root root 33362 2008-01-03 16:36 Main.py
-rw-r--r-- 1 root root 6864 2008-01-03 16:36 manage.py
-rw-r--r-- 1 root root 24442 2008-01-03 16:36 metadata.py
-rw-r--r-- 1 root root 4367 2008-01-03 16:36 Rdiff.py
-rw-r--r-- 1 root root 13401 2008-01-03 16:36 regress.py
-rw-r--r-- 1 root root 26618 2008-01-03 16:36 restore.py
-rw-r--r-- 1 root root 4694 2008-01-03 16:36 robust.py
-rw-r--r-- 1 root root 11162 2008-01-03 16:36 rorpiter.py
-rw-r--r-- 1 root root 45992 2008-01-03 16:36 rpath.py
-rw-r--r-- 1 root root 9695 2008-01-03 16:36 Security.py
-rw-r--r-- 1 root root 26512 2008-01-03 16:36 selection.py
-rw-r--r-- 1 root root 8788 2008-01-03 16:36 SetConnections.py
-rw-r--r-- 1 root root 1424 2008-01-03 16:36 static.py
-rw-r--r-- 1 root root 14496 2008-01-03 16:36 statistics.py
-rw-r--r-- 1 root root 2454 2008-01-03 16:36 TempFile.py
-rw-r--r-- 1 root root 8595 2008-01-03 16:36 Time.py
-rw-r--r-- 1 root root 6772 2008-01-03 16:36 user_group.py

I think here's all the python stuff of rfidd_backup on my distro, with
the exception of /usr/bin/rdiff-backup that directly uses Main.py. So...

There's just an assigment of 1 to the flag preserve_numerical_ids but
it's not used for nothing nowhere! O_o

fmmarzoa@durruti:/usr/share/python-support/rdiff-backup/rdiff_backup$
grep preserve-numerical-ids *
Main.py: "preserve-numerical-ids", "print-statistics",
Main.py: elif opt == "--preserve-numerical-ids":
preserve_numerical_ids = 1
fmmarzoa@durruti:/usr/share/python-support/rdiff-backup/rdiff_backup$
grep preserve_numerical_ids *
Main.py:user_mapping_filename, group_mapping_filename,
preserve_numerical_ids = \
Main.py: preserve_numerical_ids
Main.py: elif opt == "--preserve-numerical-ids":
preserve_numerical_ids = 1
Main.py: preserve_numerical_ids
Main.py:
preserve_numerical_ids)
Main.py:
preserve_numerical_ids)

I expect to find some kind of "if" structure using that flag in some
other files -like backup.py and/or restore.py- but it isn't there, so I
think that option actually has no effect.

JFTR:
$ rdiff-backup --version
rdiff-backup 1.1.15

Anonymous
Tue 24 Feb 2009 12:29:02 AM UTC, comment #1:

Here is an example with version 1.3.1:

<pre>damon@leaker:~$ mkdir test
damon@leaker:~$ chown damon:tps test/
damon@leaker:~$ touch test/testfile
damon@leaker:~$ chown damon:tps test/testfile
damon@leaker:~$ ls -la test/
total 8
drwxrwxr-x 2 damon tps 4096 2009-02-23 19:26 .
drwxr-xr-x 24 damon damon 4096 2009-02-23 19:26 ..
-rw-rw-r-- 1 damon tps 0 2009-02-23 19:26 testfile
damon@leaker:~$ rdiff-backup --preserve-numerical-ids test/ test-backup/
Warning: Your version of pyxattr (unknown) has broken support for extended
attributes on symlinks. If you choose not to upgrade to a more recent version,
you may see many warning messages from listattr().

Warning: Your version of pyxattr (unknown) has broken support for extended
attributes on symlinks. If you choose not to upgrade to a more recent version,
you may see many warning messages from listattr().

damon@leaker:~$ ls -la test-backup/
total 12
drwxrwxr-x 3 damon damon 4096 2009-02-23 19:26 .
drwxr-xr-x 25 damon damon 4096 2009-02-23 19:27 ..
drwx------ 3 damon damon 4096 2009-02-23 19:27 rdiff-backup-data
-rw-rw-r-- 1 damon damon 0 2009-02-23 19:26 testfile
damon@leaker:~$ rdiff-backup -V
rdiff-backup 1.3.1</pre>

Damon Timm <thornomad>
Mon 23 Feb 2009 07:43:43 PM UTC, original submission:

It seems like rdiff-backup does not preserve uid:gid for each file even when --preserve-numerical-ids its present. See this example:

fmmarzoa@durruti:~$ ls -al test
total 8
drwxr-xr-x 2 fmmarzoa devel 4096 2009-02-23 20:07 .
drwxr-xr-x 77 fmmarzoa fmmarzoa 4096 2009-02-23 20:07 ..
-rw-r--r-- 1 fmmarzoa devel 0 2009-02-23 20:07 testfile

I've a directory called "test" with uid:gid as fmmarzoa:devel, and a testfile within the directory with same ownership. Now I backup it with:

fmmarzoa@durruti:~$ rdiff-backup --preserve-numerical-ids test test_backup
fmmarzoa@durruti:~$ ls -la test_backup
total 12
drwxr-xr-x 3 fmmarzoa fmmarzoa 4096 2009-02-23 20:07 .
drwxr-xr-x 78 fmmarzoa fmmarzoa 4096 2009-02-23 20:10 ..
drwx------ 3 fmmarzoa fmmarzoa 4096 2009-02-23 20:10 rdiff-backup-data
-rw-r--r-- 1 fmmarzoa fmmarzoa 0 2009-02-23 20:07 testfile

So in fact, ownership information has been lost. Obviously restoring just doing a "cp test_backup test" will not recover the ownership data, but restore command neither!:

fmmarzoa@durruti:~$ rdiff-backup -r now test_backup test
fmmarzoa@durruti:~$ ls -la test
total 8
drwxr-xr-x 2 fmmarzoa fmmarzoa 4096 2009-02-23 20:07 .
drwxr-xr-x 78 fmmarzoa fmmarzoa 4096 2009-02-23 20:12 ..
-rw-r--r-- 1 fmmarzoa fmmarzoa 0 2009-02-23 20:07 testfile

fmmarzoa@durruti:~$ rdiff-backup -V
rdiff-backup 1.1.15

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by owsla (Posted a comment)
  • -unavailable- added by thornomad (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 23 Mar 2009 03:21:26 PM UTCowslaStatusNone=>Invalid
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1