[PATCH] dtrace: Use deterministic temp file creation for all temp files

Florian Weimer fweimer@redhat.com
Mon Feb 27 17:34:57 GMT 2023


* Gioele Barabucci:

> @@ -380,6 +373,7 @@ def main():
>          usage()
>          return 1
>  
> +    TEMP_DIR = mkdtemp()
>      if s_filename != "" and use_cpp:
>          (ignore, fname) = mktemp_determ(["use_cpp", s_filename], suffix=".d")
>          cpp = os.environ.get("CPP", "cpp")
> @@ -458,6 +452,9 @@ def main():
>          else:
>              print("cpp: " + s_filename)
>  
> +    if not keep_temps:
> +        os.rmdir(TEMP_DIR)

This should probably use try:/finally: or a context manager
with tempfile.TemporaryDirectory.

Thanks,
Florian



More information about the Systemtap mailing list