From e05858d126b1f0b3e82bcd346a1bcd5bb3b9ffa3 Mon Sep 17 00:00:00 2001 From: jk464 Date: Fri, 24 Nov 2023 11:30:47 +0000 Subject: [PATCH] Only run chmod +x on writable file systems - fixes #5591 --- CHANGELOG.rst | 3 +++ contrib/runners/local_runner/local_runner/base.py | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 578d5fcb5e..4083d93cd7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -44,6 +44,9 @@ Fixed * Update importlib-metadata from 3.10.1 to 4.8.3 for py3.6 and to 4.10.1 for py3.8 (security). #6072 Contributed by @jk464 +* For "local-shell-script" runner, on readonly filesystems, don't attempt to run chmod +x on script_action. Fixes #5591 + Contributed by @jk464 + Added ~~~~~ * Move `git clone` to `user_home/.st2packs` #5845 diff --git a/contrib/runners/local_runner/local_runner/base.py b/contrib/runners/local_runner/local_runner/base.py index 4fda9c1866..436d7dbf6b 100644 --- a/contrib/runners/local_runner/local_runner/base.py +++ b/contrib/runners/local_runner/local_runner/base.py @@ -116,7 +116,10 @@ def _run(self, action): sanitized_args = action.get_sanitized_full_command_string() # For consistency with the old Fabric based runner, make sure the file is executable - if script_action: + # Also check to ensure not Read-only file system + if script_action and not bool( + os.statvfs(self.entry_point).f_flag & os.ST_RDONLY + ): script_local_path_abs = self.entry_point args = "chmod +x %s ; %s" % (script_local_path_abs, args) sanitized_args = "chmod +x %s ; %s" % (