diff options
author | Zoltán Böszörményi <zboszor@gmail.com> | 2022-05-13 17:30:29 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-05-15 08:57:15 +0100 |
commit | 1d0fc713e8a583ee5c542f6188ad30d823359b41 (patch) | |
tree | 93cf2168f4d8a440bd85292eb6268fe8e93afb3a /meta/classes | |
parent | 72aa79f61ff94a3a246df61cc68df4dcfca3b565 (diff) | |
download | poky-1d0fc713e8a583ee5c542f6188ad30d823359b41.tar.gz |
npm.bbclass: Fix file permissions before opening it for writing
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.
(From OE-Core rev: c6740091cb7336aaa3bb9b692fe4dc6fc92aa3a8)
Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/npm.bbclass | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass index ba50fcac20..86ee0f665a 100644 --- a/meta/classes/npm.bbclass +++ b/meta/classes/npm.bbclass | |||
@@ -81,6 +81,7 @@ python npm_do_configure() { | |||
81 | import json | 81 | import json |
82 | import re | 82 | import re |
83 | import shlex | 83 | import shlex |
84 | import stat | ||
84 | import tempfile | 85 | import tempfile |
85 | from bb.fetch2.npm import NpmEnvironment | 86 | from bb.fetch2.npm import NpmEnvironment |
86 | from bb.fetch2.npm import npm_unpack | 87 | from bb.fetch2.npm import npm_unpack |
@@ -202,6 +203,7 @@ python npm_do_configure() { | |||
202 | if has_shrinkwrap_file: | 203 | if has_shrinkwrap_file: |
203 | _update_manifest("devDependencies") | 204 | _update_manifest("devDependencies") |
204 | 205 | ||
206 | os.chmod(cached_manifest_file, os.stat(cached_manifest_file).st_mode | stat.S_IWUSR) | ||
205 | with open(cached_manifest_file, "w") as f: | 207 | with open(cached_manifest_file, "w") as f: |
206 | json.dump(cached_manifest, f, indent=2) | 208 | json.dump(cached_manifest, f, indent=2) |
207 | 209 | ||