Skip to contentSkip to conversation

fetch2/npm: evaluate PATH before patching HOME

PATCH New Arno Baumfalk 1 participant 1 message May 24, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fetch2/npm: evaluate PATH before patching HOME

From 814de5df87fbd39c773177580639bb22862c11a6 Mon Sep 17 00:00:00 2001
From: Arno Baumfalk <[email protected]>
Date: Tue, 16 May 2023 17:18:26 +0200
Subject: [PATCH] fetch2/npm: evaluate PATH before patching HOME

When the user configures the TMPDIR variable in a way that it contains $HOME (in local.conf), the DataSmart (d) object's PATH variable will also contain $HOME.

As the NpmEnvironment patches HOME with a temporary directory, further evaluation of PATH will become invalid an the build breaks with an error (npm not found).

As countermeasure PATH is evaluated *before* patching HOME.

---
 bitbake/lib/bb/fetch2/npm.py | 1 +
 1 file changed, 1 insertion(+)
bitbake/lib/bb/fetch2/npm.py +1 -0
index 8a179a339a..e6d0598f5d 100644
@@ -103,6 +103,7 @@ class NpmEnvironment(object):
         """Run npm command in a controlled environment"""
         with tempfile.TemporaryDirectory() as tmpdir:
             d = bb.data.createCopy(self.d)
+            d.setVar("PATH", d.getVar("PATH"))  # PATH might contain $HOME - evaluate it before patching
             d.setVar("HOME", tmpdir)
 
             if not workdir:
Signature · 1 line
2.40.1