Open mna opened 1 year ago
I think
Should be
name := syscall.UTF16ToString((*[syscall.MAX_LONG_PATH]uint16)(unsafe.Pointer(&raw.FileName))[:raw.FileNameLength>>1-1])
But don't have access to win at the moment.
Are you able to create a test case the reproduces this issue that we can run in CI?
I also don't have access to Windows but I added a github action on my fork that runs the existing test suite on Windows with the race detector and it does trigger that error: https://github.com/mna/notify/actions/runs/4577859751/jobs/8083780353
I tried your proposed fix but it failes the tests (looking at the results, it appears that the original slicing is correct, the -1
does remove the final letter):
got notify.FileActionAdded: "D:\a\notify\notify\testdata\2701580191\src\github.com\rjeczalik\fs\fs_windows.g"
CI run: https://github.com/mna/notify/actions/runs/4577895135/jobs/8083852947
I also tried with parens as I wasn't sure about the operator precedence of the shift, but yeah same thing.
Hello,
I'm getting the error mentioned in the title when running with the
-race
detector, output is:I wasn't familiar with that error (was expecting a data race warning if a race was found, had never seen that but I usually don't use Windows), but I found the following link that explains it a little: https://github.com/golang/go/issues/54690#issuecomment-1228575887
It appears that this is the line causing the issue: https://github.com/rjeczalik/notify/blob/master/watcher_readdcw.go#L406
Sorry not to provide a small reproducible example, I don't have a Windows machine handy to try to isolate the issue, this is coming from a Github Actions CI run on an internal repo. Thought it'd still be a useful info to report, and let me know if you want me to try a potential fix, this I can do relatively easily.
Thanks, Martin
EDIT: forgot to mention, this is with