Closed charles-d-burton closed 2 years ago
I fixed it locally with the following command
❯ sudo find /usr/local/lib/tinygo/pkg/ -type f | sudo xargs chmod 644
❯ tinygo build -target pico -o test.u2f
Confirming present in 0.21 and 0.22 (but not in 0.20, which didn't contain those files):
$ wget https://github.com/tinygo-org/tinygo/releases/download/v0.22.0/tinygo_0.22.0_amd64.deb
$ ar x tinygo_0.22.0_amd64.deb
$ tar tvf data.tar.gz | grep ".-----"
-rw------- 0/0 401872 2021-11-18 05:31 ./usr/local/lib/tinygo/pkg/armv6m-unknown-unknown-eabi/compiler-rt/lib.a
drwx------ 0/0 0 2021-11-18 05:31 ./usr/local/lib/tinygo/pkg/armv6m-unknown-unknown-eabi/picolibc/include/
-rw------- 0/0 764890 2021-11-18 05:31 ./usr/local/lib/tinygo/pkg/armv6m-unknown-unknown-eabi/picolibc/lib.a
-rw------- 0/0 387320 2021-11-18 05:31 ./usr/local/lib/tinygo/pkg/armv7em-unknown-unknown-eabi/compiler-rt/lib.a
drwx------ 0/0 0 2021-11-18 05:31 ./usr/local/lib/tinygo/pkg/armv7em-unknown-unknown-eabi/picolibc/include/
-rw------- 0/0 744574 2021-11-18 05:31 ./usr/local/lib/tinygo/pkg/armv7em-unknown-unknown-eabi/picolibc/lib.a
-rw------- 0/0 387376 2021-11-18 05:31 ./usr/local/lib/tinygo/pkg/armv7m-unknown-unknown-eabi/compiler-rt/lib.a
drwx------ 0/0 0 2021-11-18 05:31 ./usr/local/lib/tinygo/pkg/armv7m-unknown-unknown-eabi/picolibc/include/
-rw------- 0/0 744050 2021-11-18 05:31 ./usr/local/lib/tinygo/pkg/armv7m-unknown-unknown-eabi/picolibc/lib.a
Fun fact: mac ar cannot deal with those debs because they mistakenly have a slash after the filenames. Might be an fpm issue...
Looks like original sin is committed by tinygo itself?
$ umask
0002
$ strace -o slog -e trace=file -f ./build/tinygo build-library -target=cortex-m4 -o build/release/tinygo/pkg/thumbv7em-unknown-unknown-eabi-cortex-m4/picolibc picolibc
...
88138 mkdirat(AT_FDCWD, "build/release/tinygo/pkg/thumbv7em-unknown-unknown-eabi-cortex-m4/picolibc", 0775) = 0
...
88138 mkdirat(AT_FDCWD, "build/release/tinygo/pkg/thumbv7em-unknown-unknown-eabi-cortex-m4/picolibc/include", 0700) = 0
Somehow "tinygo build-library" is using the wrong permissions when creating that include directory?
So it appears that the underlying cause is that we use os.TempFile
files which are created with very restricted permissions and we simply copy those files with the same permissions.
I think we should loosen up those permissions a bit.
Installed using the .deb package for ubuntu. I'm getting the following permissions error, it's easy enough to fix, just posting this here because I think the .deb needs the permissions updated
The permissions on those files are set to read by root onlY