Repository navigation
Conversation
restrictFilePermissions/restrictDirectoryPermissions pass the unqualified username to icacls. When the computer name equals the username (common on personal machines: user 'hackdiva' on PC 'HackDiva'), LookupAccountName resolves the bare name to the COMPUTER account — a bare machine SID that no user token holds. Combined with /inheritance:r, the sole grant goes to an unusable SID and the actual user is locked out of their own state dir. Because these calls are idempotent-by-design, every browse invocation re-applies the lockout, wedging .gstack dirs so hard that icacls /reset and unqualified /grant repairs fail the same way. Qualify the grantee with USERDOMAIN (the machine name for local accounts) so the lookup is unambiguous. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
(Edited: a shell mangled the original comment, and the merge queue is maintainer-only anyway.) Ready for review whenever a maintainer has a moment — one-file fix, no behavior change on machines without the computer-name/username collision. |
|
An error occurred while submitting your PR to the queue: |
|
Closing: this was absorbed or superseded on main by v1.67.0.0 or earlier (see the v1.67 tracker-wave receipts in PR #2604). Thank you! |
Bug
restrictFilePermissions/restrictDirectoryPermissions(browse/src/file-permissions.ts) pass the unqualified username to icacls:When the computer name equals the username — common on personal machines (this repro: user
hackdivaon a PC namedHackDiva) — Windows'LookupAccountNameresolves the bare name to the computer account: a bare machine SID (S-1-5-21-…, no RID) that no user token holds.Combined with
/inheritance:r, the directory ends up with a single ACE granting Full Control to a SID nobody has. The actual user — including the owner — is locked out of gstack's own state dir. And because these calls are documented as "idempotent, safe to re-apply", every browse invocation re-applies the lockout, so:~/.gstackand every project.gstackbecome unreadable/undeletable ("Permission denied" from both PowerShell and Git Bash),icacls /resetor an unqualified/grant <username>silently fail the same way (same ambiguous lookup), which makes this maddening to diagnose — it presents as machine-level ACL corruption with a phantom "re-stamper".Fix
Qualify the grantee with
USERDOMAIN(the machine name for local accounts, the domain for domain accounts), making the lookup unambiguous:One new helper (
currentUserAccount()), used by both call sites. No behavior change on machines without the name collision.Recovery note for affected users
Wedged dirs need the SID form (names stay ambiguous):
takeown /f <dir> /r /d ythenicacls <dir> /grant:r "*<your-user-SID>:(OI)(CI)F" /t(get the SID fromwhoami /user).🤖 Generated with Claude Code