[Patches] [ python-Patches-1276378 ] tarfile: adding filed that use direct device addressing

SourceForge.net noreply at sourceforge.net
Thu Sep 1 00:13:40 CEST 2005


Patches item #1276378, was opened at 2005-08-30 09:50
Message generated for change (Comment added) made by birkenfeld
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1276378&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Urban Purkat (urbanp)
Assigned to: Nobody/Anonymous (nobody)
Summary: tarfile: adding filed that use direct device addressing

Initial Comment:
The module tarfile has problems using os.stat() if the
filenames use direct device addressing on Windows systems. 
For example:
\?\GLOBALROOT\Device\HarddiskVolume1\TEMP\1.txt

The following error is reported:
Traceback (most recent call last):
  File "C:\urbanp\py\test.py", line 9, in ?
   
tar.add('\\?\GLOBALROOT\Device\HarddiskVolume1\TEMP\1.txt',
'TEMP\1.txt')
  File "C:\PROGRA~1\Python23\lib\tarfile.py", line
1204, in add
    tarinfo = self.gettarinfo(name, arcname)
  File "C:\PROGRA~1\Python23\lib\tarfile.py", line
1080, in gettarinfo
    statres = os.lstat(name)
OSError: [Errno 2] No such file or directory:
'\\?\GLOBALROOT\Device\HarddiskVolume1\TEMP\1.txt'

As a solution we can use win32file.GetFileAttributesEx().
I mapped win32file.GetFileAttributesEx result into a
tuple that has the same structure as a os.stat result
tuple. Therefore, the same variable can be used.

The reason for using direct device addressing is that I
need to create a tar package from a volume snapshot
(vss on Windows 2003) that cannot be mounted.
The solution also works on StorageCraft VSnap snapshots.

----------------------------------------------------------------------

>Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-09-01 00:13

Message:
Logged In: YES 
user_id=1188172

I don't know whether direct device addressing is officially
supported by any part of Python anyway.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1276378&group_id=5470


More information about the Patches mailing list