New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't follow symlinks when uninstalling files #2552

Merged
merged 9 commits into from Mar 22, 2015

Conversation

Projects
None yet
3 participants
@takluyver
Member

takluyver commented Mar 17, 2015

I'm developing a packaging tool that, among other things, symlinks things into site-packages for development installs (i.e. similar to pip install -e). When pip tries to uninstall those things, it erroneously removes the target of the symlink instead of the symlink itself. This has been tracked for some time as issue #40, and the comments on that issue seemed to agree that resolving the symlink when uninstalling was plain wrong.

I could have fixed this in normalize_path() itself, but it may be desirable in some other places to resolve the symlink, and in most cases it will at least not be harmful. Since that function is only one line, I opted to copy its contents, minus realpath(), to where it's used.

Fixes gh-40

Crosslink takluyver/flit#2.

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Mar 17, 2015

Member

Test failure appears to be an unrelated download failure, if someone could kick that build to restart. :-)

Member

takluyver commented Mar 17, 2015

Test failure appears to be an unrelated download failure, if someone could kick that build to restart. :-)

@qwcode

This comment has been minimized.

Show comment
Hide comment
@qwcode

qwcode Mar 17, 2015

Contributor

are these links installed as part of a project using pip? or no?

btw, as it is, I'm not aware that it's possible to install symlinks under normal circumstances, but maybe I'm wrong

Contributor

qwcode commented Mar 17, 2015

are these links installed as part of a project using pip? or no?

btw, as it is, I'm not aware that it's possible to install symlinks under normal circumstances, but maybe I'm wrong

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Mar 17, 2015

Member
Member

takluyver commented Mar 17, 2015

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Mar 18, 2015

Member

More broadly, though, there are various ways that someone could end up with symlinks present - the situation described in #40 was caused by something completely different, and I have created symlinks other ways as well. It would be nice if pip could avoid messing them up.

Member

takluyver commented Mar 18, 2015

More broadly, though, there are various ways that someone could end up with symlinks present - the situation described in #40 was caused by something completely different, and I have created symlinks other ways as well. It would be nice if pip could avoid messing them up.

Show outdated Hide outdated pip/req/req_uninstall.py Outdated
@qwcode

This comment has been minimized.

Show comment
Hide comment
@qwcode

qwcode Mar 18, 2015

Contributor

see comment above about tests, but I agree it seems pip is wrong here.

Contributor

qwcode commented Mar 18, 2015

see comment above about tests, but I agree it seems pip is wrong here.

Show outdated Hide outdated tests/unit/test_utils.py Outdated
@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Mar 19, 2015

Member

OK, tests added, passing and pep8 compliant. :-)

Member

takluyver commented Mar 19, 2015

OK, tests added, passing and pep8 compliant. :-)

Show outdated Hide outdated tests/unit/test_req_uninstall.py Outdated
Show outdated Hide outdated tests/unit/test_utils.py Outdated
@qwcode

This comment has been minimized.

Show comment
Hide comment
@qwcode

qwcode Mar 20, 2015

Contributor

overall, this lgtm if you can fix those few things.

Contributor

qwcode commented Mar 20, 2015

overall, this lgtm if you can fix those few things.

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Mar 20, 2015

Member

Thanks, fixed.

The remaining test failure looks like it's unrelated:

fatal: unable to connect to github.com:
github.com[0: 192.30.252.128]: errno=Connection timed out
Member

takluyver commented Mar 20, 2015

Thanks, fixed.

The remaining test failure looks like it's unrelated:

fatal: unable to connect to github.com:
github.com[0: 192.30.252.128]: errno=Connection timed out
@qwcode

This comment has been minimized.

Show comment
Hide comment
@qwcode

qwcode Mar 22, 2015

Contributor

ok, lgtm. merging.
I'll add a changelog entry after.

Contributor

qwcode commented Mar 22, 2015

ok, lgtm. merging.
I'll add a changelog entry after.

qwcode added a commit that referenced this pull request Mar 22, 2015

Merge pull request #2552 from takluyver/uninstall-symlinks
Don't follow symlinks when uninstalling files

@qwcode qwcode merged commit 39ae3c3 into pypa:develop Mar 22, 2015

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Details

qwcode added a commit that referenced this pull request Mar 22, 2015

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Mar 22, 2015

Member
Member

takluyver commented Mar 22, 2015

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