From nobody Sun Jun 25 08:21:48 2023 X-Original-To: freebsd-ports@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QpkTr3bxqz4hpGX for ; Sun, 25 Jun 2023 08:21:52 +0000 (UTC) (envelope-from tagattie@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QpkTr38BXz4kqq; Sun, 25 Jun 2023 08:21:52 +0000 (UTC) (envelope-from tagattie@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687681312; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eNztJmJ15/iEoCUROjzJIytFSCrYdtPQHfIpbPWu9Xc=; b=GIxt7GlFYEF5W4BJbRXI6Ud2MKRz91qpHhZmykmFn5LtHO04Kfn2tmEDqLGiNP2LNwR0ow 1DOAlWpqpYzQqAeKuVtaYOfuVPxJ9VFsolTgvyiELkiItXLF101Qg+1T8pif4BIMAP9OB0 vaOO0eCIWC3bc/pj4+uxAx5kzX33K9tr2/0/b3bN+3YebfcrEX5A+yW08NMyjpVXexggwX ACrrtQ06SmB0NlF4lJL/QDCcnQ5VAGhKOtuZieVKtvFnZhw13ANK1mgU5MJxvhWNfAu5sv QiQnTjusiOMgrIPJ7cP+O9WdacgO4zklAiYzBi6sJmmgpKv+grdmnOEBDc4tcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687681312; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eNztJmJ15/iEoCUROjzJIytFSCrYdtPQHfIpbPWu9Xc=; b=CU5J2PolFCyzLqAAP3ThqsYRBp6WuMb/BqySdFexoUSni+UuAlhXSWu0jBPB9UH6BcYNeT XNsEd0NiQoABYxpo8ownT/D8jDv/0dfztWW6uBAAw5BHvrcO38pkvcbym6WV3bLCt0hheI RO7oqpffwwsoysH5Bary/5/+Gkmcw9k0nC9ndnoU/Tv6rEk1XzYZVhUiifYNg62Ou/Wtpl 1Ikzx5sJSIhuXmfGyT/307MVPo4bfVECiRaEQ9xcJHq7oqPjT5WujlCNoqKIpsa7/ZOYA2 11yedyCcn1Sy3VzdET9tmEpGBcRJGXB7ezXgjKTon1sgyqXu1e9S2LwrhK9CIg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687681312; a=rsa-sha256; cv=none; b=nN/vBFPhPdvc6JcK3EsPpFS4/cMtORkKM3KcB0zZIo87J+HgxdzAio0HwKidevljIEwpVf DeevXxS/+6tE/3nUxh1gr7mF2UtNrCiL0V3S9zltWeCR9qGQfNgo+XMqhIsrkzD8HF8zwH 1XsxJuXCeGGpCnsQC3InxgqXPBcRg0kkU46+AaU9QExk4gC2sYg0wWoud7M0B9Tt2W1woe FwKInkOHaaZip9HVPfVf5beldfkW8cfAtLVUCmjMaF3Ldy0OxdLzHPvqiMXkbQ5BGnzGo4 dvKNJKLjFJZr1HUN0l8wvXPMXiFmegvhlWrkuV8PanMGk8oW1Z0WkKCnKoAW/w== Received: from [IPV6:2409:11:22a0:8900::34] (unknown [IPv6:2409:11:22a0:8900::34]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: tagattie/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4QpkTq3nyTzKrM; Sun, 25 Jun 2023 08:21:51 +0000 (UTC) (envelope-from tagattie@FreeBSD.org) Message-ID: <898f8065-1544-e157-6139-4f1269ab6ddb@FreeBSD.org> Date: Sun, 25 Jun 2023 17:21:48 +0900 List-Id: Porting software to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-ports List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-ports@freebsd.org X-BeenThere: freebsd-ports@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: Is it possible to build node package as single executable binary? Content-Language: en-US To: Miroslav Lachman <000.fbsd@quip.cz>, FreeBSD Ports References: <5be6c0d2-5d71-38c9-028a-8ce065102be9@FreeBSD.org> From: Hiroki Tagato In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ThisMailContainsUnwantedMimeParts: N Hi, On 2023/06/25 6:42, Miroslav Lachman wrote: > Hello. > I built it in poudriere, installed on target server but it failed to run: > > # bw -h > pkg/prelude/bootstrap.js:1876 >       throw error; >       ^ > > Error: > /tmp/pkg/3f7546d249992c0f148a46a96767b364fe2616ab97eacd2ea346785f0bee0134/argon2/lib/binding/napi-v3/argon2.node: mmap of data failed: Permission denied >     at process.dlopen (pkg/prelude/bootstrap.js:2255:28) >     at Object.Module._extensions..node > (node:internal/modules/cjs/loader:1189:18) >     at Module.load (node:internal/modules/cjs/loader:981:32) >     at Function.Module._load (node:internal/modules/cjs/loader:822:12) >     at Module.require (node:internal/modules/cjs/loader:1005:19) >     at Module.require (pkg/prelude/bootstrap.js:1855:31) >     at require (node:internal/modules/cjs/helpers:102:18) >     at Object. > (/snapshot/wrkdirs/overlays/mfh_overlay/security/bitwarden-cli/work/clients-cli-v2023.4.0/node_modules/argon2/argon2.js:9:25) >     at Module._compile (pkg/prelude/bootstrap.js:1930:22) >     at Object.Module._extensions..js > (node:internal/modules/cjs/loader:1159:10) { >   code: 'ERR_DLOPEN_FAILED' > } > > > Then I found it is because we have /tmp mounted with nosuid, noexec set > for security reason. > When I remounted /tmp with exec, the bw from package runs without error. > > Do you know why this packaged "bw" needs /tmp to be executable while > "bw" installed by "npm install" works with noexec set on /tmp? It appears native node modules have to be written on the disk before being executed. There is an explanatory comment at the following URL: https://github.com/vercel/pkg/blob/main/prelude/bootstrap.js#L2208 > Is there a way to fix it? I really would like to keep /tmp noexec. The path the native module written to seems TMPDIR-aware. So one workaround would be setting TMPDIR somewhere other than "/tmp". Cheers, Hiroki