Skip to content
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

fix another FreeBSD $HOME symlink issue #1973

Merged
merged 1 commit into from Jun 17, 2012

Conversation

ivanov
Copy link
Member

@ivanov ivanov commented Jun 16, 2012

without these changes, I get this error in IPython.core on FreeBSD 9.0

FAIL: test_cwd_x (IPython.core.tests.test_prompts.PromptTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/home/pi/code/ipython/IPython/core/tests/test_prompts.py", line 107, in test_cwd_x
    self.assertEquals(p, '~')
AssertionError: u'/usr~' != '~'
    "u'/usr~' != '~'" = '%s != %s' % (safe_repr(u'/usr~'), safe_repr('~'))
    "u'/usr~' != '~'" = self._formatMessage("u'/usr~' != '~'", "u'/usr~' != '~'")
>>  raise self.failureException("u'/usr~' != '~'")

I've verified that this change does not break any tests under Ubuntu when HOME happens to be symlinked.

I don't know how this will affect windows

# This is needed on FreeBSD, and maybe other systems which symlink /home to
# /usr/home, but retain the $HOME variable as pointing to /home
if os.path.realpath(HOME) != HOME:
HOME = os.path.realpath(HOME)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it simpler just to do HOME = os.path.realpath(HOME) unconditionally? If it wouldn't trigger this if, then doing it unconditionally would make no difference.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use existing utils.path.get_home_dir, where you fixed this the first time?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thomas Kluyver, on 2012-06-16 05:32, wrote:

Isn't it simpler just to do HOME = os.path.realpath(HOME)
unconditionally? If it wouldn't trigger this if, then doing
it unconditionally would make no difference.

good point, just applied this change

Min RK, on 2012-06-16 21:23, wrote:

Why not use existing utils.path.get_home_dir, where you fixed
this the first time?

That function ends up returning a directory under windows, where
I guess $HOME isn't typically defined. It looks like in this
code, windows ends up getting a nonsensical HOME so that no
directory ends up getting replaced with ~.

Does that seem reasonable enough?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, makes sense. It seems like this can go in, then.

@takluyver
Copy link
Member

Test results for commit d39ba53 merged into master
Platform: linux2

  • python2.7: Failed, log at https://gist.github.com/2944217 (libraries not available: oct2py rpy2 tornado)
  • python3.1: OK (libraries not available: cython matplotlib numpy oct2py pymongo qt rpy2 wx wx.aui zmq)
  • python3.2: OK (libraries not available: cython oct2py pymongo rpy2 wx wx.aui)

Not available for testing: python2.6

@takluyver
Copy link
Member

Test results for commit d39ba53 merged into master
Platform: linux2

  • python2.7: OK (libraries not available: oct2py rpy2 tornado)
  • python3.1: OK (libraries not available: cython matplotlib numpy oct2py pymongo qt rpy2 wx wx.aui zmq)
  • python3.2: OK (libraries not available: cython oct2py pymongo rpy2 wx wx.aui)

Not available for testing: python2.6

@takluyver
Copy link
Member

The failure the first time was a sporadic failure, not related to this. Merging now.

I think I see that failure once each time I turn my computer on. I must get round to debugging it.

takluyver added a commit that referenced this pull request Jun 17, 2012
fix another FreeBSD $HOME symlink issue
@takluyver takluyver merged commit be277e1 into ipython:master Jun 17, 2012
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
fix another FreeBSD $HOME symlink issue
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.

None yet

3 participants