From 2f33f97069d31231ca8f0040ac783b28812d3a1f Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Tue, 15 Oct 2024 15:34:24 +0200 Subject: [PATCH] gcc: use `csgrep --file-glob` while processing SARIF ... to avoid exceeding maximum command line length Depends-on: https://github.com/csutils/csdiff/pull/212 --- py/plugins/gcc.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/py/plugins/gcc.py b/py/plugins/gcc.py index a23d8df..d6e2389 100644 --- a/py/plugins/gcc.py +++ b/py/plugins/gcc.py @@ -311,11 +311,10 @@ def create_gcc_results_dir_hook(_, mock): props.copy_out_files += [GCC_RESULTS_DIR] # process all captured SARIF files - # TODO: avoid exceeding maximum command line length def filter_hook(results): src = os.path.join(results.dbgdir_raw, GCC_RESULTS_DIR[1:]) dst = os.path.join(results.dbgdir_uni, "gcc-results.json") - cmd = f"cd {src} && {FILTER_CMD} *.sarif > {dst}" + cmd = f'{FILTER_CMD} --file-glob "{src}/*.sarif" > "{dst}"' return results.exec_cmd(cmd, shell=True) props.post_process_hooks += [filter_hook]