repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

docs(windows-filenames): document Git Bash handling

1e0cffb2b0c953798673f47185617a5724552253

Oliver Krylow <o.krylow@isp-insoft.de> ·

unsigned

Browse filesCompare with HEAD

Changed files (1)

+48 / −1 text lines

Diff layout

pi/agent/skills/windows-filename-guidance/SKILL.md

Modified

+48 / −1 text lines

7878filesystem's rules, ACLs, locks, or corruption. Do not combine it with a
7979relative path.
81## Git Bash Boundary
83Git Bash/MSYS2 rewrites path-looking arguments passed to native Windows
84executables. This can also affect shell program text passed as one argument,
85such as a remote command containing `2>/dev/null`. Preserve literal POSIX text
86at that boundary with the documented exclusion variable:
88```bash
89MSYS2_ARG_CONV_EXCL='*' podman.exe machine ssh 'command 2>/dev/null'
90```
92Do not assume `MSYS_NO_PATHCONV` covers every native executable.
94Bash double quotes reduce a leading `\\` to `\`. Therefore
95`"\\?\C:\absolute\path\NUL"` reaches a child process as the malformed
96`\?\C:\absolute\path\NUL`. When invoking `cmd.exe` from Bash, preserve the
97literal path and disable MSYS2 argument conversion:
99```bash
100MSYS2_ARG_CONV_EXCL='*' cmd.exe /d /c del '\\?\C:\absolute\path\NUL'
101```
103The `cmd` examples below are native `cmd.exe` syntax. Do not paste their quoted
104paths unchanged into a Bash command.
81106## Delete Problem Entries
83108Show the exact target and obtain explicit confirmation first. Reject wildcards,
84109relative paths, drive/share roots, and ambiguous targets.
86File:
111If Git Bash created the entry and can enumerate its exact absolute POSIX path,
112prefer removing it through that same layer:
114```bash
115rm -- "$PWD/NUL"
116```
118File through native `cmd.exe`:
88120```cmd
89121cmd.exe /d /c del "\\?\C:\absolute\path\NUL"
111143Preserve exact spelling, extension, spaces, and periods. Enumerate the parent
112144again; report success only when the literal entry is absent.
146`git status` is not direct filesystem verification. If deletion succeeds and
147parent enumeration no longer contains the literal entry, but Git still reports
148it, bypass its filesystem monitor and untracked cache once:
150```bash
151git -c core.fsmonitor=false -c core.untrackedCache=false status --short
152```
154If that removes the report and the repository uses the built-in monitor,
155restart it. Do not issue further deletion commands solely because cached Git
156status still names the entry.
114158If the extended path still fails, use `dir /a /x` on the parent. Verify the 8.3
115159short name maps to the exact target before proposing deletion through that name.
129173## Sources
175- [MSYS2: filesystem paths and argument conversion](https://www.msys2.org/docs/filesystem-paths/)
176- [GNU Bash: double-quote backslash handling](https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html)
177- [Git: built-in filesystem monitor](https://git-scm.com/docs/git-fsmonitor--daemon)
131178- [Super User: removing a file named NUL](https://superuser.com/questions/282194/how-do-i-remove-a-file-named-nul-on-windows)
132179- [Microsoft KB 320081: undeletable NTFS entries](https://learn.microsoft.com/en-us/troubleshoot/windows-server/backup-and-storage/cannot-delete-file-folder-on-ntfs-file-system)
133180- [Microsoft: Naming Files, Paths, and Namespaces](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file)