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: filelist.findall should not fail on dangling symlinks
Type: behavior Stage: resolved
Components: Distutils, Distutils2 Versions: Python 3.2, Python 3.3, Python 3.4, Python 2.7, 3rd party
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: tarek Nosy List: akitada, dairiki, eric.araujo, maker, pixelbeat, senko, steve.dower, tarek
Priority: normal Keywords: easy, patch

Created on 2004-10-23 17:25 by dairiki, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
distutils-symlink-test.diff senko, 2013-07-06 12:22 review
distutils-symlink-fix.diff senko, 2013-07-06 12:22 review
Messages (7)
msg60589 - (view) Author: Geoffrey T. Dairiki (dairiki) Date: 2004-10-23 17:25
On unix platforms, if one has a dangling symlink
anywhere in ones source directory tree (and a
MANIFEST.in file), 'setup.py sdist' will fail. 
('OSError: [Errno 2] No such file or directory' on the
dangling symlink.)

A fix for this is for filefind.findall to use
os.lstat() instead of os.stat() (when lstat is available.) 

(Another possible fix would be to catch the
OSError(ENOENT) exception and either ignore it or
render it as a warning.)


Appendix A

Details on how to reproduce the bug:

In your top-level source directory (the one with a
setup.py):

1. Create a dangling symlink.  ('ln -s foo bar',
assuming the file 'foo' doesn't exist.)

2. Do a 'touch MANIFEST.in'

3. Run 'python setup.py sdist'

The command should fail with:

'error: bar: No such file or directory'
    


msg80963 - (view) Author: Akira Kitada (akitada) * Date: 2009-02-02 17:17
This is reproducible, but I'm not sure why this could be a problem...
Is there any use cases that you think it could be better than failing?
msg100635 - (view) Author: Pádraig Brady (pixelbeat) Date: 2010-03-08 11:22
Packaging dangling symlinks is often required, so this is a problem.
For e.g. in my package I want to install this symlink:
/etc/apache2/sites-enabled/000-default -> ../sites-available/myapp.conf
msg111046 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-07-21 13:05
Thanks for the report. The steps you described need to be turned into a unit test. Can someone provide a patch against py3k’s test_sdist.py?
msg192423 - (view) Author: Senko Rasic (senko) * Date: 2013-07-06 12:22
Here are two patches:

* test against py3k test_sdist.py (should crash without a fix)
* a proposed fix

The proposed fix not only changes lstat, but also changes other relevant paths to actually include dangling symlinks in the filelists. I've split them into two in case the proposed fix is rejected but test is still useful.
msg192424 - (view) Author: Senko Rasic (senko) * Date: 2013-07-06 12:22
The second patch (proposed fix).
msg386433 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-03 18:30
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:07adminsetgithub: 41066
2021-02-03 18:30:38steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386433

resolution: out of date
stage: test needed -> resolved
2013-07-06 12:22:53senkosetfiles: + distutils-symlink-fix.diff

messages: + msg192424
2013-07-06 12:22:18senkosetfiles: + distutils-symlink-test.diff

nosy: + senko
messages: + msg192423

keywords: + patch
2012-09-30 20:54:39makersetnosy: + maker
2012-09-15 23:25:54ezio.melottisetkeywords: + easy
versions: + Python 3.3, Python 3.4, - Python 3.1
2010-09-30 00:35:04eric.araujosetversions: + 3rd party
2010-08-19 17:50:33BreamoreBoysettype: behavior
versions: + Python 3.1, Python 2.7, Python 3.2
2010-07-21 13:05:43eric.araujosetassignee: tarek

components: + Distutils2
title: filelist.findall should use os.lstat -> filelist.findall should not fail on dangling symlinks
nosy: + eric.araujo
versions: - Python 2.5
messages: + msg111046
stage: test needed
2010-03-08 11:22:10pixelbeatsetnosy: + pixelbeat

messages: + msg100635
versions: + Python 2.5
2009-02-02 17:17:10akitadasetnosy: + tarek, akitada
messages: + msg80963
2004-10-23 17:25:25dairikicreate