[iso] make iso sets wrong file permissions for npm files

Bug #1337343 reported by Aleksandra Fedorova
32
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Fix Released
Medium
Sergey Kulanov

Bug Description

(18:17:45) asyriy: I met an issue during "make iso" on v1.5.1 (fuel-main/master branch). During compiling some files in the folder .npm were created from root and I got the message "npm ERR! stack Error: EACCES, open '/home/asyriy/.npm/findup-sync/0.1.3/package/package.json'
(18:19:58) asyriy: The "chown -R asyriy ~/*" and "chgrp -R asyriy ~/*" commands fixed the problem. It looks like the some files created from root, but credentials didn't changed later ...
(18:20:12) asyriy: Should it be reported somewhere?

Tags: make-iso
Revision history for this message
Albert Syriy (asyriy) wrote :

The console output attached.

Changed in fuel:
importance: Undecided → Medium
assignee: nobody → Fuel Python Team (fuel-python)
milestone: none → 5.1
Revision history for this message
Aleksandra Fedorova (bookwar) wrote :

It seems we run npm command with sudo somewhere. And it creates cache with root permissions, but locally in the user ~/.npm folder.

Revision history for this message
Vitaly Kramskikh (vkramskikh) wrote :

According to https://github.com/stackforge/fuel-web/blob/master/docs/develop/nailgun/development/env.rst#setup-for-web-ui-tests , we run

sudo npm install -g grunt-cli

But it has to be run with sudo to install grunt globally

Revision history for this message
Aleksandra Fedorova (bookwar) wrote :

I've just tried 'sudo npm install -g grunt-cli' with npm-1.3.10 on a clean machine, and the ~/.npm folder it creates has proper user ownership. No root-owned files there.

Dima Shulyak (dshulyak)
Changed in fuel:
status: New → Incomplete
Dmitry Ilyin (idv1985)
summary: - make iso sets wrong file permissions for npm files
+ [iso] make iso sets wrong file permissions for npm files
Revision history for this message
Sergey Kulanov (skulanov) wrote :

1) Clean system:
Distributor ID: Ubuntu
Description: Ubuntu 12.04.5 LTS
Release: 12.04
Codename: precise

2) vagrant@ubuntu-1204:~/fuel-main$ npm --version
1.4.21

Have the same issue after running ./prepare-build-env.sh

vagrant@ubuntu-1204:~$ ls -la ~/.npm
total 56
drwxr-xr-x 14 vagrant vagrant 4096 Aug 10 07:48 .
drwxr-xr-x 7 vagrant vagrant 4096 Aug 10 07:48 ..
drwxr-xr-x 3 root root 4096 Aug 10 07:48 abbrev
drwxr-xr-x 3 root root 4096 Aug 10 07:48 findup-sync
drwxr-xr-x 3 root root 4096 Aug 10 07:48 glob
drwxr-xr-x 3 root root 4096 Aug 10 07:47 grunt-cli
drwxr-xr-x 3 root root 4096 Aug 10 07:48 inherits
drwxr-xr-x 3 root root 4096 Aug 10 07:48 lodash
drwxr-xr-x 3 root root 4096 Aug 10 07:48 lru-cache
drwxr-xr-x 3 root root 4096 Aug 10 07:48 minimatch
drwxr-xr-x 3 root root 4096 Aug 10 07:48 nopt
drwxr-xr-x 13 vagrant vagrant 4096 Aug 10 07:48 registry.npmjs.org
drwxr-xr-x 3 root root 4096 Aug 10 07:48 resolve
drwxr-xr-x 3 root root 4096 Aug 10 07:48 sigmund

The issue appears after global installation of grunt:
3c32864f (Vitaly Parakhin 2014-06-11 12:00:42 +0300 68) sudo npm install -g grunt-cli

Here is my fix:

diff --git a/prepare-build-env.sh b/prepare-build-env.sh
index 2a37c78..3832673 100755
--- a/prepare-build-env.sh
+++ b/prepare-build-env.sh
@@ -66,6 +66,7 @@ sudo gem install bundler -v 1.2.1
 sudo gem install builder
 sudo pip install xmlbuilder jinja2
 sudo npm install -g grunt-cli
+sudo chown -R `whoami`.`id -gn` `npm config get cache`

This issue can be also fixed with:
 sudo -H npm install -g grunt-cli
in this case cache will be in /root/.npm (by default)

Dmitry Pyzhov (dpyzhov)
Changed in fuel:
status: Incomplete → Triaged
milestone: 5.1 → 6.0
Revision history for this message
Daniele Pizzolli (daniele-pizzolli) wrote :

Before seeing the proposed workaround by Sergey Kulanov I coded my own:

find $HOME/.npm -user root -print0 | xargs -0r sudo chown $USER:`id -gn`

Mine is quite rough. A merge can be:

sudo chown --recursive --from=root `id -un`:`id -gn` `npm config get cache`

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fuel-main (master)

Fix proposed to branch: master
Review: https://review.openstack.org/117212

Changed in fuel:
assignee: Fuel Python Team (fuel-python) → Sergey Kulanov (skulanov)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to fuel-main (master)

Reviewed: https://review.openstack.org/117212
Committed: https://git.openstack.org/cgit/stackforge/fuel-main/commit/?id=d5f87ec202bbd490273ea756c4ec2173d8580ef2
Submitter: Jenkins
Branch: master

commit d5f87ec202bbd490273ea756c4ec2173d8580ef2
Author: Sergey Kulanov <email address hidden>
Date: Wed Aug 27 14:30:27 2014 +0300

    Prepare build environment

    1. In case Ubuntu 14.04:
    - add devops repository and install multistrap version 2.1.6
    - Pin multistrap version 2.1.6
    2. In case Ubuntu 12.04:
    - add chris-lea (for nodejs) repository with higher priority
    - install nodejs from chris-lea repository
    3. For all distributions
    - fixed npm global installation permission issue
    - ensure bc package is present for make img target

    Closes-Bug: #1337343
    Closes-Bug: #1312654
    Change-Id: I62ba9257fb3d575d996bf4c57b5d983c0050fd3b

Changed in fuel:
status: In Progress → Fix Committed
Revision history for this message
Andrey Bubyr (abubyr) wrote :

Is it planned to backport fix in stable/5.1 branch? And why this fix isn't present in master branch on GitHub
(https://github.com/stackforge/fuel-main)?

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fuel-main (stable/5.1)

Fix proposed to branch: stable/5.1
Review: https://review.openstack.org/135902

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to fuel-main (stable/5.1)

Reviewed: https://review.openstack.org/135902
Committed: https://git.openstack.org/cgit/stackforge/fuel-main/commit/?id=4d04361e97c12fbd8fc829c2e7abaa3bd3bfecae
Submitter: Jenkins
Branch: stable/5.1

commit 4d04361e97c12fbd8fc829c2e7abaa3bd3bfecae
Author: Sergey Kulanov <email address hidden>
Date: Wed Aug 27 14:30:27 2014 +0300

    Prepare build environment

    1. In case Ubuntu 14.04:
    - add devops repository and install multistrap version 2.1.6
    - Pin multistrap version 2.1.6
    2. In case Ubuntu 12.04:
    - add chris-lea (for nodejs) repository with higher priority
    - install nodejs from chris-lea repository
    3. For all distributions
    - fixed npm global installation permission issue
    - ensure bc package is present for make img target

    Closes-Bug: #1337343
    Closes-Bug: #1312654
    Change-Id: I62ba9257fb3d575d996bf4c57b5d983c0050fd3b
    (cherry picked from commit d5f87ec202bbd490273ea756c4ec2173d8580ef2)

Changed in fuel:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.