]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
npm.bbclass: Fix file permissions before opening it for writing
authorZoltán Böszörményi <zboszor@gmail.com>
Fri, 13 May 2022 15:30:29 +0000 (17:30 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 15 May 2022 07:57:09 +0000 (08:57 +0100)
Some node module archives in npmjs.org contain wrong permissions.
I found a case with package.json in the archive being r-xr-xr-x
for which open(..., "w") fails. Modify the manifest file permissions
to add the write bit for the owner.

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/npm.bbclass

index ba50fcac203765fa3100f1d9db176d6a10fcd6f9..86ee0f665aad3253e6f6415a144d1a717425b1cc 100644 (file)
@@ -81,6 +81,7 @@ python npm_do_configure() {
     import json
     import re
     import shlex
+    import stat
     import tempfile
     from bb.fetch2.npm import NpmEnvironment
     from bb.fetch2.npm import npm_unpack
@@ -202,6 +203,7 @@ python npm_do_configure() {
         if has_shrinkwrap_file:
             _update_manifest("devDependencies")
 
+    os.chmod(cached_manifest_file, os.stat(cached_manifest_file).st_mode | stat.S_IWUSR)
     with open(cached_manifest_file, "w") as f:
         json.dump(cached_manifest, f, indent=2)