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

Terminal shouldn't treat read-only settings as an error reading settings #7727

Closed
allykzam opened this issue Sep 24, 2020 · 11 comments · Fixed by #7950
Closed

Terminal shouldn't treat read-only settings as an error reading settings #7727

allykzam opened this issue Sep 24, 2020 · 11 comments · Fixed by #7950
Labels
Area-Settings Issues related to settings and customizability, for console or terminal good first issue This is a fix that might be easier for someone to do as a first contribution Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Milestone

Comments

@allykzam
Copy link

Environment

Windows build number: Win32NT             10.0.19041.0 Microsoft Windows NT 10.0.19041.0
Windows Terminal version (if applicable): 1.3.2651.0

Any other software?

Steps to reproduce

  • Change settings.json to be read-only
  • Install a new WSL flavor
  • Launch Terminal

Expected behavior

Terminal launches normally, and honors the current contents of the settings file. The new WSL flavor does not show up in the new tab options, since it is not present in the settings.

Actual behavior

Terminal launches and displays the following error message:

Failed to load setttings

Settings could not be loaded from file. Check for syntax errors, including trailing commas.

Temporarily using the Windows Terminal default settings.

My assumption here is that Terminal is encountering an exception trying to "fix" my settings file for me on launch, and just bubbles up this generic error dialog. This can be worked around by just not marking the settings file as read-only, or specifying the disabledProfileSources option with at least Windows.Terminal.Wsl in it, but I'm reporting this because it seems a bit heavy-handed to tell me my settings are completely unusable just because Terminal can't replace my settings.

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Sep 24, 2020
@steveroot

This comment has been minimized.

@DHowett

This comment has been minimized.

@DHowett
Copy link
Member

DHowett commented Sep 24, 2020

@amazingant if I'm reading between the lines, what you'd rather have is "stop putting in profiles I don't care about". That we consider a read-only file an error is almost entirely accidental, and we definitely shouldn't hork it when that happens.

I'd rather solve your actual issue than the one you've made for yourself, however. 😄

@allykzam
Copy link
Author

allykzam commented Sep 24, 2020

@DHowett I actually am after the blowing up when my settings file is read-only - I prefer to hand-edit the settings file and keep it updated/committed in my dotfiles repo 😆

Since there's a setting to specifically stop adding other profiles (yay!), I'll definitely make use of it going forward. 😄 I subscribed myself to this repo's releases so I know when there's new settings, and usually undo the read-only and fiddle with the new settings after I get updated; it's fun seeing the progress y'all are making and getting to try the new features.

@DHowett DHowett changed the title Bug Report Failed to load settings Terminal shouldn't treat read-only settings as an error reading settings Sep 25, 2020
@DHowett DHowett added Area-Settings Issues related to settings and customizability, for console or terminal good first issue This is a fix that might be easier for someone to do as a first contribution Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Terminal The new Windows Terminal. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Sep 25, 2020
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Sep 25, 2020
@DHowett DHowett added this to the Terminal v1.5 milestone Sep 25, 2020
@steveroot
Copy link

"same error, different message" is a different error.

You have entered a string in a field that requires a number.

Thanks & understood. @DHowett would you like a new bug report or are we happy the change to reject past working settings.json is intentional?
(and I really don't mind, my settings.json hadn't been changed for months so the error was unexpected. The error message also told me exactly what to fix so unless ignoring the whole settings.json could have unforeseen consequences for others I'm happy to leave it here.)

@DHowett
Copy link
Member

DHowett commented Sep 25, 2020

@steveroot This one's.. complicated. We chose to move to uniform JSON parsing to make our lives easier in preparation for #1564... but that came at the cost of a couple incidental compatibility tricks we were playing.

Having been the person to make that decision, I chose to allow for some small amount of scream testing. If enough people reported trouble with a particular setting, we'll go backsies on it. . . but until there's a big enough mess of complaints the strictness is "by design".

Make sense? 😄

@steveroot
Copy link

Good choice, it makes sense and I agree. The error I saw (+the useful error explanation with how to fix it) is small price to pay for progress.

@mpela81
Copy link
Contributor

mpela81 commented Oct 15, 2020

How would you expect this to work?
One option could be:

  • Do not throw exceptions when you can't write the settings file (e.g. remove exceptions from CascadiaSettings::_WriteSettings, just return a success flag)
  • If you could not write it, show a warning message
  • Settings are still updated in memory and applied (including new generated profiles, etc.), just not saved on disk.
  • As they were not saved, settings will be updated again at the next start (raising a warning again if the issue persists)

@allykzam
Copy link
Author

As an end user, I'd prefer that Terminal not complain at all, and have it still honor my settings as are were on disk. As a developer, if Terminal successfully reads the settings file and deserializes/validates them, but can't write an updated version of them, I'd probably want it to still honor the settings as they are on disk, but to show the user (still me) a warning.

While I've done this on purpose on my system, if someone else had done this by accident, or there were other permissions/disk issues they had run into, it would be more useful to say there was an issue writing the settings file rather than saying they made syntax errors.

@ghost ghost added the In-PR This issue has a related PR label Oct 16, 2020
@ghost ghost closed this as completed in #7950 Oct 23, 2020
@ghost ghost removed the In-PR This issue has a related PR label Oct 23, 2020
ghost pushed a commit that referenced this issue Oct 23, 2020
We wrap the call to `_WriteSettings` in
`CascadiaSettingsSerialization.cpp` in a try/catch block, and if we
catch an error we append a warning telling the user to check the
permissions on their settings file. 

Closes #7727
@ghost ghost added the Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. label Oct 23, 2020
DHowett pushed a commit that referenced this issue Oct 27, 2020
We wrap the call to `_WriteSettings` in
`CascadiaSettingsSerialization.cpp` in a try/catch block, and if we
catch an error we append a warning telling the user to check the
permissions on their settings file.

Closes #7727

(cherry picked from commit 16b8ea1)
@ghost
Copy link

ghost commented Nov 11, 2020

🎉This issue was addressed in #7950, which has now been successfully released as Windows Terminal v1.4.3141.0.:tada:

Handy links:

@ghost
Copy link

ghost commented Nov 11, 2020

🎉This issue was addressed in #7950, which has now been successfully released as Windows Terminal Preview v1.5.3142.0.:tada:

Handy links:

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal good first issue This is a fix that might be easier for someone to do as a first contribution Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants