[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-06-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e2ccfb096e6a by Brett Cannon in branch 'default':
Issue #17222: fix a mix-up in some exception messages.
http://hg.python.org/cpython/rev/e2ccfb096e6a

--

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



[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-06-17 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
resolution:  - fixed
status: open - closed

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



[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-06-17 Thread Arfrever Frehtes Taifersar Arahesis

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


--
stage:  - committed/rejected

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



[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-06-16 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis added the comment:

Exception messages are wrong. They contain name of source file instead of 
target file.

--
resolution: fixed - 
stage: committed/rejected - 
status: closed - open

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



[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-06-14 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

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



[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-06-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 46ef1d2af352 by Brett Cannon in branch 'default':
Issue #17222: Raise FileExistsError when py_compile.compile would
http://hg.python.org/cpython/rev/46ef1d2af352

--

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



[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-06-05 Thread Armin Rigo

Armin Rigo added the comment:

Brett: I don't really have a constructive opinion on this matter.  I could 
suggest putting a bit more logic in py_compile.compile(cfile=...) to revert to 
the old behavior if we specify an already-existing target, in order to fix the 
other reported issue that custom permissions set on the target file are lost.  
But I would understand if you decide that this is not compatible with the gains 
of atomic file creations.  I only have a problem with replacing block devices 
with regular files.  I don't have a particular opinion if the target file is a 
symlink (as long, of course, as it doesn't lead to whatever it points to being 
replaced, but it shouldn't).

--

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



[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-06-05 Thread Brett Cannon

Brett Cannon added the comment:

Thanks for the clarification, Armin!

--

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



[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-06-05 Thread Brett Cannon

Brett Cannon added the comment:

OK, so here was what a patch will need:

* Change py_compile to raise an exception when ``not os.path.isfile(cfile) or 
os.path.islink(cfile)``; probably raise ValueError and mention that import 
itself would replace the file w/o raising an exception
* Add tests
* Update the docs for py_compile
* Update What's New for 3.4 since this is not backwards-compatible

--
components: +Library (Lib) -Documentation
resolution: fixed - 

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



[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-06-05 Thread Brett Cannon

Brett Cannon added the comment:

I'm going to resolve this issue myself, but blog about it on core-mentorship 
so others can follow along with how I resolve the bug.

--
assignee:  - brett.cannon

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



[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-06-04 Thread Brett Cannon

Brett Cannon added the comment:

I'm going to toss Armin's request over to core-mentorship since the fix is 
easy. Is all you are after, Armin, a ``not os.path.isfile(cfile) or 
os.path.islink(cfile)`` check which if true raises an exception?

--
assignee: brett.cannon - 
status: closed - open

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



[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-06-04 Thread Armin Rigo

Armin Rigo added the comment:

That's not really what I'm after, but that's a workaround I proposed to avoid 
the worst breakage.  I don't have an opinion about what to do with symlinks.

--

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



[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-06-04 Thread Brett Cannon

Brett Cannon added the comment:

Armin: I'm going off of http://bugs.python.org/msg189428 where you say you want 
an exception raised. If there is something else you want to suggest that's fine 
as long as it's not to revert the semantics since I'm not willing to do that.

--

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



[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-05-23 Thread Brett Cannon

Brett Cannon added the comment:

If someone wants to submit a patch to make the change that's fine, but they are 
going to have the same issue when they simply execute an import that 
byte-compiles as a side-effect so you will have to decide if you are only 
worried about py_compile.

--

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



[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-05-17 Thread Arfrever Frehtes Taifersar Arahesis

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


--
title: py_compile.compile() explicitly sets st_mode for written files - 
py_compile.compile() replaces target files, breaking special files and symlinks

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



[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-02-17 Thread Arfrever Frehtes Taifersar Arahesis

New submission from Arfrever Frehtes Taifersar Arahesis:

Since d4eb02b6aac9 py_compile.compile() replaces target files, breaking special 
files and symlinks. Any custom permissions set on target files are also lost. 
This is a major regression.

# cd /tmp
# touch test.py
# ls -l /dev/null
crw-rw-rw- 1 root root 1, 3 Feb 17 21:16 /dev/null
# python3.3 -c 'import py_compile; py_compile.compile(test.py, 
cfile=/dev/null)'
# ls -l /dev/null
crw-rw-rw- 1 root root 1, 3 Feb 17 21:16 /dev/null
# python3.4 -c 'import py_compile; py_compile.compile(test.py, 
cfile=/dev/null)'
# ls -l /dev/null
-rw-r- 1 root root 102 Feb 17 21:53 /dev/null

--
messages: 182283
nosy: Arfrever, brett.cannon, eric.snow, ncoghlan
priority: high
severity: normal
status: open
title: py_compile.compile() replaces target files, breaking special files and 
symlinks
versions: Python 3.4

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