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.

Title: distutils silently omits relative symlinks
Type: behavior Stage: resolved
Components: Distutils Versions: Python 3.4, Python 3.5, Python 2.7
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: eric.araujo, fberger, steve.dower, tarek
Priority: normal Keywords:

Created on 2013-02-22 09:34 by fberger, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg182658 - (view) Author: Florian Berger (fberger) Date: 2013-02-22 09:34
This issue is related to #12585, #15205 and #8876.

In `distutils/`, in `make_zipfile()`, the code

    for dirpath, dirnames, filenames in os.walk(base_dir):
        for name in filenames:
            path = os.path.normpath(os.path.join(dirpath, name))
            if os.path.isfile(path):
                zip.write(path, path)
      "adding '%s'" % path)

will silently omit relative symlinks from the archive.

Relative symlinks (`file.dat -> ../../../real_file.dat`) will become invalid when copied as-is into the package directory before compressing.
`os.path.isfile(path)` will evaluate to `False` in this case.

That is a critical condition, as the file has explicitly been specified for inclusion, but the package author is never warned about the fact, rendering the distributed package defunct in worst case.

Actual behaviour: relative symlinks are silently ignored.

Expected behaviour: any file that, for whatever reason, can not be included in the distribution archive should be warned about.

As hinted at in #15205, this might be fixed in `distutils2` / `packaging` in case it always dereferences and copies files.

This issue could be fixed without breaking behaviour if no Exception is raised, but a warning is printed.

With `packaging` available in Python 3.3, this report also serves as documentation of the problem for legacy Python programmers searching the web.

Thanks for considering.
msg223382 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-07-17 22:25
@Florian can you provide a patch for this?
msg386295 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-03 18:16
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
Date User Action Args
2022-04-11 14:57:42adminsetgithub: 61476
2021-02-03 18:16:16steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386295

resolution: out of date
stage: resolved
2019-04-26 19:57:04BreamoreBoysetnosy: - BreamoreBoy
2014-07-17 22:25:12BreamoreBoysetversions: + Python 2.7, Python 3.4, Python 3.5, - Python 2.6, Python 3.1, Python 3.2, Python 3.3
nosy: + BreamoreBoy

messages: + msg223382

type: behavior
2013-02-22 09:34:13fbergercreate