Repository navigation
core: don't mangle entries that don't start with the configured prefix - #1
Merged
Merged
Conversation
Previously, _load_recursive() unconditionally sliced len(prefix) characters off every top-level repo entry not in ignore/packages, even when the entry didn't actually start with the configured prefix. With prefix='_' set, an entry named 'bin' would be sliced to 'in' and re-dotted to '~/.in' instead of being linked as '~/bin'. Guard the strip+re-dot behavior behind an actual prefix check; entries that don't start with the configured prefix now pass through unchanged. Fixes jbernard#32, jbernard#53, jbernard#61, jbernard#73
Both positive (correct symlink created) and negative (the old mis-stripped target is not created) assertions for: - an unprefixed entry inside a top-level package - a nested package (declared as 'parent/child')
Replace the defunct Travis CI setup (targeted Python 2.6/2.7/3.2-3.4, travis-ci.org domain is long gone) with a working GitHub Actions workflow running the test suite on the latest stable Python (3.14). - .github/workflows/test.yml: runs pytest on push/PR/workflow_dispatch - .github/dependabot.yml: keep GitHub Actions versions current - requirements-test.txt: formalize pytest as the test dependency - README: swap the dead Travis badge for the new Actions badge
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_load_recursive()unconditionally sliceslen(prefix)characters offevery top-level repo entry not in
ignore/packages, even when theentry doesn't actually start with the configured
prefix. Withprefix = '_'set, an entry namedbingets sliced toinandre-dotted to
~/.ininstead of being linked as~/bin.This is a long-standing upstream bug, reported multiple times without a
fix landing: jbernard#32, jbernard#53,
jbernard#61, jbernard#73. Still present in the latest
PyPI release (0.6.5).
Guards the strip+re-dot behavior behind an actual
startswith(prefix)check; non-conforming entries now pass through unchanged instead of
being mangled.
Test plan
test_unprefixed_entry_passthrough, reproducing the exactbin->~/.inscenario from Prefix handling is wierd jbernard/dotfiles#32the fix, reran, got the expected failure) and passes with it
restored
13 passed, 2 xfailed(the twoxfails arepre-existing and unrelated to this change)
This same fix is also being opened as a PR upstream against
jbernard/dotfiles.