From 3f11634372af5c483323f96ac83bdea78eda7b73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Huan=20=28=E6=9D=8E=E5=8D=93=E6=A1=93=29?= Date: Mon, 15 Nov 2021 23:23:29 +0800 Subject: [PATCH] Add `read` permission to the downloaded `jq` binary (#437) --- scripts/install-binary.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/install-binary.js b/scripts/install-binary.js index ea1e9c14..a6622d78 100644 --- a/scripts/install-binary.js +++ b/scripts/install-binary.js @@ -76,7 +76,13 @@ if (platform in DOWNLOAD_MAP) { const distPath = path.join(OUTPUT_DIR, JQ_NAME) fs.renameSync(path.join(OUTPUT_DIR, filename), distPath) if (fileExist(distPath)) { - fs.chmodSync(distPath, fs.constants.S_IXUSR || 0o100) + // fs.chmodSync(distPath, fs.constants.S_IXUSR || 0o100) + // Huan(202111): we need the read permission so that the build system can pack the node_modules/ folder, + // i.e. build with Heroku CI/CD, docker build, etc. + // @see https://www.gnu.org/software/libc/manual/html_node/Permission-Bits.html + fs.chmodSync(distPath, + (fs.constants.S_IXUSR | fs.constants.S_IREAD | fs.constants.S_IROTH | fs.constants.S_IRGRP) || + 0o100 | 0o400 | 0o040 | 0o004) } console.log(`Downloaded in ${OUTPUT_DIR}`) })