jupyter / jupyter_core

Core Jupyter functionality
https://jupyter-core.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
194 stars 180 forks source link

Regression: Error when config dir is readonly (Worked before) #378

Closed jschaeck closed 7 months ago

jschaeck commented 7 months ago

Hello,

in our hosted system, the jupyter config dir is ready only to ensure that users are not messing up with it. This worked nicely for quite some time (in between we had to add a marker file "migrated" but since then worked fine again).

Now with a recent version of jupyter-core this breaks unfortunately.

Error message is:

File ".../site-packages/jupyter_core/application.py", line 168, in migrate_config
    f_marker = open(os.path.join(self.config_dir, "migrated"), "r+")  # noqa
OSError: [Errno 30] Read-only file system: '/config/xyz/migrated'

I think this regression came in with https://github.com/jupyter/jupyter_core/pull/356/files (See changes below where exists check was changed to open with "r+"

I think the editor planned for this with the

except PermissionError:  # not readable and/or writable
       return  # so let's give up migration in such an environment

but in case of the read only file system (at least in our case)

that is an OSError, not an PermissionError

Request: Can the PermissionError handling be applied to OSError as well?

image

jschaeck commented 7 months ago

@blink1073 Hi, sorry to tag you directly but from the commit history you are the person that performed the most changes and I thought I maybe run this by you. Any thoughts here?

blink1073 commented 7 months ago

Thanks for the heads up @jschaeck, I'll make a release with #379 early next week.