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

bug: error thrown when changing themes without a 'settings.json' #8302

Closed
vince-fugnitto opened this issue Aug 4, 2020 · 6 comments · Fixed by #8313
Closed

bug: error thrown when changing themes without a 'settings.json' #8302

vince-fugnitto opened this issue Aug 4, 2020 · 6 comments · Fixed by #8313
Assignees
Labels
bug bugs found in the application filesystem issues related to the filesystem preferences issues related to preferences

Comments

@vince-fugnitto
Copy link
Member

Bug Description:

There is an error thrown when changing themes without a settings.json present (no home .theia):

logger-protocol.ts:112 root ERROR Error: Unable to write file '/settings.json' (EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open '/home/evinfug/.theia/settings.json')
    at new FileOperationError (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:3060:28)
    at FileService.push.../../packages/filesystem/lib/browser/file-service.js.FileService.asFileOperationError (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:1413:34)
    at FileService.push.../../packages/filesystem/lib/browser/file-service.js.FileService.rethrowAsFileOperationError (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:1410:20)
    at FileService.<anonymous> (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:1253:30)
    at step (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:518:23)
    at Object.throw (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:499:53)
    at rejected (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:491:65)
Caused by: Error: Request 'writeFile' failed
    at Proxy.<anonymous> (file:///home/evinfug/workspaces/theia/examples/electron/lib/bundle.js:137680:33)
    at RemoteFileSystemProvider.push.../../packages/filesystem/lib/common/remote-file-system-provider.js.RemoteFileSystemProvider.writeFile (file:///home/evinfug/workspaces/theia/examples/electron/lib/78.bundle.js:923:28)
    at DelegatingFileSystemProvider.push.../../packages/filesystem/lib/common/delegating-file-system-provider.js.DelegatingFileSystemProvider.writeFile (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:2765:34)
    at FileService.<anonymous> (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:2179:60)
    at step (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:518:23)
    at Object.next (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:499:53)
    at file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:493:71
    at new Promise (<anonymous>)
    at push.../../packages/filesystem/lib/browser/file-service.js.__awaiter (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:489:12)
    at FileService.push.../../packages/filesystem/lib/browser/file-service.js.FileService.doWriteUnbufferedQueued (file:///home/evinfug/workspaces/theia/examples/electron/lib/0.bundle.js:2156:16)
Caused by: EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open '/home/evinfug/.theia/settings.json'
    at new FileSystemProviderError (/home/evinfug/workspaces/theia/packages/filesystem/lib/common/files.js:230:28)
    at Object.createFileSystemProviderError (/home/evinfug/workspaces/theia/packages/filesystem/lib/common/files.js:239:25)
    at DiskFileSystemProvider.toFileSystemProviderError (/home/evinfug/workspaces/theia/packages/filesystem/lib/node/disk-file-system-provider.js:1168:24)
    at DiskFileSystemProvider.<anonymous> (/home/evinfug/workspaces/theia/packages/filesystem/lib/node/disk-file-system-provider.js:448:36)
    at step (/home/evinfug/workspaces/theia/packages/filesystem/lib/node/disk-file-system-provider.js:73:23)
    at Object.throw (/home/evinfug/workspaces/theia/packages/filesystem/lib/node/disk-file-system-provider.js:54:53)
    at rejected (/home/evinfug/workspaces/theia/packages/filesystem/lib/node/disk-file-system-provider.js:46:65)

For such a case, should the preference service create the settings.json if we programatically attempt to set a preference?

Steps to Reproduce:

  1. make sure that your home .theia folder does not exist (ex: rm -rf ~/.theia)
  2. start the application
  3. open devtools
  4. change theme using the command palette
  5. notice the thrown errors on the console

theme

@vince-fugnitto
Copy link
Member Author

I'm wondering if its not a real-world use case that the ~/.theia folder is deleted and is just and issue with my workflow of clearing the home folder when testing/performing a cleanup.

@akosyakov
Copy link
Member

I would expect that it writes a new file. It looks like a regression. I will have a look into it. So I delete my home folder and try to change theme?

@akosyakov akosyakov added bug bugs found in the application filesystem issues related to the filesystem preferences issues related to preferences labels Aug 4, 2020
@akosyakov akosyakov self-assigned this Aug 4, 2020
@vince-fugnitto
Copy link
Member Author

I would expect that it writes a new file. It looks like a regression. I will have a look into it. So I delete my home folder and try to change theme?

Yes exactly 👍

@akosyakov
Copy link
Member

It only reproducible if I delete the entire user home directory (not only settings file). The issue is that nsfw watcher collapses and does not report that the file on the disk is deleted. I believe it should have been the same with the old fs API. Deleing user home when app is running is error prone for sure there are many data besides settings file.

@vince-fugnitto
Copy link
Member Author

Just to add, I verified in v1.4.0 and the error is not thrown under the same use-case.

@akosyakov
Copy link
Member

Oh, new fs api stops creating parent directories at the root and for user-storage scheme everything belong to the root, so we have to add some parent directory like user-storage://user/settings.json, where user corresponds to .theia.

akosyakov added a commit that referenced this issue Aug 5, 2020
Otherwise `FileService` fails to create the user directory.

Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
akosyakov added a commit that referenced this issue Aug 5, 2020
Otherwise `FileService` fails to create the user directory.

Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
akosyakov added a commit that referenced this issue Aug 6, 2020
Otherwise `FileService` fails to create the user directory.

Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs found in the application filesystem issues related to the filesystem preferences issues related to preferences
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants