Hosts File Editor Does Not Clear/Reinstate Read Only Status
Microsoft PowerToys version
0.67.0
Installation method
PowerToys auto-update
Running as admin
Yes
Area(s) with issue?
Hosts File Editor
Steps to reproduce
- open hosts file editor
- make entry
- receive error msg (in pink box at bottom) to the effect that hosts was not saved.
- say, "hmmm, why not?"
- investigate and discover that the read only status was not changed to allow the file to be written to.
- remove read only status manually.
- repeat steps 1 & 2
- file saved as is ought to be
- check file properties, discover read-only status not reinstated
- reinstate read-only status manually
✔️ Expected Behavior
Things to work as they ought.
Editor app should remove read-only, save file, reapply read-only.
Should be done automatically, without operator intervention, but perhaps with notice.
If overly cautious, could be done by opening the file property box so change can be made manually -- but why go through that, when you can do it as well or better with notepad+++?
❌ Actual Behavior
As detailed in 'Steps...' The pink error msg box should be much more evident, maybe across the text area. I missed it the first time it showed.
BTW, attempted to generate bug report log. Power toys refused and is now frozen. I take that back -- has just crashed. Restarted it, now have two bug report logs. Here they are: PowerToysReport_2023-02-02-16-42-40.zip PowerToysReport_2023-02-02-16-46-34.zip
Other Software
No response
Hi @whawn1 , hosts file is not "Read Only" by default on Windows. If it was set as read only, I assume it was changed. From the point of view of an editor, this is intended behavior (don't write files that are marked as read only). Looks like it's intended behavior. /needinfo
If it is not read-only by default, now, it once was. It ought to be still. That file is vulnerable to all sorts of shenanigans. The editor should take that into account, perhaps with a check box : "allow editing" or some such, and should automatically place it back to read-only.