From 23b83b25f228120cc9f97bd5fb682e5247e24c2c Mon Sep 17 00:00:00 2001 From: Guest Date: Fri, 1 Mar 2024 02:02:03 -0500 Subject: [PATCH 1/5] fix return value and conditional --- deps/pash | 2 +- parallel-orch/node.py | 23 +++++++++------- parallel-orch/partial_program_order.py | 2 +- parallel-orch/run_command.sh | 3 ++- parallel-orch/scheduler_server.py | 11 ++++---- parallel-orch/template_script_to_execute.sh | 7 ++--- parallel-orch/trace_v2.py | 29 +++++++++++++++++++++ 7 files changed, 56 insertions(+), 21 deletions(-) diff --git a/deps/pash b/deps/pash index 254205eb..d60c543f 160000 --- a/deps/pash +++ b/deps/pash @@ -1 +1 @@ -Subproject commit 254205eb603f3d4daf76514943bc4e6ffc22d01d +Subproject commit d60c543fcc5c74c8addcb8085312cb3910ad8c45 diff --git a/parallel-orch/node.py b/parallel-orch/node.py index f546833a..50192f2d 100644 --- a/parallel-orch/node.py +++ b/parallel-orch/node.py @@ -296,7 +296,7 @@ def try_reset_to_ready(self): return else: self.reset_to_ready() - + def reset_to_ready(self): assert self.state in [NodeState.EXECUTING, NodeState.SPEC_EXECUTING, NodeState.SPECULATED] @@ -333,18 +333,19 @@ def start_spec_executing(self, env_file): def commit_frontier_execution(self): assert self.state == NodeState.EXECUTING - self.exec_result = ExecResult(self.exec_ctxt.process.pid, self.exec_ctxt.process.returncode) - self.gather_fs_actions() + exit_code = self.gather_traced_info() + self.exec_result = ExecResult(exit_code, self.exec_ctxt.process.pid) + util.debug_log(f'exit_code {self.exec_result.exit_code}') executor.commit_workspace(self.exec_ctxt.sandbox_dir) self.state = NodeState.COMMITTED def finish_spec_execution(self): assert self.state == NodeState.SPEC_EXECUTING - self.exec_result = ExecResult(self.exec_ctxt.process.pid, self.exec_ctxt.process.returncode) - self.gather_fs_actions() + exit_code = self.gather_traced_info() + self.exec_result = ExecResult(exit_code, self.exec_ctxt.process.pid) + util.debug_log(f'exit_code {self.exec_result.exit_code}') self.state = NodeState.SPECULATED - def commit_speculated(self): assert self.state == NodeState.SPECULATED executor.commit_workspace(self.exec_ctxt.sandbox_dir) @@ -370,7 +371,7 @@ def commit_unsafe_node(self): def update_rw_set(self, rw_set): self.rwset = rw_set - def gather_fs_actions(self) -> RWSet: + def gather_traced_info(self) -> int: assert self.state in [NodeState.EXECUTING, NodeState.SPEC_EXECUTING] sandbox_dir = self.exec_ctxt.sandbox_dir trace_file = self.exec_ctxt.trace_file @@ -379,9 +380,11 @@ def gather_fs_actions(self) -> RWSet: except FileNotFoundError: self.update_rw_set(RWSet(set(), set())) return - read_set, write_set = trace_v2.parse_and_gather_cmd_rw_sets(trace_object) + read_set, write_set, exit_code = trace_v2.parse_trace_info(trace_object) rw_set = RWSet(read_set, write_set) self.update_rw_set(rw_set) + return exit_code + def get_rw_set(self): # if self.state in [NodeState.EXECUTING, NodeState.SPEC_EXECUTING]: @@ -406,7 +409,7 @@ def has_env_conflict_with(self, other_env) -> bool: "TRY_COMMAND", "SRANDOM", "speculate_flag", "EXECUTION_ID", "EPOCHREALTIME", "OLDPWD" ]) - + re_scalar_string = re.compile(r'declare (?:-x|--)? (\w+)="([^"]*)"') re_scalar_int = re.compile(r'declare -i (\w+)="(\d+)"') @@ -432,7 +435,7 @@ def parse_env(content): other_env_vars = parse_env(file.read()) logging.debug(f"Comparing env files {self.exec_ctxt.pre_env_file} and {other_env}") - + conflict_exists = False for key in set(node_env_vars.keys()).union(other_env_vars.keys()): if key not in node_env_vars: diff --git a/parallel-orch/partial_program_order.py b/parallel-orch/partial_program_order.py index 61849246..39ac7ce5 100644 --- a/parallel-orch/partial_program_order.py +++ b/parallel-orch/partial_program_order.py @@ -218,7 +218,7 @@ def valid(self): def fetch_fs_actions(self): for node in self.get_executing_normal_and_spec_nodes(): - node.gather_fs_actions() + node.gather_traced_info() def _has_fs_deps(self, concrete_node_id: ConcreteNodeId): node_of_interest : ConcreteNode = self.get_concrete_node(concrete_node_id) diff --git a/parallel-orch/run_command.sh b/parallel-orch/run_command.sh index 9fe48f26..6c9073e8 100755 --- a/parallel-orch/run_command.sh +++ b/parallel-orch/run_command.sh @@ -42,5 +42,6 @@ out=`head -3 $SANDBOX_DIR/upperdir/$TRACE_FILE` ## Assumes "${PASH_SPEC_SCHEDULER_SOCKET}" is set and exported ## Pass the proper exit code -msg="CommandExecComplete:${CMD_ID}|Exec id:${EXECUTION_ID}|Exit code:${exit_code}|Sandbox dir:${SANDBOX_DIR}|Trace file:${TRACE_FILE}|Tempdir:${TEMPDIR}" +msg="CommandExecComplete:${CMD_ID}|Exec id:${EXECUTION_ID}|Sandbox dir:${SANDBOX_DIR}|Trace file:${TRACE_FILE}|Tempdir:${TEMPDIR}" daemon_response=$(pash_spec_communicate_scheduler_just_send "$msg") # Blocking step, daemon will not send response until it's safe to continue +exit $exit_code diff --git a/parallel-orch/scheduler_server.py b/parallel-orch/scheduler_server.py index 4a8ef5a5..76ea120b 100644 --- a/parallel-orch/scheduler_server.py +++ b/parallel-orch/scheduler_server.py @@ -106,7 +106,8 @@ def process_next_cmd(self): logging.info(f'Scheduler: Received daemon start message.') connection.close() elif (input_cmd.startswith("CommandExecComplete:")): - node_id, exec_id, exit_code, sandbox_dir, trace_file = self.__parse_command_exec_x(input_cmd) + node_id, exec_id, sandbox_dir, trace_file = self.__parse_command_exec_x(input_cmd) + connection.close() if self.partial_program_order.get_concrete_node(node_id).exec_id == exec_id: logging.info(f'Scheduler: Received command exec complete message - {node_id}.') self.partial_program_order.handle_complete(node_id, node_id in self.waiting_for_response, self.latest_env) @@ -141,6 +142,7 @@ def respond_to_pending_wait(self, node_id: ConcreteNodeId): ## Get the completed node info node = self.partial_program_order.get_concrete_node(node_id) msg = '{} {} {}'.format(*node.execution_outcome()) + util.debug_log(f'outcome for node {node_id} is {node.execution_outcome()}') response = success_response(msg) ## Send the response @@ -165,10 +167,9 @@ def __parse_command_exec_x(self, input_cmd: str) -> "tuple[int, int]": components = input_cmd.rstrip().split("|") command_id = ConcreteNodeId.parse(components[0].split(":")[1]) exec_id = int(components[1].split(":")[1]) - exit_code = int(components[2].split(":")[1]) - sandbox_dir = components[3].split(":")[1] - trace_file = components[4].split(":")[1] - return command_id, exec_id, exit_code, sandbox_dir, trace_file + sandbox_dir = components[2].split(":")[1] + trace_file = components[3].split(":")[1] + return command_id, exec_id, sandbox_dir, trace_file except: raise Exception(f'Parsing failure for line: {input_cmd}') diff --git a/parallel-orch/template_script_to_execute.sh b/parallel-orch/template_script_to_execute.sh index cd0496cc..7724c502 100755 --- a/parallel-orch/template_script_to_execute.sh +++ b/parallel-orch/template_script_to_execute.sh @@ -1,6 +1,7 @@ #!/bin/bash -strace -y -f --seccomp-bpf --trace=fork,clone,%file -o $TRACE_FILE bash -c "source $LATEST_ENV_FILE; $CMD_STRING; source $RUNTIME_DIR/pash_declare_vars.sh $POST_EXEC_ENV" -exit_code=$? +export LATEST_ENV_FILE +export POST_EXEC_ENV +export CMD_STRING +strace -y -f --seccomp-bpf --trace=fork,clone,%file -o $TRACE_FILE bash -c 'source $LATEST_ENV_FILE; $CMD_STRING; exit_code=$?; source $RUNTIME_DIR/pash_declare_vars.sh $POST_EXEC_ENV; exit $exit_code' -(exit $exit_code) diff --git a/parallel-orch/trace_v2.py b/parallel-orch/trace_v2.py index 68719df2..786a010c 100644 --- a/parallel-orch/trace_v2.py +++ b/parallel-orch/trace_v2.py @@ -337,6 +337,35 @@ def parse_and_gather_cmd_rw_sets(trace_object) -> Tuple[set, set]: write_set.add(record.fname) return read_set, write_set +def parse_trace_info(trace_object): + if len(trace_object) == 0 or trace_object[0] == '': + exit_code = None + ctx = Context() + ctx.set_dir(os.getcwd()) + read_set = set() + write_set = set() + l = trace_object[0] + first_pid, _ = strip_pid(l) + for l in trace_object: + pid, tmpl = strip_pid(l) + is_info, info = handle_info(tmpl) + if is_info and pid == first_pid and isinstance(info, ExitStatus): + exit_code = info.exitcode + continue + try: + records = parse_line(l, ctx) + except Exception: + logging.debug(l) + raise ValueError("error while parsing trace") + if not isinstance(records, list): + records = [records] + for record in records: + if type(record) is RFile and record.fname != '/dev/tty': + read_set.add(record.fname) + elif type(record) is WFile and record.fname != '/dev/tty': + write_set.add(record.fname) + return read_set, write_set, exit_code + def main(fname): ctx = Context() ctx.set_dir(os.getcwd()) From e3701fbd6369e0449b36d3e77fda9f5ff7c5b474 Mon Sep 17 00:00:00 2001 From: Guest Date: Fri, 1 Mar 2024 02:59:23 -0500 Subject: [PATCH 2/5] fix various errors in return value passing to fix conditional --- parallel-orch/analysis.py | 3 ++- parallel-orch/node.py | 25 +++++++++--------- parallel-orch/partial_program_order.py | 2 +- parallel-orch/run_command.sh | 2 +- parallel-orch/template_script_to_execute.sh | 4 ++- parallel-orch/trace_v2.py | 29 --------------------- test/test_orch.sh | 7 +++++ test/test_scripts/test_if.sh | 15 +++++++++++ 8 files changed, 41 insertions(+), 46 deletions(-) create mode 100644 test/test_scripts/test_if.sh diff --git a/parallel-orch/analysis.py b/parallel-orch/analysis.py index 3620d28e..f337ba30 100644 --- a/parallel-orch/analysis.py +++ b/parallel-orch/analysis.py @@ -92,7 +92,8 @@ def safe_to_execute(asts: "list[AstNode]", variables: dict) -> bool: BASH_PRIMITIVES = ["break", "continue", - "return"] + "return", + "export"] safe_cases = { diff --git a/parallel-orch/node.py b/parallel-orch/node.py index 50192f2d..d31e3489 100644 --- a/parallel-orch/node.py +++ b/parallel-orch/node.py @@ -296,7 +296,7 @@ def try_reset_to_ready(self): return else: self.reset_to_ready() - + def reset_to_ready(self): assert self.state in [NodeState.EXECUTING, NodeState.SPEC_EXECUTING, NodeState.SPECULATED] @@ -333,19 +333,20 @@ def start_spec_executing(self, env_file): def commit_frontier_execution(self): assert self.state == NodeState.EXECUTING - exit_code = self.gather_traced_info() - self.exec_result = ExecResult(exit_code, self.exec_ctxt.process.pid) - util.debug_log(f'exit_code {self.exec_result.exit_code}') + self.exec_ctxt.process.wait() + self.exec_result = ExecResult(self.exec_ctxt.process.returncode, self.exec_ctxt.process.pid) + self.gather_fs_actions() executor.commit_workspace(self.exec_ctxt.sandbox_dir) self.state = NodeState.COMMITTED def finish_spec_execution(self): assert self.state == NodeState.SPEC_EXECUTING - exit_code = self.gather_traced_info() - self.exec_result = ExecResult(exit_code, self.exec_ctxt.process.pid) - util.debug_log(f'exit_code {self.exec_result.exit_code}') + self.exec_ctxt.process.wait() + self.exec_result = ExecResult(self.exec_ctxt.process.returncode, self.exec_ctxt.process.pid) + self.gather_fs_actions() self.state = NodeState.SPECULATED + def commit_speculated(self): assert self.state == NodeState.SPECULATED executor.commit_workspace(self.exec_ctxt.sandbox_dir) @@ -371,7 +372,7 @@ def commit_unsafe_node(self): def update_rw_set(self, rw_set): self.rwset = rw_set - def gather_traced_info(self) -> int: + def gather_fs_actions(self) -> RWSet: assert self.state in [NodeState.EXECUTING, NodeState.SPEC_EXECUTING] sandbox_dir = self.exec_ctxt.sandbox_dir trace_file = self.exec_ctxt.trace_file @@ -380,11 +381,9 @@ def gather_traced_info(self) -> int: except FileNotFoundError: self.update_rw_set(RWSet(set(), set())) return - read_set, write_set, exit_code = trace_v2.parse_trace_info(trace_object) + read_set, write_set = trace_v2.parse_and_gather_cmd_rw_sets(trace_object) rw_set = RWSet(read_set, write_set) self.update_rw_set(rw_set) - return exit_code - def get_rw_set(self): # if self.state in [NodeState.EXECUTING, NodeState.SPEC_EXECUTING]: @@ -409,7 +408,7 @@ def has_env_conflict_with(self, other_env) -> bool: "TRY_COMMAND", "SRANDOM", "speculate_flag", "EXECUTION_ID", "EPOCHREALTIME", "OLDPWD" ]) - + re_scalar_string = re.compile(r'declare (?:-x|--)? (\w+)="([^"]*)"') re_scalar_int = re.compile(r'declare -i (\w+)="(\d+)"') @@ -435,7 +434,7 @@ def parse_env(content): other_env_vars = parse_env(file.read()) logging.debug(f"Comparing env files {self.exec_ctxt.pre_env_file} and {other_env}") - + conflict_exists = False for key in set(node_env_vars.keys()).union(other_env_vars.keys()): if key not in node_env_vars: diff --git a/parallel-orch/partial_program_order.py b/parallel-orch/partial_program_order.py index 39ac7ce5..61849246 100644 --- a/parallel-orch/partial_program_order.py +++ b/parallel-orch/partial_program_order.py @@ -218,7 +218,7 @@ def valid(self): def fetch_fs_actions(self): for node in self.get_executing_normal_and_spec_nodes(): - node.gather_traced_info() + node.gather_fs_actions() def _has_fs_deps(self, concrete_node_id: ConcreteNodeId): node_of_interest : ConcreteNode = self.get_concrete_node(concrete_node_id) diff --git a/parallel-orch/run_command.sh b/parallel-orch/run_command.sh index 6c9073e8..470ae257 100755 --- a/parallel-orch/run_command.sh +++ b/parallel-orch/run_command.sh @@ -44,4 +44,4 @@ out=`head -3 $SANDBOX_DIR/upperdir/$TRACE_FILE` ## Pass the proper exit code msg="CommandExecComplete:${CMD_ID}|Exec id:${EXECUTION_ID}|Sandbox dir:${SANDBOX_DIR}|Trace file:${TRACE_FILE}|Tempdir:${TEMPDIR}" daemon_response=$(pash_spec_communicate_scheduler_just_send "$msg") # Blocking step, daemon will not send response until it's safe to continue -exit $exit_code +(exit $exit_code) diff --git a/parallel-orch/template_script_to_execute.sh b/parallel-orch/template_script_to_execute.sh index 7724c502..c65a7b97 100755 --- a/parallel-orch/template_script_to_execute.sh +++ b/parallel-orch/template_script_to_execute.sh @@ -3,5 +3,7 @@ export LATEST_ENV_FILE export POST_EXEC_ENV export CMD_STRING -strace -y -f --seccomp-bpf --trace=fork,clone,%file -o $TRACE_FILE bash -c 'source $LATEST_ENV_FILE; $CMD_STRING; exit_code=$?; source $RUNTIME_DIR/pash_declare_vars.sh $POST_EXEC_ENV; exit $exit_code' + +RUN=$(printf 'source $LATEST_ENV_FILE; %s; exit_code=$?; source $RUNTIME_DIR/pash_declare_vars.sh $POST_EXEC_ENV; exit $exit_code' "${CMD_STRING}") +strace -y -f --seccomp-bpf --trace=fork,clone,%file -o $TRACE_FILE bash -c "$RUN" diff --git a/parallel-orch/trace_v2.py b/parallel-orch/trace_v2.py index 786a010c..68719df2 100644 --- a/parallel-orch/trace_v2.py +++ b/parallel-orch/trace_v2.py @@ -337,35 +337,6 @@ def parse_and_gather_cmd_rw_sets(trace_object) -> Tuple[set, set]: write_set.add(record.fname) return read_set, write_set -def parse_trace_info(trace_object): - if len(trace_object) == 0 or trace_object[0] == '': - exit_code = None - ctx = Context() - ctx.set_dir(os.getcwd()) - read_set = set() - write_set = set() - l = trace_object[0] - first_pid, _ = strip_pid(l) - for l in trace_object: - pid, tmpl = strip_pid(l) - is_info, info = handle_info(tmpl) - if is_info and pid == first_pid and isinstance(info, ExitStatus): - exit_code = info.exitcode - continue - try: - records = parse_line(l, ctx) - except Exception: - logging.debug(l) - raise ValueError("error while parsing trace") - if not isinstance(records, list): - records = [records] - for record in records: - if type(record) is RFile and record.fname != '/dev/tty': - read_set.add(record.fname) - elif type(record) is WFile and record.fname != '/dev/tty': - write_set.add(record.fname) - return read_set, write_set, exit_code - def main(fname): ctx = Context() ctx.set_dir(os.getcwd()) diff --git a/test/test_orch.sh b/test/test_orch.sh index 572b4057..5956fac5 100755 --- a/test/test_orch.sh +++ b/test/test_orch.sh @@ -309,6 +309,12 @@ test_stdout() $shell $2/test_stdout.sh } +test_if() +{ + local shell=$1 + $shell $2/test_if.sh +} + test_loop() { local shell=$1 @@ -417,6 +423,7 @@ if [ "$#" -eq 0 ]; then run_test test9_2 # "1 1 1 1 1 1 1 1 1 1 1 1 1" # 13 run_test test9_3 # "1 1 1 1 1 1 1 1 2 2 1 1 1" # 15 run_test test_stdout #"1 1 1 1 1 1" # 6 + run_test test_if run_test test_loop run_test test_break run_test test_network_access_1 #"1 2 2" diff --git a/test/test_scripts/test_if.sh b/test/test_scripts/test_if.sh new file mode 100644 index 00000000..ba0d7d88 --- /dev/null +++ b/test/test_scripts/test_if.sh @@ -0,0 +1,15 @@ +a=hello +if [ -z $a ]; then + echo haha +else + echo hoho +fi + +b= +if [ -z $b ]; then + echo haha +else + echo hoho +fi + + From 49907c1bb39e6f298e20ee5293680e1aac5c4b5e Mon Sep 17 00:00:00 2001 From: Guest Date: Fri, 1 Mar 2024 20:29:56 -0500 Subject: [PATCH 3/5] fix dir level read write tracing --- deps/pash | 2 +- parallel-orch/analysis.py | 2 +- parallel-orch/node.py | 2 +- parallel-orch/run_command.sh | 1 - parallel-orch/template_script_to_execute.sh | 9 ++--- parallel-orch/trace_v2.py | 37 ++++++++++++++++++++- 6 files changed, 42 insertions(+), 11 deletions(-) diff --git a/deps/pash b/deps/pash index d60c543f..fbaa96c1 160000 --- a/deps/pash +++ b/deps/pash @@ -1 +1 @@ -Subproject commit d60c543fcc5c74c8addcb8085312cb3910ad8c45 +Subproject commit fbaa96c1e716c1ff629087515938c4effe8b45b2 diff --git a/parallel-orch/analysis.py b/parallel-orch/analysis.py index f337ba30..a01746d6 100644 --- a/parallel-orch/analysis.py +++ b/parallel-orch/analysis.py @@ -93,7 +93,7 @@ def safe_to_execute(asts: "list[AstNode]", variables: dict) -> bool: BASH_PRIMITIVES = ["break", "continue", "return", - "export"] + "exit"] safe_cases = { diff --git a/parallel-orch/node.py b/parallel-orch/node.py index d31e3489..725b6286 100644 --- a/parallel-orch/node.py +++ b/parallel-orch/node.py @@ -406,7 +406,7 @@ def has_env_conflict_with(self, other_env) -> bool: "CMD_ID", "STDOUT_FILE", "DIRSTACK", "SECONDS", "TMPDIR", "UPDATED_DIRS_AND_MOUNTS", "EPOCHSECONDS", "LATEST_ENV_FILE", "TRY_COMMAND", "SRANDOM", "speculate_flag", "EXECUTION_ID", - "EPOCHREALTIME", "OLDPWD" + "EPOCHREALTIME", "OLDPWD", "exit_code", ]) diff --git a/parallel-orch/run_command.sh b/parallel-orch/run_command.sh index 470ae257..8e516b96 100755 --- a/parallel-orch/run_command.sh +++ b/parallel-orch/run_command.sh @@ -34,7 +34,6 @@ fi bash "${PASH_SPEC_TOP}/deps/try/try" -D "${SANDBOX_DIR}" "${PASH_SPEC_TOP}/parallel-orch/template_script_to_execute.sh" > "${STDOUT_FILE}" exit_code=$? - ## Only used for debugging # ls -R "${SANDBOX_DIR}/upperdir" 1>&2 out=`head -3 $SANDBOX_DIR/upperdir/$TRACE_FILE` diff --git a/parallel-orch/template_script_to_execute.sh b/parallel-orch/template_script_to_execute.sh index c65a7b97..11f4e2a0 100755 --- a/parallel-orch/template_script_to_execute.sh +++ b/parallel-orch/template_script_to_execute.sh @@ -1,9 +1,6 @@ #!/bin/bash -export LATEST_ENV_FILE -export POST_EXEC_ENV -export CMD_STRING - -RUN=$(printf 'source $LATEST_ENV_FILE; %s; exit_code=$?; source $RUNTIME_DIR/pash_declare_vars.sh $POST_EXEC_ENV; exit $exit_code' "${CMD_STRING}") -strace -y -f --seccomp-bpf --trace=fork,clone,%file -o $TRACE_FILE bash -c "$RUN" +# Magic, don't touch without consulting Di +RUN=$(printf 'source %s; %s; exit_code=$?; source $RUNTIME_DIR/pash_declare_vars.sh %s; exit $exit_code' "${LATEST_ENV_FILE}" "${CMD_STRING}" "${POST_EXEC_ENV}") +strace -y -f --seccomp-bpf --trace=fork,clone,%file -o $TRACE_FILE env -i bash -c "$RUN" diff --git a/parallel-orch/trace_v2.py b/parallel-orch/trace_v2.py index 68719df2..87fd7eab 100644 --- a/parallel-orch/trace_v2.py +++ b/parallel-orch/trace_v2.py @@ -2,6 +2,7 @@ import logging import os.path import sys +import util from typing import Tuple from dataclasses import dataclass @@ -44,12 +45,42 @@ class RFile: def __init__(self, fname): self.fname = os.path.normpath(fname) + def closure(self): + all_files = [self] + if not self.fname.startswith('/'): + return all_files + current_name = self.fname + i = 0 + while current_name != '/': + dir, _ = os.path.split(current_name) + all_files.append(RFile(dir)) + current_name = dir + i += 1 + if i > 15: + util.debug_log(f"{self.fname}") + return all_files + @dataclass class WFile: fname: str def __init__(self, fname): self.fname = os.path.normpath(fname) + def closure(self): + all_files = [self] + current_name = self.fname + if not self.fname.startswith('/'): + return all_files + i = 0 + while current_name != '/': + dir, _ = os.path.split(current_name) + all_files.append(RFile(dir)) + current_name = dir + i += 1 + if i > 15: + util.debug_log(f"{current_name}") + return all_files + class Context: def __init__(self): self.line_dict = {} @@ -235,6 +266,7 @@ def parse_clone(pid, args, ret, ctx): flags = flags[len('flags='):] if has_clone_fs(flags): ctx.do_clone(pid, child) + return [] def parse_symlinkat(pid, args, ret): a0, rest = args.split(sep=',', maxsplit=1) @@ -328,9 +360,12 @@ def parse_and_gather_cmd_rw_sets(trace_object) -> Tuple[set, set]: except Exception: logging.debug(l) raise ValueError("error while parsing trace") + if records is None or isinstance(records, ExitStatus): + continue if not isinstance(records, list): records = [records] - for record in records: + all_records = [r for record in records for r in record.closure()] + for record in all_records: if type(record) is RFile and record.fname != '/dev/tty': read_set.add(record.fname) elif type(record) is WFile and record.fname != '/dev/tty': From 7a42224183cf7c8c5f6060e89f245cc76aff1fff Mon Sep 17 00:00:00 2001 From: Guest Date: Mon, 4 Mar 2024 20:12:41 -0500 Subject: [PATCH 4/5] fix a bug causing env not passed correctly exclusively in non-debug mode. added test case but we need to let test cases run without debug mode in the future --- deps/pash | 2 +- test/misc/source_foo_equal.sh | 1 + test/test_orch.sh | 6 ++++++ test/test_scripts/test_local_vars_4.sh | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 test/misc/source_foo_equal.sh create mode 100644 test/test_scripts/test_local_vars_4.sh diff --git a/deps/pash b/deps/pash index fbaa96c1..cb63f817 160000 --- a/deps/pash +++ b/deps/pash @@ -1 +1 @@ -Subproject commit fbaa96c1e716c1ff629087515938c4effe8b45b2 +Subproject commit cb63f817d49918886aab67e72c354af62560e695 diff --git a/test/misc/source_foo_equal.sh b/test/misc/source_foo_equal.sh new file mode 100644 index 00000000..a84a6b0d --- /dev/null +++ b/test/misc/source_foo_equal.sh @@ -0,0 +1 @@ +foo=$1 diff --git a/test/test_orch.sh b/test/test_orch.sh index 5956fac5..2f86345f 100755 --- a/test/test_orch.sh +++ b/test/test_orch.sh @@ -366,6 +366,12 @@ test_local_vars_3() $shell $2/test_local_vars_3.sh } +test_local_vars_4() +{ + local shell=$1 + $shell $2/test_local_vars_4.sh +} + test_command_var_assignments_1(){ local shell=$1 $shell $2/test_command_var_assignments_1.sh diff --git a/test/test_scripts/test_local_vars_4.sh b/test/test_scripts/test_local_vars_4.sh new file mode 100644 index 00000000..ae2f2a87 --- /dev/null +++ b/test/test_scripts/test_local_vars_4.sh @@ -0,0 +1,2 @@ +source "$MISC_SCRIPT_DIR/source_foo_equal.sh" bar +echo $foo From 80bd2688537aa775a4fc44574196f27853dd0e41 Mon Sep 17 00:00:00 2001 From: Guest Date: Wed, 6 Mar 2024 11:45:14 -0500 Subject: [PATCH 5/5] update try for symlink handling --- deps/try | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/try b/deps/try index ba6a9061..588fc456 160000 --- a/deps/try +++ b/deps/try @@ -1 +1 @@ -Subproject commit ba6a90615944203a95d5a86638447da34e539d1b +Subproject commit 588fc456d2aa11240cd9a7518bd8e1c219431f0d