poudriere: "Permission denied" in the extract phase?

Adam Weinberger adamw at adamw.org
Sun Feb 25 07:20:39 UTC 2018


> On 24 Feb, 2018, at 19:53, Marcin Cieslak <saper at saper.info> wrote:
>
> On Sun, 25 Feb 2018, Marcin Cieslak wrote:
>
>> Hello,
>>
>> why is poudriere on 11.1-STABLE trying to build by custom port which has  
>> the following
>> in the Makefile:
>>
>> post-fetch:
>> 	${MKDIR} ${DISTDIR}/${PORTNAME}
>> 	${MKDIR} ${NPM_CACHE}
>> 	${CP} ${FILESDIR}/package-lock.json ${DISTDIR}/${PORTNAME}
>> 	${CP} ${FILESDIR}/package.json ${DISTDIR}/${PORTNAME}
>> 	(cd ${DISTDIR}/${PORTNAME} && ${SETENV} NPM_CONFIG_CACHE=${NPM_CACHE} npm install --ignore-scripts)
>>
>> ( complete port:  
>> https://github.com/saper/ports-exp/tree/master/textproc/node-sass )
>>
>> The results are those:
> ( this was wrong, the full log is also corrected )
>
> ===>   Returning to build of node-sass-4.7.2
> ===========================================================================
> =======================<phase: fetch          >============================
> ===>  License MIT accepted by the user
> ===> Fetching all distfiles required by node-sass-4.7.2 for building
> /bin/mkdir -p /portdistfiles/node-sass
> /bin/mkdir -p /portdistfiles/npm
> /bin/cp /usr/ports/textproc/node-sass/files/package-lock.json  
> /portdistfiles/node-sass
> /bin/cp /usr/ports/textproc/node-sass/files/package.json  
> /portdistfiles/node-sass
> (cd /portdistfiles/node-sass && /usr/bin/env  
> NPM_CONFIG_CACHE=/portdistfiles/npm npm install --ignore-scripts)
> npm WARN lifecycle node-sass at 4.7.2~install: cannot run in wd %s %s  
> (wd=%s) node-sass at 4.7.2 node scripts/install.js /portdistfiles/node-sass
> npm WARN lifecycle node-sass at 4.7.2~postinstall: cannot run in wd %s %s  
> (wd=%s) node-sass at 4.7.2 node scripts/build.js /portdistfiles/node-sass
> npm WARN prepublish-on-install As of npm at 5, `prepublish` scripts are  
> deprecated.
> npm WARN prepublish-on-install Use `prepare` for build steps and  
> `prepublishOnly` for upload-only.
> npm WARN prepublish-on-install See the deprecation note in `npm help  
> scripts` for more information.
> npm WARN lifecycle node-sass at 4.7.2~prepublish: cannot run in wd %s %s  
> (wd=%s) node-sass at 4.7.2 not-in-install && node scripts/prepublish.js ||  
> in-install /portdistfiles/node-sass
> added 356 packages in 10.684s
> ===========================================================================
> =======================<phase: checksum       >============================
> ===>  License MIT accepted by the user
> ===> Fetching all distfiles required by node-sass-4.7.2 for building
> /bin/mkdir -p /portdistfiles/node-sass
> /bin/mkdir -p /portdistfiles/npm
> /bin/cp /usr/ports/textproc/node-sass/files/package-lock.json  
> /portdistfiles/node-sass
> /bin/cp /usr/ports/textproc/node-sass/files/package.json  
> /portdistfiles/node-sass
> (cd /portdistfiles/node-sass && /usr/bin/env  
> NPM_CONFIG_CACHE=/portdistfiles/npm npm install --ignore-scripts)
> npm WARN lifecycle node-sass at 4.7.2~install: cannot run in wd %s %s  
> (wd=%s) node-sass at 4.7.2 node scripts/install.js /portdistfiles/node-sass
> npm WARN lifecycle node-sass at 4.7.2~postinstall: cannot run in wd %s %s  
> (wd=%s) node-sass at 4.7.2 node scripts/build.js /portdistfiles/node-sass
> npm WARN prepublish-on-install As of npm at 5, `prepublish` scripts are  
> deprecated.
> npm WARN prepublish-on-install Use `prepare` for build steps and  
> `prepublishOnly` for upload-only.
> npm WARN prepublish-on-install See the deprecation note in `npm help  
> scripts` for more information.
> npm WARN lifecycle node-sass at 4.7.2~prepublish: cannot run in wd %s %s  
> (wd=%s) node-sass at 4.7.2 not-in-install && node scripts/prepublish.js ||  
> in-install /portdistfiles/node-sass
> npm WARN ajv-keywords at 1.5.1 requires a peer of ajv@>=4.10.0 but none is  
> installed. You must install peer dependencies yourself.
>
> up to date in 2.13s
> => SHA256 Checksum OK for sass-node-sass-v4.7.2_GH0.tar.gz.
> ===========================================================================
> =======================<phase: extract-depends>============================
> ===========================================================================
> =======================<phase: extract        >============================
> ===>  License MIT accepted by the user
> ===> Fetching all distfiles required by node-sass-4.7.2 for building
> /bin/mkdir -p /portdistfiles/node-sass
> /bin/mkdir -p /portdistfiles/npm
> /bin/cp /usr/ports/textproc/node-sass/files/package-lock.json  
> /portdistfiles/node-sass
> cp: /portdistfiles/node-sass/package-lock.json: Permission denied
> *** Error code 1
>
> Stop.
> make: stopped in /usr/ports/textproc/node-sass
> =>> Cleaning up wrkdir
> ===>  Cleaning for node-sass-4.7.2
> build of textproc/node-sass | node-sass-4.7.2 ended at Sun Feb 25  
> 02:33:55 UTC 2018
>
>
>> (full log:  
>> https://gist.github.com/saper/0be3f9b4e9eb819d3ec00f5273705517#file-node-sass-4-7-2-log  
>> )
>>
>> Why are /bin/mkdir -p and /bin/cp commands invoked again in the  
>> "extract" phase?
>>
>> FreeBSD 11.1-STABLE #10 r321629 running poudriere-3.2.4 (I have updated  
>> poudriere today)
>>
>> What's wrong? That part of port code didn't change for some time.
>>
>> Marcin

First of all, just so you know, npm module ports won't be added to the  
ports tree. I just wanted to be clear in case you were planning on  
submitting it. There were a couple threads about this a while back.

With that out of the way, you're hitting errors for two reasons here.

The first problem is that npm needs network access, and poudriere prevents  
ports from dialing out. You can work around this with the  
ALLOW_NETWORKING_PACKAGES variable in poudriere.conf.

The other problem you're hitting is that npm saves a cache, and for some  
reason you're trying to run it from /usr/ports/distfiles/node-sass. Ports  
themselves should never, ever have the ability to create files in  
/usr/ports/distfiles. If you run 'npm install' from ${WRKSRC}, then you can  
do:
	cd ${WRKSRC} && ${SETENV} HOME=/tmp npm install

You'll have to redefine HOME there because npm writes to $HOME/.npm, which  
causes a stage-fs violation.

# Adam


--
Adam Weinberger
adamw at adamw.org
http://www.adamw.org




More information about the freebsd-ports mailing list