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 symlinked /home issue for FreeBSD #1402
Conversation
this is a one-line fix for ipython's pushd and friends on systems which symlink /home directories to /usr/home. Here's the error I get on FreeBSD 9.0 without this PR: ====================================================================== FAIL: Test various directory handling operations. ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/nose-1.1.2-py2.7.egg/nose/case.py", line 197, in runTest self.test(*self.arg) File "/usr/home/pi/code/ipython/IPython/core/tests/test_magic.py", line 280, in test_dirops nt.assert_equal(curpath(), startdir) AssertionError: u'/usr/home/pi/.ipython' != u'/usr/home/pi/code/ipython' - /usr/home/pi/.ipython ? ^ + /usr/home/pi/code/ipython ? ^^^^^ """Fail immediately, with the given message.""" >> raise self.failureException(u"u'/usr/home/pi/.ipython' != u'/usr/home/pi/code/ipython'\n- /usr/home/pi/.ipython\n? ^\n+ /usr/home/pi/code/ipython\n? ^^^^^\n") -------------------- >> begin captured stdout << --------------------- /usr/home/pi/.ipython /usr/home/pi/code/ipython /usr/home/pi/.ipython [Errno 2] No such file or directory: '/usr~/code/ipython' /usr/home/pi/.ipython popd -> /usr~/code/ipython --------------------- >> end captured stdout << ---------------------- The reason for the above is this: In [1]: pwd Out[1]: u'/usr/home/pi' In [2]: !pwd /home/pi In [3]: pushd code /usr/home/pi/code Out[3]: [u'/usr~'] with this commit: In [1]: pushd Out[1]: [u'~']
Can you make sure completions on '~/path/to/stuff' still work? I wonder if there might be one or two more places we want to call realpath. |
grepping through the source - I only see home_dir being used in core/interactiveshell.py core/logger.py core/magic.py utils/path.py. Logger just uses the name, and gets it from iteractiveshell, which calls the utils/path.py:get_home_dir method I've modified here. magic.py also just uses the interactivelshell's home_dir, so I think that's all the places where it's used, aside from the related tests. |
confirmed that tab completions still work on ~/path/to/stuff on FreeBSD, this is ready to merge as far as I'm concerned, unless there are other outstanding thing I need to look into |
thanks, I'll go ahead and merge then. Also ,thanks for the confirmation as separate comment, I wouldn't have been notified of the in-place edit. |
fix symlinked /home issue (e.g. for FreeBSD) fixes assumption that `~` follows no symlinks in pushd and friends.
This introduced a failure in test_get_home_dir_3 when home is a symlink. I think it's a simple case of needing to call realpath in the test. |
fix symlinked /home issue (e.g. for FreeBSD) fixes assumption that `~` follows no symlinks in pushd and friends.
this is a one-line fix for ipython's pushd and friends on systems which
symlink /home directories to /usr/home. Here's the error I get on
FreeBSD 9.0 without this PR:
The reason for the above is this:
with this commit:
and the above failing test passes