diff --git a/docker/download.sh b/docker/download.sh index 21e97ba3..f3c4e6c5 100755 --- a/docker/download.sh +++ b/docker/download.sh @@ -1,5 +1,22 @@ #!/bin/bash +if [[ $# -ne 2 ]] ; then + echo "The $0 utility requires two input arguments:" + echo "- Arch for compilers to download. See https://github.com/ethereum/solc-bin for available archs." + echo "- Target directory to store the downloaded compilers." + echo "" + echo "Note that to use custom compiler cache path, the env variable SOL_AST_COMPILER_CACHE should be set." + echo "See README.md for the details." + echo "" + echo "Example:" + echo "" + echo "$0 'wasm' path/to/compiler/cache" + echo "export SOL_AST_COMPILER_CACHE=path/to/compiler/cache" + echo "sol-ast-compile --locate-compiler-cache" + + exit 1; +fi + ARCH="${1}" CACHE_DIR="${2}" TARGET_DIR="$CACHE_DIR/$ARCH" diff --git a/src/compile/kinds/compiler.ts b/src/compile/kinds/compiler.ts index 8502dd56..3675f621 100644 --- a/src/compile/kinds/compiler.ts +++ b/src/compile/kinds/compiler.ts @@ -142,12 +142,12 @@ export async function getCompilerForVersion( ); /** - * Native compilers are exeсutable files, so give them valid permissions. - * WASM compilers are loaded by NodeJS, so write them as common files. + * Native compilers are exeсutable files, so give them proper permissions. + * WASM compilers are loaded by NodeJS, so write them as readonly common files. */ - const options = kind === CompilerKind.Native ? { mode: 0o555 } : undefined; + const permissions = kind === CompilerKind.Native ? 0o555 : 0o444; - await fse.writeFile(compilerLocalPath, response.data, options); + await fse.writeFile(compilerLocalPath, response.data, { mode: permissions }); } if (kind === CompilerKind.Native) {