dephell / dephell/dephell_archive

Broken symlinks behavior

Open
#9 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1
Forks
6
PR merge metrics
No merged PRs in 30d

Description

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.

```py
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 https://github.com/dephell/dephell_archive/pull/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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.