[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2014-03-28 Thread Guido van Rossum

Guido van Rossum added the comment:

For anyone watching this still, the fix introduced in this issue caused a 
security vulnerability, see http://bugs.python.org/issue21082 .

--
nosy: +gvanrossum

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-12-02 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

Georg Brandl patched the doc changes in r86931.
Ray, for future reference, you might take a look, particularly 

-.. function:: makedirs(path[, mode][, exist_ok=False])
+.. function:: makedirs(path, mode=0o777, exist_ok=False)

In 3.x, (as opposed to 2.x), the style for params with default args is to give 
the default if possible, *without* [] now, so the signature in the doc looks as 
in a def statement. I, of course, missed this.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-12-02 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Well, you're not to blame since the patch merely extended the definition which 
was still using obsolete syntax anyway.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-12-02 Thread Ray.Allen

Ray.Allen ysj@gmail.com added the comment:

Oh, yes, I missed that, too. I didn't pay attention to that. Thanks for  
pointing out it and fix it!

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-12-01 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

I removed trailing '\' and whitespace, refreshed against current repository, 
removing conflicts, and committed. r86930

--
assignee: georg.brandl - terry.reedy
resolution: accepted - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-11-28 Thread Ray.Allen

Ray.Allen ysj@gmail.com added the comment:

Thanks for Terry's addition to the patch! 

On my python3.2a3 on windows(also copied os.py and test_os.py to the 
installation), I only get the tow os.link errors. And this is because the 
python3.2a3 hasn't the os.link function, and the test.LinkTests in test_os.py 
is added later after python3.2a3, at r86733.

I don't know Why is there a WindowsError in time.sleep(), but I cannot 
reproduce this Error.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-11-28 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

Afaik, those error have nothing to do with this issue. I just included them for 
completeness in case they were helpful to GB.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-11-27 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Patch still applies without errors.  Georg, since you reviewed the patch and 
approved it for 3.2, I’m marking as pending and assigning to you.  Tell me if I 
shouldn’t have.

--
assignee:  - georg.brandl
status: open - pending

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-11-27 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

Patch is missing version-added directive and News entry. I will try to add 
these and re-upload for final check.

--
status: pending - open

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-11-27 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

I applied mkdir.diff, 08-07, patch to my current working copy, added 
version-added and News entry (with credit to Ray Allen) and added Ray Allen to 
ACKS. Uploaded as mkdirs.tr.diff

I suspect a complete test should include a linux system, but I copied os.py and 
test_os.py to my WinXP 3.2a3 installation and in IDLE ran
 from test.test_os import test_main as f; f()

The mkdir tests passed, but for what is is worth, 3 others did not:
(I have no interpretation or comment on these ;-)
==
ERROR: test_CTRL_BREAK_EVENT (test.test_os.Win32KillTests)
--
Traceback (most recent call last):
  File C:\Programs\Python32\lib\test\test_os.py, line 1137, in 
test_CTRL_BREAK_EVENT
self._kill_with_event(signal.CTRL_BREAK_EVENT, CTRL_BREAK_EVENT)
  File C:\Programs\Python32\lib\test\test_os.py, line , in 
_kill_with_event
time.sleep(0.5)
WindowsError: [Error 6] The handle is invalid

==
ERROR: test_link (test.test_os.LinkTests)
--
Traceback (most recent call last):
  File C:\Programs\Python32\lib\test\test_os.py, line 906, in test_link
self._test_link(self.file1, self.file2)
  File C:\Programs\Python32\lib\test\test_os.py, line 901, in _test_link
os.link(file1, file2)
AttributeError: 'module' object has no attribute 'link'

==
ERROR: test_link_bytes (test.test_os.LinkTests)
--
Traceback (most recent call last):
  File C:\Programs\Python32\lib\test\test_os.py, line 910, in test_link_bytes
bytes(self.file2, sys.getfilesystemencoding()))
  File C:\Programs\Python32\lib\test\test_os.py, line 901, in _test_link
os.link(file1, file2)
AttributeError: 'module' object has no attribute 'link'

--
Added file: http://bugs.python.org/file19849/mkdirs.tr.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-11-27 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

All tests pass on my Debian.

(I suggest removing the unnecessary backslash before committing.)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-11-27 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

\ at end of os.py addition

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-08-07 Thread Ray.Allen

Ray.Allen ysj@gmail.com added the comment:

Since the patch cannot be applied to py3k cleanly, I update it.

--
Added file: http://bugs.python.org/file18422/mkdir.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-08-03 Thread Ray.Allen

Ray.Allen ysj@gmail.com added the comment:

 Doc review: Small typo, Flase vs False.  Also, exceptions are raised rather 
 than thrown in Python land (same for the docstring).  Both exception 
 references should be :exc:`OSError`.

Here fixed these doc problems. Thanks for reviewing! Besides, the reason why I 
use throw rather than raise is that I found current Doc use throw an 
exception, so I think an exception is thrown. ^_^

--
Added file: http://bugs.python.org/file18338/mkdir.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-08-03 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Thanks for bringing that up, I've now fixed all these instances of throw that 
should be raise.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-08-02 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Doc review: Small typo, Flase vs False.  Also, exceptions are raised rather 
than thrown in Python land (same for the docstring).  Both exception 
references should be :exc:`OSError`.

Otherwise, looks fine to me.

Raising priority; this should go into 3.2.

--
nosy: +georg.brandl
priority: normal - critical

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-07-28 Thread Ray.Allen

Ray.Allen ysj@gmail.com added the comment:

I updated the patch. Now the patch:

suppress the OSError if and only if the target directory with the same mode as 
we specified already exists.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-07-28 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com added the comment:

You haven't attached the new patch.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-07-28 Thread Ray.Allen

Ray.Allen ysj@gmail.com added the comment:

Oh, sorry, here is the patch.

--
Added file: http://bugs.python.org/file18229/mkdir.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-07-27 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

If I understand, this makes the change minimal: exist_ok means that if *name* 
already exists as a directory with the specified permissions, then do not raise 
an error. OK with me. Make sure doc and doc string say something like that.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-07-27 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

 if *name* already exists as a directory with the specified
 permissions, then do not raise an error.

AFAICT, the code in the patch does not check permissions of the existing 
path(s) or even whether it is a directory or not.

--
nosy: +belopolsky

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-07-27 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

Yes, Arfrever brought that up and the question now is whether and how to revise 
it.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-07-27 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com added the comment:

'mkdir -p' prints error when target exists and is non-directory:

$ cd /tmp 
$ touch file
$ mkdir -p file
mkdir: cannot create directory `file': File exists

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-07-26 Thread Ray.Allen

Ray.Allen ysj@gmail.com added the comment:

Oh, I'm sorry, I forgot about that case. 

I agree with Arfrever, we should suppress the OSError only if the target file 
exists as a directory, but not other types. That is, the exist_ok argument in 
makedirs() should mean dir existing is ok, only existing of the exact same 
thing as we specified to create is ok, not other things. I will fixed this 
later. 

Besides, I wonder what should we do if the target directory exists but with a 
different mode than we specified(if we specified the mode argument). I guess 
we should also raise the OSError because the existing thing is not the same as 
what we want.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-07-26 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com added the comment:

Alternatively you could call os.chmod.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-07-26 Thread Ray.Allen

Ray.Allen ysj@gmail.com added the comment:

I feel we do too much things in such a function if we change the mod the target 
directory to the mod we specified. Does anybody feel such behavior maybe 
dangerous? Because if the function success, we know nothing about weather we 
create a new directory or we convert an existing directory to the directory we 
need.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-07-26 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

What does mkdir -p do, which would at least be a starting point?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-07-26 Thread Ray.Allen

Ray.Allen ysj@gmail.com added the comment:

I want to explain mkdir -p as this:

We want to create a specified directory, if such a directory doesn't exist, 
then create it. If such a directory already exists, then we have already 
reached our goal, do nothing.

While we port this function to os.makedir(), there is a more specified 
information of the target directory, the mode. If the target directory 
already exists but with a different mode, we need not create it, but we haven't 
reach our goal, yet. So we can raise a exception.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-07-26 Thread Guido van Rossum

Changes by Guido van Rossum gu...@python.org:


--
nosy:  -gvanrossum

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-07-24 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
title: os.mkdir() and os.makedirs() add a keyword argument to suppress File 
exists exception. - os.makedirs(): Add a keyword argument to suppress File 
exists exception

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-07-24 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

Ray, what does mkdir -p do if the last target name exists but is a regular file 
rather than a directory? A slightly separate question is 'What do we want 
mkdirs to do (in this case)?'

--
stage: patch review - commit review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com