This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: zipfile: WindowsError [267] The directory name is invalid
Type: behavior Stage: resolved
Components: Library (Lib), Windows Versions: Python 2.6
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: tim.golden Nosy List: ezio.melotti, ggenellina, srid, tim.golden
Priority: normal Keywords:

Created on 2009-07-31 00:12 by srid, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (6)
msg91116 - (view) Author: Sridhar Ratnakumar (srid) Date: 2009-07-31 00:12
The following exception occured when I tried to extract http://
sourceforge.net/projects/slut/files/slut/slut-0.9.0/slut-0.9.0.zip/
download using the zipfile module on Windows XP.

C:\\HOME\\as\\pypm-infinitude\\scratch\\b\\slut-0.9.0.zip.work is 1) 
current working directory 2) directory where the zip file was stored, 
3) directory where the extraction is to happen.

  [...]
    f.extractall()
  File "C:\Python26\lib\zipfile.py", line 935, in extractall
    self.extract(zipinfo, path, pwd)
  File "C:\Python26\lib\zipfile.py", line 923, in extract
    return self._extract_member(member, path, pwd)
  File "C:\Python26\lib\zipfile.py", line 957, in _extract_member
    os.makedirs(upperdirs)
  File "C:\Python26\lib\os.py", line 157, in makedirs
    mkdir(name, mode)
WindowsError: [Error 267] The directory name is invalid: 'C:\\HOME\\as\
\pypm-infinitude\\scratch\\b\\slut-0.9.0.zip.work\\slut-0.9\\aux'
msg91117 - (view) Author: Sridhar Ratnakumar (srid) Date: 2009-07-31 00:16
Shortly following this exception, I tried to create the directory myself

  C:\...> mkdir slut-0.9\aux
  The directory name is invalid.

Curiously, I searched the internet for why a directory named 'aux' 
cannot be created anywhere on the Windows filesystem. The reason - this 
is a 'special' name: http://www.blindedbytech.com/2006/11/16/forbidden-
file-and-folder-names-on-windows/

However, does this mean one can never create a directory named by these 
special names? Apparently .. that is what I think is the case. I cannot 
even create a folder named 'aux' using Windows explorer!
msg91119 - (view) Author: Sridhar Ratnakumar (srid) Date: 2009-07-31 00:29
Let's keep this open as these sort of errors should ideally by wrapped 
under ZipError, no?
msg91219 - (view) Author: Gabriel Genellina (ggenellina) Date: 2009-08-03 07:36
You're right, "aux" is a reserved name on Windows (like prn, con, and a 
few others). There is a way to force the OS to actually create such 
files, but not every tool can handle them correctly.

If the zip file is intended to be Windows-compatible, it should not use 
such names; ask the project developers.
msg91220 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2009-08-03 07:47
See also #481171.
msg113752 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2010-08-13 09:52
Closing as "won't fix": this would be the same if you had any code which tried to do os.mkdir ("aux"). By way of comparison, Info-ZIP's UnZip returns "checkdir error: aux exists but is not directory" which actually seems less useful!

I don't believe it's the responsibility of the zipfile module (or tarfile or bz2 or any other) to silently reinterpret the names of files -- how would any code in the package expecting "aux/code.c" cope with the name change?
History
Date User Action Args
2022-04-11 14:56:51adminsetgithub: 50858
2010-08-13 09:52:40tim.goldensetstatus: open -> closed
messages: + msg113752

assignee: tim.golden
resolution: wont fix
stage: resolved
2010-08-06 15:34:25tim.goldensetnosy: + tim.golden
2009-08-03 07:47:31ezio.melottisetnosy: + ezio.melotti
messages: + msg91220
2009-08-03 07:36:26ggenellinasetnosy: + ggenellina
messages: + msg91219
2009-07-31 00:29:49sridsetmessages: + msg91119
2009-07-31 00:16:44sridsetmessages: + msg91117
2009-07-31 00:12:48sridcreate