pyfilesystem2 icon indicating copy to clipboard operation
pyfilesystem2 copied to clipboard

Implement proper symlink support in `ReadTarFS`

Open althonos opened this issue 5 years ago • 1 comments

Type of changes

  • Bug fix
  • New feature

Checklist

  • [x] I've run the latest black with default args on new code.
  • [x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
  • [x] I've added tests for new code.
  • [x] I accept that @willmcgugan may be pedantic in the code review.

Description

The current version of ReadTarFS does not support symlinks properly where Tar files do. This PR changes the following:

OSFS like behaviour for Info

  • [x] Info.is_dir is True for symlinks that map to existing directories.
  • [x] ReadTarFS.isdir(path) returns True if path is a symlink that maps to an existing directory.
  • [x] ReadTarFS.isfile(path) returns True if the path is a symlink that maps to an existing file.
  • [x] ReadTarFs.islink(path) return True if the path is a symlink (that can also be dangling).

Transparent handling of symlinks

  • [x] ReadTarFS.openbin(path) also works if path is a symlink that maps to an existing file.
  • [x] ReadTarFS.listdir(path) also works if path is a symlink that maps to an existing file.

Closes #409 and partially addresses #425.

althonos avatar Sep 19 '20 18:09 althonos

Moving this to milestone v2.5.0 because this is a fundamental change.

althonos avatar Sep 30 '20 17:09 althonos