Skip to content

Formatting does not work with read only file system #13847

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

Closed
chrisrundlerfu opened this issue Sep 9, 2020 · 5 comments
Closed

Formatting does not work with read only file system #13847

chrisrundlerfu opened this issue Sep 9, 2020 · 5 comments
Labels
area-formatting bug Issue identified by VS Code Team member as probable bug

Comments

@chrisrundlerfu
Copy link

Issue Type: Bug

When I try and format my python file I get the following error:

Failed to create a temporary file, Unable to write file '/Untitled-1.13264068d108c6901b3592ea654fcd57.tmp' (Unknown (FileSystemError): Error: EROFS: read-only file system, open '/Untitled-1.13264068d108c6901b3592ea654fcd57.tmp')

I am running a mac and format document works for other file types (e.g. json)

Extension version: 2020.8.106424
VS Code version: Code 1.48.2 (a0479759d6e9ea56afa657e454193f72aef85bd0, 2020-08-25T10:09:08.021Z)
OS version: Darwin x64 19.6.0

System Info
Item Value
CPUs Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled
Load (avg) 3, 3, 4
Memory (System) 32.00GB (0.42GB free)
Process Argv
Screen Reader no
VM 0%
@ghost ghost added the triage-needed Needs assignment to the proper sub-team label Sep 9, 2020
@karthiknadig karthiknadig self-assigned this Sep 9, 2020
@karthiknadig karthiknadig added triage bug Issue identified by VS Code Team member as probable bug and removed triage-needed Needs assignment to the proper sub-team labels Sep 9, 2020
@karthiknadig karthiknadig changed the title Error trying to fun format document for python file Formatting does not work with read only file system Sep 9, 2020
@karthiknadig
Copy link
Member

@chrisrundlerfu Can you check if the TMP folder is available for writes? Also, check if the TMP environment variable is available.

@chrisrundlerfu
Copy link
Author

Hi @karthiknadig

When I look at the permissions for the tmp directory in root it shows
lrwxr-xr-x@ 1 root admin 11 5 Dec 2019 tmp -> private/tmp
and so I looked at private/tmp and this shows
drwxrwxrwt 26 root wheel 832 10 Sep 07:54 tmp

I ran printenv which shows TMPDIR=/var/folders/w7/1qvx38910775sll063b2vg0w0000gn/T/ so I looked at permissions for var/folders
drwxr-xr-x 4 root wheel 128 7 Apr 17:19 folders
drwxr-xr-x@ 3 root wheel 96 7 Apr 17:19 w7
drwxr-xr-x@ 5 chrisrundle staff 160 7 Apr 17:19 1qvx38910775sll063b2vg0w0000gn
drwx------@ 407 chrisrundle staff 13024 10 Sep 08:50 T

In the /var/folders/w7/1qvx38910775sll063b2vg0w0000gn/T/ folder there are some files for vscode, like
srwxr-xr-x 1 chrisrundle staff 0 9 Sep 17:33 vscode-git-5c33030ebd.sock
drwxr-xr-x 3 chrisrundle staff 96 9 Sep 17:37 vscode-typescript501
but nothing called Untitled...

@karthiknadig karthiknadig added investigating We are looking into the cause of the issue and removed triage labels Sep 15, 2020
@qmg-drettie
Copy link

I get the same issue when formatting an unsaved file

@karthiknadig
Copy link
Member

We have a prototype formatter that can handle this over Language Server Protocol. This means we don't have to create a temporary file to use with black. Please see here for the prototype and try it out. psf/black#2883

When trying out the prototype please disable formatting with the python extension by setting "python.formatting.provider": "none".

@karthiknadig karthiknadig removed their assignment Mar 18, 2022
@karthiknadig karthiknadig added area-formatting needs PR and removed investigating We are looking into the cause of the issue labels Mar 18, 2022
@karthiknadig
Copy link
Member

Closing this in favor of #17918

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-formatting bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

3 participants