Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 700914 - net-libs/nodejs-13.1.0 sandbox violation by mkdir at $HOME/.node_modules
Summary: net-libs/nodejs-13.1.0 sandbox violation by mkdir at $HOME/.node_modules
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-22 03:20 UTC by Anton Kochkov
Modified: 2020-11-09 12:52 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (nodejs_build.log.gz,36.01 KB, application/gzip)
2019-11-22 03:20 UTC, Anton Kochkov
Details
emerge --info output (emerge_info.log,5.77 KB, text/plain)
2019-11-22 03:22 UTC, Anton Kochkov
Details
environment (nodejs-13.6.0.environment.gz,27.42 KB, application/gzip)
2020-01-12 14:30 UTC, Anton Kochkov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Kochkov 2019-11-22 03:20:01 UTC
Created attachment 597126 [details]
build.log

[32;01m * [39;49;00mPackage:    net-libs/nodejs-13.1.0
[32;01m * [39;49;00mRepository: gentoo
[32;01m * [39;49;00mMaintainer: jer@gentoo.org
[32;01m * [39;49;00mUSE:        abi_x86_64 amd64 cpu_flags_x86_sse2 elibc_glibc icu kernel_linux npm snapshot ssl userland_GNU
[32;01m * [39;49;00mFEATURES:   network-sandbox preserve-libs sandbox userpriv usersandbox
>>> Unpacking source...
>>> Unpacking node-v13.1.0.tar.xz to /var/tmp/portage/net-libs/nodejs-13.1.0/work
>>> Source unpacked in /var/tmp/portage/net-libs/nodejs-13.1.0/work
>>> Preparing source in /var/tmp/portage/net-libs/nodejs-13.1.0/work/node-v13.1.0 ...

/usr/bin/python3.7 tools/install.py install '/var/tmp/portage/net-libs/nodejs-13.1.0/image' '/usr'
 [31;01m*[0m [31;01mACCESS DENIED[0m:  mkdir:        /home/xvilka/.node_modules
Error: EACCES: permission denied, mkdir '/home/xvilka/.node_modules'
TypeError: Cannot read property 'get' of undefined
    at errorMessage (/var/tmp/portage/net-libs/nodejs-13.1.0/image/usr/lib64/node_modules/npm/lib/utils/error-message.js:38:39)
    at errorHandler (/var/tmp/portage/net-libs/nodejs-13.1.0/image/usr/lib64/node_modules/npm/lib/utils/error-handler.js:201:13)
    at /var/tmp/portage/net-libs/nodejs-13.1.0/image/usr/lib64/node_modules/npm/bin/npm-cli.js:78:20
    at cb (/var/tmp/portage/net-libs/nodejs-13.1.0/image/usr/lib64/node_modules/npm/lib/npm.js:225:22)
    at /var/tmp/portage/net-libs/nodejs-13.1.0/image/usr/lib64/node_modules/npm/lib/npm.js:263:24
    at /var/tmp/portage/net-libs/nodejs-13.1.0/image/usr/lib64/node_modules/npm/lib/config/core.js:81:7
    at Array.forEach (<anonymous>)
    at /var/tmp/portage/net-libs/nodejs-13.1.0/image/usr/lib64/node_modules/npm/lib/config/core.js:80:13
    at f (/var/tmp/portage/net-libs/nodejs-13.1.0/image/usr/lib64/node_modules/npm/node_modules/once/once.js:25:25)
    at afterExtras (/var/tmp/portage/net-libs/nodejs-13.1.0/image/usr/lib64/node_modules/npm/lib/config/core.js:172:20)
/var/tmp/portage/net-libs/nodejs-13.1.0/image/usr/lib64/node_modules/npm/lib/utils/error-handler.js:97
  var doExit = npm.config.loaded ? npm.config.get('_exit') : true
                          ^

TypeError: Cannot read property 'loaded' of undefined
    at exit (/var/tmp/portage/net-libs/nodejs-13.1.0/image/usr/lib64/node_modules/[4mnpm[24m/lib/utils/error-handler.js:97:27)
    at process.errorHandler (/var/tmp/portage/net-libs/nodejs-13.1.0/image/usr/lib64/node_modules/[4mnpm[24m/lib/utils/error-handler.js:216:3)
[90m    at process.emit (events.js:210:5)[39m
[90m    at process._fatalException (internal/process/execution.js:150:25)[39m
>>> Completed installing net-libs/nodejs-13.1.0 into /var/tmp/portage/net-libs/nodejs-13.1.0/image

 [32;01m*[0m Final size of build directory: 571292 KiB (557.9 MiB)
 [32;01m*[0m Final size of installed tree:   49228 KiB ( 48.0 MiB)

 [31;01m*[0m --------------------------- ACCESS VIOLATION SUMMARY ---------------------------
 [31;01m*[0m LOG FILE: "/var/log/sandbox/sandbox-4.log"
 [31;01m*[0m 
VERSION 1.0
FORMAT: F - Function called
FORMAT: S - Access Status
FORMAT: P - Path as passed to function
FORMAT: A - Absolute Path (not canonical)
FORMAT: R - Canonical Path
FORMAT: C - Command Line

F: mkdir
S: deny
P: /home/xvilka/.node_modules
A: /home/xvilka/.node_modules
R: /home/xvilka/.node_modules
C: npm                                                                       
 [31;01m*[0m --------------------------------------------------------------------------------
Comment 1 Anton Kochkov 2019-11-22 03:22:59 UTC
Created attachment 597128 [details]
emerge --info output
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2019-11-25 11:33:03 UTC
Does this help?


--- a/nodejs-13.1.0.ebuild
+++ b/nodejs-13.1.0.ebuild
@@ -131,6 +131,7 @@

 src_install() {
        local LIBDIR="${ED}/usr/$(get_libdir)"
+       local HOME="${T}"
        default

        pax-mark -m "${ED}"/usr/bin/node
Comment 3 Anton Kochkov 2019-11-30 14:35:48 UTC
(In reply to Jeroen Roovers from comment #2)
> Does this help?
> 
> 
> --- a/nodejs-13.1.0.ebuild
> +++ b/nodejs-13.1.0.ebuild
> @@ -131,6 +131,7 @@
> 
>  src_install() {
>         local LIBDIR="${ED}/usr/$(get_libdir)"
> +       local HOME="${T}"
>         default
> 
>         pax-mark -m "${ED}"/usr/bin/node

No, it didn't help
Comment 4 Anton Kochkov 2020-01-11 01:58:25 UTC
Still the same error with 13.6.0 version
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2020-01-11 13:00:56 UTC
(In reply to Anton Kochkov from comment #0)
> F: mkdir
> S: deny
> P: /home/xvilka/.node_modules
> A: /home/xvilka/.node_modules
> R: /home/xvilka/.node_modules
> C: npm                                                                       

Can you please attach the environment file?
Comment 6 Anton Kochkov 2020-01-12 14:30:33 UTC
Created attachment 603100 [details]
environment

Here you go - attached a gzipped environment file for nodejs-13.6.0
Comment 7 Anton Kochkov 2020-02-10 04:56:16 UTC
Still a problem for 13.8.0 version too.
Comment 8 Anton Kochkov 2020-03-26 18:08:48 UTC
Still a problem for 13.11.0 version.
Comment 9 Anton Kochkov 2020-04-05 05:53:35 UTC
Any ideas how to workaround this? NodeJS prevents me from updating my system and this bug is still present on nodejs-13.12.0
Comment 10 Anton Kochkov 2020-04-10 02:12:59 UTC
Disabled usersandbox for this package, it works with FEATURES="-usersandbox". Would be nice to get it fixed in the package eventually.
Comment 11 Jeroen Roovers (RETIRED) gentoo-dev 2020-04-10 05:37:48 UTC
(In reply to Anton Kochkov from comment #6)
> Created attachment 603100 [details]
> environment
> 
> Here you go - attached a gzipped environment file for nodejs-13.6.0

Thanks. Looks like there is nothing of value in there.

Do you use sudo to run emerge as root, or do you "become" root and then run emerge from the root shell?
Comment 12 Jeroen Roovers (RETIRED) gentoo-dev 2020-04-10 05:43:44 UTC
(In reply to Jeroen Roovers from comment #11)
> (In reply to Anton Kochkov from comment #6)
> > Created attachment 603100 [details]
> > environment
> > 
> > Here you go - attached a gzipped environment file for nodejs-13.6.0
> 
> Thanks. Looks like there is nothing of value in there.

Having said that:

declare -x npm_config_prefix="/home/xvilka/.node_modules"

What could have set that? Does it help to `unset npm_config_prefix` in the ebuild?
Comment 13 Anton Kochkov 2020-04-11 17:27:48 UTC
I run it under "su", with the current directory "/home/xvilka"

the "npm_config_modules" variables inherited from the "xvilka" user environment, but probably ebuild should ignore that variable for obvious reasons.

If I unset it before merging - it builds fine, indeed.
Comment 14 Marek Szuba archtester gentoo-dev 2020-11-09 12:52:38 UTC
Closing due to inactivity, please reopen with updated information if this is still a problem.