microsoft / microsoft/terminal
Terminal overwriting hard link to settings.json
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 105k
- Forks
- 9.6k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 29
Description
### Windows Terminal version
1.15.3465.0
### Windows build number
10.0.19045.2546
### Other Software
_No response_
### Steps to reproduce
Replacing settings.json with a hard link to an existing settings file while the terminal is running causes weird behavior. The hard link is broken shortly after it is created. Then it looks like the previous settings file and newly linked file are merged and written out as a new, unlinked, combined settings file.
I ran into this accidentally because the quake window was still open and I didn't realize it.
Repro:
* Open terminal
* `New-Item -ItemType HardLink -Force -Path settings.json -Target my-synced-settings.json`
* `(Get-Item settings.json).LinkType -eq "HardLink"` is true
* `Start-Sleep -Milliseconds 1000`
* `(Get-Item settings.json).LinkType -eq "HardLink"` is now false
But if you do it a second time it works
* `New-Item -ItemType HardLink -Force -Path settings.json -Target my-synced-settings.json`
* * `(Get-Item settings.json).LinkType -eq "HardLink"` is true
* `Start-Sleep -Milliseconds 1000`
* `(Get-Item settings.json).LinkType -eq "HardLink"` is true
Obviously I should be killing terminal processes before doing this, so maybe it's a bit moot. The terminal seems to respect a hard link just fine if it's already there when it starts up. Still the nuke-and-merge behavior is certainly surprising.
### Expected Behavior
If a new settings.json is copied over the existing one the terminal should not merge with or overwrite it.
### Actual Behavior
If a new settings.json is copied over the existing one the terminal overwrites it with a merged copy
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the hard-link behavior with settings.json and my-synced-settings.json while the terminal is running. Trace the settings.json replacement and merge behavior, then verify that replacing the file does not break the hard link or overwrite it with a merged copy.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100