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

Handling of symlink home directories #5525

Closed
zanchey opened this issue Jan 13, 2019 · 9 comments
Closed

Handling of symlink home directories #5525

zanchey opened this issue Jan 13, 2019 · 9 comments
Labels
bug Something that's not working as intended
Milestone

Comments

@zanchey
Copy link
Member

zanchey commented Jan 13, 2019

On 3.0.0 and master, starting a shell with a home directory that is a symlink resolves the link, meaning that the prompt makes it look like you aren't in your home directory.

> mkdir /tmp/realhome
> ln -s /tmp/realhome /tmp/linkhome
> cd /tmp/linkhome
> pwd
/tmp/linkhome
> env HOME=/tmp/linkhome fish
Welcome to fish, the friendly interactive shell
zanchey@mussel /t/realhome>
@zanchey zanchey added this to the fish-future milestone Jan 13, 2019
@zanchey zanchey added the bug Something that's not working as intended label Jan 13, 2019
@mqudsi
Copy link
Contributor

mqudsi commented Jan 13, 2019

This same behavior led me to open #5300. I agree that this behavior is unexpected.

@mqudsi
Copy link
Contributor

mqudsi commented Jan 17, 2019

I should mention that under FreeBSD the default home directory for each user is a symlink /home/jdoe pointing to /usr/home/jdoe.

@twlz0ne
Copy link

twlz0ne commented Jan 21, 2019

Same here, now I rolled back to 0f0bb1e^1

* ca159ae  Fix typo [Jason] 2018-10-07
* 786c0c5  Merge branch 'virtualpwd' [ridiculousfish] 2018-10-06
|\
| * 3e4bdf5  Teach hg prompt to use pwd -P [ridiculousfish] 2018-10-06
| * 0f0bb1e  Don't resolve symlinks with cd [ridiculousfish] 2018-09-16
| * 6ad4d94  (HEAD -> master) Introduce path_normalize [ridiculousfish] 2018-09-16
* | 02b093d  Change only to exactly [jacob] 2018-10-01
* | 739ad77  Fix typos and address formatting [jacob] 2018-10-01
|/
* 767b7a2  Migrate the completion set to owning_lock_t [ridiculousfish] 2018-10-05

@ridiculousfish

This comment has been minimized.

@floam

This comment has been minimized.

@ridiculousfish
Copy link
Member

Whoops, thanks!

@ridiculousfish
Copy link
Member

This is totally baffling! fish has code that respects incoming PWDs, and only asks the kernel for help (via getcwd) if $PWD is not provided as an incoming environment variable.

What I see is that env shows that $PWD is set, but fish doesn't see it in envp. As I said, baffling...

@ridiculousfish
Copy link
Member

Aw hell, fish ignores incoming $PWD because it's considered read-only. But not at init time...

ridiculousfish added a commit that referenced this issue Jan 22, 2019
PWD is not set in fish vars because it is read only.
Use getenv() to fetch it, allowing fish to inherit a virtual PWD.

This cherry pick includes both:
24f251e Correctly remove the test directory again in cd test
91a9c98 Correctly inherit a virtual PWD

Fixes #5525
@ridiculousfish
Copy link
Member

Picked into 3.0.1 as dfa6192

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something that's not working as intended
Projects
None yet
Development

No branches or pull requests

5 participants