Skip to content

Initialize link targets with the correct archive entry type - #147

Open
omrzk wants to merge 2 commits into
Changaco:masterfrom
omrzk:fix/memory-symlink-targets-143
Open

omrzk wants to merge 2 commits into
Changaco:masterfrom
omrzk:fix/memory-symlink-targets-143

Conversation

@omrzk

@omrzk omrzk commented Nov 10, 2026

Copy link
Copy Markdown

add_file_from_memory(..., filetype=FileType.SYMBOLINK_LINK, linkpath=...) writes a link with no target. The generic libarchive link setters update an existing link but do not initialize its link metadata; newly created hard links have the same problem.

Use the explicit symbolic-link or hard-link setters according to the entry's file type, retaining the selected metadata codec. Apply a supplied file type before its target when constructing or modifying entries, so keyword order does not select the wrong link kind.

Fixes #143.

Validation: 12 regressions fail on master and pass with this change, alongside four passing preservation controls for parsed links, including UTF-8/Latin-1, bytes/text, target replacement, keyword order, native tar writers checked with tarfile, and a raw CPIO newc header/payload check. The full suite passes 54 tests with one existing expected failure; Flake8 and wheel build pass (Python 3.12, libarchive 3.7.2).

The configured forked/coverage suite also passes 54 tests/one expected failure with pytest 8.4.2. Current pytest 9.2.0 plus pytest-forked 1.7.5 fails in report serialization (ValueError: unmarshallable object), including on clean master; plain pytest 9.2.0 passes. No dependency or CI configuration is changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add_file_from_memory silently fails for symbolic links

1 participant