Skip to content

core: don't mangle entries that don't start with the configured prefix - #81

Open
non7top wants to merge 3 commits into
jbernard:mainfrom
non7top:fix/prefix-guard
Open

core: don't mangle entries that don't start with the configured prefix#81
non7top wants to merge 3 commits into
jbernard:mainfrom
non7top:fix/prefix-guard

Conversation

@non7top

@non7top non7top commented Jul 16, 2026

Copy link
Copy Markdown

Summary

_load_recursive() unconditionally slices len(prefix) characters off
every top-level repo entry not in ignore/packages, even when the
entry doesn't actually start with the configured prefix. With
prefix = '_' set, an entry named bin gets sliced to in and
re-dotted to ~/.in instead of being linked as ~/bin.

This has been reported multiple times without a fix landing: #32, #53,
#61, #73. Still present in the latest 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. Behavior for prefix='' (no prefix convention in use)
is unchanged.

Test plan

  • Added test_unprefixed_entry_passthrough, reproducing the exact
    bin -> ~/.in scenario from Prefix handling is wierd #32
  • Confirmed the new test fails against the pre-fix code and passes
    with it restored
  • Full suite: 13 passed, 2 xfailed (the two xfails are
    pre-existing and unrelated to this change)

Fixes #32, #53, #61, #73

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
non7top added 2 commits July 16, 2026 07:35
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
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.

Prefix handling is wierd

1 participant