stdlib: Fixing resources.json caching for multi-user envs
The downloader briefly caches the resources.json file in "/tmp". This works fine if the system only has one user, but in a system supporting many users, where "/tmp" is shared, there were permission issues when a user tried to access a resources.json cache from another user. To resolve this the uid of the user is appended to the filename. Change-Id: Iba8ab12cd7054c2f5636e444ac0f1f8f73fedc89 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/58489 Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Bobby Bruce
parent
8a91e933e8
commit
c296940103
@@ -80,7 +80,8 @@ def _get_resources_json_at_url(url: str, use_caching: bool = True) -> Dict:
|
||||
|
||||
file_path = os.path.join(
|
||||
gettempdir(),
|
||||
f"gem5-resources-{hashlib.md5(url.encode()).hexdigest()}.base64",
|
||||
f"gem5-resources-{hashlib.md5(url.encode()).hexdigest()}"
|
||||
f"-{str(os.getuid())}.base64",
|
||||
)
|
||||
|
||||
# We apply a lock on the resources file for when it's downloaded, or
|
||||
|
||||
Reference in New Issue
Block a user