homepage

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: distutils should preserve +x bit on data files
Type: behavior Stage: resolved
Components: Distutils Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: alexis, eric.araujo, gsakkis, ngie, steve.dower, tarek
Priority: normal Keywords: easy

Created on 2009年02月17日 21:54 by gsakkis, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Messages (6)
msg82372 - (view) Author: George Sakkis (gsakkis) Date: 2009年02月17日 21:54
Distutils ignores file permissions when copying modules and package_data
files to the build directory, and consequently to the installation
directory too. According to an XXX comment at
distutils/command/build_py.py, this is deliberate so that the built
files are not read-only, which would be a nuisance when rebuilding. This
problem though could be solved by just setting the write flag for the
user (chmod u+w) instead of overwriting all the flags. In my case, some
executable files ceased to be executable after installation.
I believe that the default behavior should be changed to preserve all
permissions, with the possible exception of setting u+w. Even that might
be unnecessary; AFAIK to delete a file you need write permissions only
to its parent directory, not to the file itself.
Even if the current behavior is deemed correct, at the very least the
code should be refactored to allow easy overriding. Currently
build_module and build_package_data pass preserve_mode=False in their
body, so I had to copy and paste the whole methods just to set
preserve_mode=True.
msg82389 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009年02月17日 23:24
> I believe that the default behavior should be changed to preserve 
> all permissions, with the possible exception of setting u+w. 
> Even that might be unnecessary; AFAIK to delete a file you need 
> write permissions only to its parent directory, not to the 
> file itself.
The u+w setting could also be done on the fly by copy_file at
installation time. e.g. when overwriting a read-only file.
> In my case, some 
> executable files ceased to be executable after installation.
what is your use case of having executable file here ?
I'd use the 'scripts' metadata for that ?
> Even if the current behavior is deemed correct, at the very least 
> the code should be refactored to allow easy overriding.
> Currently build_module and build_package_data pass 
> preserve_mode=False in their
> body, so I had to copy and paste the whole methods 
> just to set preserve_mode=True.
But How do you handle the overwrite of a read-only file in your code then ?
msg82423 - (view) Author: George Sakkis (gsakkis) Date: 2009年02月18日 15:51
> what is your use case of having executable file here ?
>
> I'd use the 'scripts' metadata for that ?
For one thing they are external binaries, not python scripts, and second
they are used internally only (through Subprocess), they are not
supposed to be called directly by clients.
> But How do you handle the overwrite of a read-only file in your code 
> then ?
I didn't, all my files were writable (by me), but if I had to, I'd look
at tweaking the directory write permissions; as I mentioned, I don't
think file permissions affect whether you can delete the file.
msg151384 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012年01月16日 16:33
FTR it looks like http://mail.python.org/pipermail/python-list/2009-January/1188084.html was the original report for this.
msg201053 - (view) Author: Enji Cooper (ngie) * Date: 2013年10月23日 18:51
The whole permissions setting operation seems a bit convoluted.
I was hoping there was something formalized with install_data.py where I could specify a default or fine-grained user/group/mode for files, but it doesn't appear to be possible. I'll investigate applying a custom rule after install is run, but I would prefer for this to be formalized in the future.
msg386416 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021年02月03日 18:29
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.
If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools 
History
Date User Action Args
2022年04月11日 14:56:45adminsetgithub: 49550
2021年02月03日 18:29:09steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386416

resolution: out of date
stage: test needed -> resolved
2014年03月13日 20:26:15eric.araujosetassignee: tarek ->
title: distutils ignores file permissions -> distutils should preserve +x bit on data files
components: + Distutils, - Distutils2
versions: + Python 2.7, Python 3.3, Python 3.4, - 3rd party
2013年10月23日 18:51:00ngiesetnosy: + ngie
messages: + msg201053
2012年02月03日 20:57:52patrick.andrewsetnosy: + alexis
title: build_module failure -> distutils ignores file permissions

components: + Distutils2, - Distutils
versions: + 3rd party, - Python 2.7
2012年02月03日 20:56:31patrick.andrewsettitle: build_module faulre -> build_module failure
2012年02月03日 20:56:27patrick.andrewsettitle: Distutils ignores file permissions -> build_module faulre
components: + Distutils, - Distutils2
versions: + Python 2.7, - 3rd party
2012年01月16日 16:33:20eric.araujosetmessages: + msg151384
2010年09月30日 02:10:10eric.araujosetkeywords: + easy
stage: test needed
versions: + 3rd party, - Python 2.6, Python 2.5, Python 3.1, Python 2.7, Python 3.2
2010年08月10日 13:54:40eric.araujosetnosy: gsakkis, tarek, eric.araujo
components: + Distutils2, - Distutils
versions: + Python 2.6, Python 2.5, Python 3.2
2010年06月03日 14:54:56eric.araujosetnosy: + eric.araujo
2009年02月18日 15:51:48gsakkissetmessages: + msg82423
2009年02月17日 23:24:38tareksetmessages: + msg82389
versions: + Python 3.1, Python 2.7
2009年02月17日 21:54:53gsakkiscreate

AltStyle によって変換されたページ (->オリジナル) /