Skip to content

Commit 7d4bf09

Browse files
aykevldeadprogram
authored andcommitted
builder: use correct permission bits when creating a library
Previously, the wrong permission bits were emitted by `tinygo build-library`. This commit fixes that, by `chmod`'ing to reasonable default permission bits.
1 parent 320f215 commit 7d4bf09

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,4 @@ deb: build/release
693693
@mkdir -p build/release-deb/usr/local/lib
694694
cp -ar build/release/tinygo build/release-deb/usr/local/lib/tinygo
695695
ln -sf ../lib/tinygo/bin/tinygo build/release-deb/usr/local/bin/tinygo
696-
echo "Work around bad permissions set by tinygo build-library?"
697-
find build/release-deb -type d -exec chmod +rx '{}' ';'
698-
find build/release-deb -type f -exec chmod +r '{}' ';'
699696
fpm -f -s dir -t deb -n tinygo -v $(shell grep "const Version = " goenv/version.go | awk '{print $$NF}') -m '@tinygo-org' --description='TinyGo is a Go compiler for small places.' --license='BSD 3-Clause' --url=https://tinygo.org/ --deb-changelog CHANGELOG.md -p build/release.deb -C ./build/release-deb

builder/library.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ func (l *Library) load(config *compileopts.Config, tmpdir string) (job *compileJ
103103
if err != nil {
104104
return nil, nil, err
105105
}
106+
err = os.Chmod(temporaryHeaderPath, 0o755) // TempDir uses 0o700 by default
107+
if err != nil {
108+
return nil, nil, err
109+
}
106110
err = os.Rename(temporaryHeaderPath, headerPath)
107111
if err != nil {
108112
switch {
@@ -182,6 +186,10 @@ func (l *Library) load(config *compileopts.Config, tmpdir string) (job *compileJ
182186
if err != nil {
183187
return err
184188
}
189+
err = os.Chmod(f.Name(), 0o644) // TempFile uses 0o600 by default
190+
if err != nil {
191+
return err
192+
}
185193
// Store this archive in the cache.
186194
return os.Rename(f.Name(), archiveFilePath)
187195
},

0 commit comments

Comments
 (0)