tdaff / remote_ikernel

All your Jupyter kernels, on all your machines, in one place.
https://pypi.org/project/remote_ikernel/
BSD 2-Clause "Simplified" License
17 stars 14 forks source link

annoying sticky bit being set #26

Open tdaff opened 6 years ago

tdaff commented 6 years ago

Original report by Anonymous.


Since version 5.0.0, jupyter_client sets the sticky bit on the connection info file and its parent directory. This is to avoid the file being unexpectedly "garbage collected". See fixes in 5.0.0 This is harmless since the file is normally placed in /run/user/$uid/jupyter which is only used for that purpose.

Now remote_ikernel copies the connection info file on the remote machine in the current directory, resulting in that directory having its sticky bit set. This may be an unwanted side effect.

How about putting the remote copy of the connection info file also in /run/user/$uid/jupyter (on the remote machine).

tdaff commented 6 years ago

Original comment by Jean-Marc Andreoli (Bitbucket: jmandreoli, GitHub: jmandreoli).


The following simplistic fix seems to work: replace line 432 Current:

#!python

kernel_name = './{0}kernel-{1}.json'.format(RIK_PREFIX, self.uuid)

Proposed replacement:

#!python

kernel_name = '$JUPYTER_KERNEL_INFO_DIR/{0}kernel-{1}.json'.format(RIK_PREFIX, self.uuid)
conn.sendline('export JUPYTER_KERNEL_INFO_DIR=/run/user/`id -u`/jupyter')

(BTW, I am the anonymous creator of the issue)

tdaff commented 6 years ago

Original comment by Tom Daff (Bitbucket: tdaff, GitHub: tdaff).


Thanks for the issue!

It's been a while since I looked at any of these projects, but from a quick glance I'm tempted to say that Jupyter is misbehaving. The connection file is written by remote_ikernel to the working directory as the remote system could be anything and there is no guarantee that any other directories exist or would be accessible.

I'll see what they say on the Jupyter repository as I think the launcher should really only be setting the sticky bit if it has created the connection file itself.