Sat 19 May 2007 03:26:52 AM UTC, comment #1:
Here's my patch to catch the OSError that is raised when you try to lstat the "aux" (or any other) special file on a CIFS-mounted Windows share.
I originally fixed one location where it tries to lstat "aux" then found two more :-) So, I am including them in the patch as well.
In fact, it looks like the OSError is raised somewhere in subdir.append("aux") before the lstat is called, but I didn't look too deeply at this. I just wrapped anything that could raise an exception in a try.
I wasn't sure why the original code did an "if device_rp.lstat()" and then, depending on that call, did an "assert device_rp.lstat()" or "assert not device_rp.lstat()", so I changed that in my patch. I don't "do" python, so please correct it if I was wrong. Now, if lstat returns a true value, indicating that "aux" exists (I don't think it can do this on a CIFS-mounted Windows share), or if an OSError is raised (this seems to always happen on a CIFS-mounted Windows share), it will escape dos devices, otherwise it will not.
See also my bug report #19896. After applying this patch and the one from #19896, and the setting LookupCacheEnabled to 0 via proc fs (see #19802), I am able to backup to and restore to a CIFS-mounted Windows share, on linux kernel 2.6.20.
(file #12800)
|
Fri 18 May 2007 03:09:14 AM UTC, original submission:
In fs_abilities.py, set_escape_dos_devices tries to lstat "aux" and raises this error:
Exception '[Errno 13] Permission denied: '/mnt/cifs/winsnap/snapshot/Latin I/rdiff-backup.tmp.23/aux'' raised of class 'exceptions.OSError':
With kernel-2.6.20, on a cifs-mounted Windows share, you get permission denied when you lstat any of the DOS "special" files, such as "aux" and "nul". Simply doing a "ls /path/to/cifs/mount/aux" should show the error.
I found some hints googling for "cifs aux nul" that indicate that it is an error to attempt to access these files over CIFS.
On a NetWare CIFS volume, there is no "aux" so the check works correctly. I assume the same is true for a samba share.
Just for kicks, a cifs kernel debug trace shows something like:
May 17 16:35:59 bkupserv kernel: fs/cifs/inode.c: Getting info on \aux
May 17 16:35:59 bkupserv kernel: fs/cifs/transport.c: For smb_command 50
May 17 16:35:59 bkupserv kernel: fs/cifs/transport.c: Sending smb of length 82
May 17 16:35:59 bkupserv kernel: fs/cifs/connect.c: rfc1002 length 0x27)
May 17 16:35:59 bkupserv kernel: fs/cifs/connect.c: invalid transact2 word count
May 17 16:35:59 bkupserv kernel: Status code returned 0xc0000022 NT_STATUS_ACCESS_DENIED
May 17 16:35:59 bkupserv kernel: fs/cifs/netmisc.c: !!Mapping smb error code 5 to POSIX err -13 !!
May 17 16:35:59 bkupserv kernel: fs/cifs/cifssmb.c: Send error in QPathInfo = -13
May 17 16:35:59 bkupserv kernel: CIFS VFS: Error 0xfffffff3 on cifs_get_inode_info in lookup of \aux
May 17 16:35:59 bkupserv kernel: fs/cifs/dir.c: CIFS VFS: leaving cifs_lookup (xid = 3966) rc = -13
|