Skip to content

Broken symlinks behavior #9

@jayvdb

Description

@jayvdb

https://pypi.org/project/beautifulsoup4/4.8.1/#files https://files.pythonhosted.org/packages/86/cd/495c68f0536dcd25f016e006731ba7be72e072280305ec52590012c1e6f2/beautifulsoup4-4.8.1.tar.gz includes a symlink NEWS.txt -> CHANGELOG and CHANGELOG doesnt appear in the archive because it doesnt appear in https://bazaar.launchpad.net/~leonardr/beautifulsoup/bs4/view/head:/MANIFEST.in (so also occurs in latter versions, and probably many earlier versions).

The resulting FileNotFoundError exception is logical, but it exposes the cache to the caller and the exception doesnt really explain what happened. A quick fix would be to detect this and raise a subclass of FileNotFoundError with a better error message.

    f.read()
  File "/home/jayvdb/projects/dephell/dephell_archive/dephell_archive/_stream.py", line 65, in read
    with path.open(self.mode, encoding=self.encoding) as stream:
  File "/usr/lib64/python3.7/pathlib.py", line 1186, in open
    opener=self._opener)
  File "/usr/lib64/python3.7/pathlib.py", line 1039, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/path/to/cache/beautifulsoup4-4.8.1/NEWS.txt'

strict-rfc3339-0.7 has a symlink which isnt broken, and it extracts fine into the cache and .read() returns the content of the linked file, which again is quite reasonable.

After #2 , we should also add symlink related methods so the caller can detect & negotiate these symlinks like they would handle them if occurring on disk.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions