2021/12/29 10:11:24 couldn't open sink "/Users/mprime/code/misc/superhighway84.git/.xdg-cache/superhighway84.log": open /Users/mprime/code/misc/superhighway84.git/.xdg-cache/superhighway84.log: permission denied
panic: couldn't open sink "/Users/mprime/code/misc/superhighway84.git/.xdg-cache/superhighway84.log": open /Users/mprime/code/misc/superhighway84.git/.xdg-cache/superhighway84.log: permission denied
goroutine 1 [running]:
log.Panicln(0xc000d8ff50, 0x1, 0x1)
/nix/store/pzqpv155khkrp7nai0mbsc32zxlp9s0k-go-1.16.2/share/go/src/log/log.go:368 +0xae
main.main()
/Users/mprime/code/misc/superhighway84.git/superhighway84.go:59 +0x1f3
Uh? Can't open a log file?
$ ls -la
(...)
drwxr-xr-x 8 mprime staff 256 Dec 29 09:59 .ipfs-sh84
d--------- 2 mprime staff 64 Dec 29 10:09 .xdg-cache
I'm not a Golang ninja, but this seems to be the expected result of os.MkdirAll(path, os.ModeDir).
Here's a simple repro if you want to try on your system (I tried both macOS and Unbuntu with the same end result: directory is created with permissions 000).
Switching to 0755 seems reasonable. I see you have other file permissions embedded in the same file (e.g.,: os.OpenFile(configFile, os.O_CREATE|os.O_RDWR, 0644)) so I just hardcoded it.
If SH84 creates the DB cache dir OR the config dir, then they get created with wonky permissions, and SH84 fails to start.
I bumped into this while testing SH84 for the first time. In particular, I was trying to write anything outside of the repository folder
I was greeted by this error on launch:
Uh? Can't open a log file?
I'm not a Golang ninja, but this seems to be the expected result of
os.MkdirAll(path, os.ModeDir)
.Here's a simple repro if you want to try on your system (I tried both macOS and Unbuntu with the same end result: directory is created with permissions
000
).Switching to
0755
seems reasonable. I see you have other file permissions embedded in the same file (e.g.,:os.OpenFile(configFile, os.O_CREATE|os.O_RDWR, 0644)
) so I just hardcoded it.