diff mbox series

bitbake-worker: Fix bug where umask 0 was not being applied to a task

Message ID PAWP192MB212823FC83A54439A12DB4BEC32D2@PAWP192MB2128.EURP192.PROD.OUTLOOK.COM
State Accepted, archived
Commit 19f9df6c750c592316a0fa18165b68636281fe3e
Headers show
Series bitbake-worker: Fix bug where umask 0 was not being applied to a task | expand

Commit Message

Sava Jakovljev March 18, 2024, 1:52 p.m. UTC
* In the current implementation, "umask" variable is initially set to
  None and overwritten with user-specified value. However, in the worker
  implementation, a faulty if clause would only check whether the
  variable contains a value that evaluates to True, and not whether
  the variable is defined, so the value of 0 would lead to umask not
  being changed.
  This bug makes it impossible to have a task set its umask to value 0,
  for any possible reason it may want to.
  Fix this bug by extending the condition checked in the worker
  implementation.

Signed-off-by: Sava Jakovljev <sjakovljev@outlook.com>
---
 bin/bitbake-worker | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/bin/bitbake-worker b/bin/bitbake-worker
index eba9c562..04d75701 100755
--- a/bin/bitbake-worker
+++ b/bin/bitbake-worker
@@ -241,7 +241,7 @@  def fork_off_task(cfg, data, databuilder, workerdata, extraconfigdata, runtask):
             newsi = os.open(os.devnull, os.O_RDWR)
             os.dup2(newsi, sys.stdin.fileno())
 
-            if umask:
+            if umask is not None:
                 os.umask(umask)
 
             try: