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

Question: app_dir real path #6166

Closed
mlucool opened this issue Apr 4, 2019 · 7 comments · Fixed by #6240
Closed

Question: app_dir real path #6166

mlucool opened this issue Apr 4, 2019 · 7 comments · Fixed by #6240

Comments

@mlucool
Copy link
Contributor

@mlucool mlucool commented Apr 4, 2019

Hi,

Why does app_dir resolve to the real path before being used?

We have a usecase where we'd like to build a new app_dir on the side then update a symlink atomically. This does not work today as app_dir will contain the real path and not the path we passed in.

Thanks for your help!

@xmnlab
Copy link

@xmnlab xmnlab commented Apr 10, 2019

@mlucool

could jupyter-lab (instead of jupyter lab) command work for you?

@mlucool
Copy link
Contributor Author

@mlucool mlucool commented Apr 10, 2019

I am not sure how that would help. A few places in lab call get_app_dir which resolves the directory we put into the config instead of passing it as is.

More explicit example:

  1. Build an appdir (lets call this ad1)
  2. Create a symlink to ad1 (myappdir->ad1) and set your appdir in the config to the symlink (myappdir) and restart your jupyter server
  3. Copy the whole appdir directory into something with a different name (cp -r ad1 ad2). Update the symlink to point to this new directory (myappdir ->ad2) and remove the previous real directory (rm -rf ad1). Do NOT restart the server.
  4. Refresh a lab page. Things won't work because it looks for assets in the real path.

@xmnlab
Copy link

@xmnlab xmnlab commented Apr 15, 2019

@mlucool I could replicated that. thanks for the explanation. I will take a look into that.

@saulshanabrook
Copy link
Member

@saulshanabrook saulshanabrook commented Apr 24, 2019

@bollwyvl @blink1073 From what I can tell on the git blame, it looks like you two touched these lines. Before I go and start removing osp.realpath from places, do you remember any background around why you resolve symlinks early?

@jasongrout
Copy link
Contributor

@jasongrout jasongrout commented Apr 24, 2019

Also, CC @minrk since he generally has very sage advice about such things.

@blink1073
Copy link
Member

@blink1073 blink1073 commented Apr 24, 2019

IIIRC I did this and meant to use abspath

@saulshanabrook
Copy link
Member

@saulshanabrook saulshanabrook commented Apr 24, 2019

OK I switched all uses of realpath to abspath in jupyterlab/commands.py and it seems to fix this use case.

@jasongrout jasongrout removed this from the Future milestone Apr 24, 2019
@jasongrout jasongrout added this to the 1.0 milestone Apr 24, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

5 participants