This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git

commit 358cfcbbab15b8225e651cb2b828ea800a88afa6
Author: Christopher Collins <ccoll...@apache.org>
AuthorDate: Fri Jun 21 17:21:59 2019 -0700

    build.sh: Remove module write-protection before rm
    
    If Go module support is enabled, newt's `build.sh` script fails with
    messages like these:
    
    ```
    +rm -rf /home/travis/gopath/bin /home/travis/gopath/pkg
    rm: cannot remove 
‘/home/travis/gopath/pkg/mod/golang.org/x/sys@v0.0.0-20180707002001-3c6ecd8f22c6/README.md’:
 Permission denied
    rm: cannot remove 
‘/home/travis/gopath/pkg/mod/golang.org/x/sys@v0.0.0-20180707002001-3c6ecd8f22c6/.gitattributes’:
 Permission denied
    rm: cannot remove 
‘/home/travis/gopath/pkg/mod/golang.org/x/sys@v0.0.0-20180707002001-3c6ecd8f22c6/plan9/mksysnum_plan9.sh’:
 Permission denied
    rm: cannot remove 
‘/home/travis/gopath/pkg/mod/golang.org/x/sys@v0.0.0-20180707002001-3c6ecd8f22c6/plan9/pwd_go15_plan9.go’:
 Permission denied
    rm: cannot remove 
‘/home/travis/gopath/pkg/mod/golang.org/x/sys@v0.0.0-20180707002001-3c6ecd8f22c6/plan9/syscall.go’:
 Permission denied
    ```
    
    This is because Go write protects modules when it downloads them to
    `$GOPATH/pkg`.  The fix is to relax permissions on this directory's
    contents before deleting it.
---
 build.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/build.sh b/build.sh
index d0299f3..691e6ad 100755
--- a/build.sh
+++ b/build.sh
@@ -96,4 +96,7 @@ DATE="$(date +%F_%R)"
 )
 
 ### Delete the temporary directory.
+# We have to relax permissions on the directory's contents; modules in
+# $GOPATH/pkg are write-protected.
+chmod -R 755 "$godir"
 rm -rf "$godir"

Reply via email to