From 575f60542bfd238e2ac180cb3d7dc9101c2cd54a Mon Sep 17 00:00:00 2001 From: Oliver Layer Date: Wed, 13 Dec 2023 16:13:12 +0100 Subject: [PATCH 1/2] fix: whitespace in include arguments not handled properly for excluded dependency paths --- homcc/common/arguments.py | 4 +++- tests/server/environment_test.py | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/homcc/common/arguments.py b/homcc/common/arguments.py index 56cf479..0cb2af1 100644 --- a/homcc/common/arguments.py +++ b/homcc/common/arguments.py @@ -499,7 +499,9 @@ def map(self, instance_path: str, mapped_cwd: str) -> Arguments: path: str = next(it) if arg == path_arg else arg[len(path_arg) :] real_path: str = os.path.realpath(path) - if not real_path.startswith(EXCLUDED_DEPENDENCY_PREFIXES): + if real_path.startswith(EXCLUDED_DEPENDENCY_PREFIXES): + arg = f"{path_arg}{real_path}" + else: arg = f"{path_arg}{self.map_path_arg(path, instance_path, mapped_cwd)}" else: diff --git a/tests/server/environment_test.py b/tests/server/environment_test.py index 6ac9c5d..ef2e758 100644 --- a/tests/server/environment_test.py +++ b/tests/server/environment_test.py @@ -43,6 +43,8 @@ def test_map_arguments(self): "-isysroot/var/lib/sysroot.h", "-o/home/user/output.o", "-isystem/var/lib/system.h", + "-isystem", + "/usr/include/x86_64-linux-gnu/qt5", "main.cpp", "relative/relative.cpp", "/opt/src/absolute.cpp", @@ -59,6 +61,7 @@ def test_map_arguments(self): assert mapped_args.pop(0) == f"-isysroot{environment.instance_folder}/var/lib/sysroot.h" assert mapped_args.pop(0) == f"-o{environment.instance_folder}/home/user/output.o" assert mapped_args.pop(0) == f"-isystem{environment.instance_folder}/var/lib/system.h" + assert mapped_args.pop(0) == f"-isystem/usr/include/x86_64-linux-gnu/qt5" assert mapped_args.pop(0) == f"{environment.mapped_cwd}/main.cpp" assert mapped_args.pop(0) == f"{environment.mapped_cwd}/relative/relative.cpp" assert mapped_args.pop(0) == f"{environment.instance_folder}/opt/src/absolute.cpp" @@ -99,7 +102,7 @@ def test_map_arguments_relative_paths(self): assert mapped_args.pop(0) == f"{environment.mapped_cwd}/relative.cpp" assert mapped_args.pop(0) == "-c" assert mapped_args.pop(0) == f"{environment.mapped_cwd}/some_file.cpp" - assert mapped_args.pop(0) == "-I/usr/../usr/lib/../lib/libxml" + assert mapped_args.pop(0) == "-I/usr/lib/libxml" def test_map_cwd(self): instance_path = "/client1/" From 7fa90a02f8f46191cd26dfa3d7f865d7dc93f45f Mon Sep 17 00:00:00 2001 From: Oliver Layer Date: Wed, 13 Dec 2023 16:18:56 +0100 Subject: [PATCH 2/2] fix actions --- .github/workflows/build-branch.yml | 2 +- tests/server/environment_test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index 3a0d75c..8f07bda 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -50,7 +50,7 @@ jobs: - name: Execute isort uses: isort/isort-action@master with: - configuration: "--check --color --diff --gitignore --verbose" + configuration: "--check --diff --gitignore --verbose" tests: runs-on: ubuntu-22.04 steps: diff --git a/tests/server/environment_test.py b/tests/server/environment_test.py index ef2e758..3590e3c 100644 --- a/tests/server/environment_test.py +++ b/tests/server/environment_test.py @@ -61,7 +61,7 @@ def test_map_arguments(self): assert mapped_args.pop(0) == f"-isysroot{environment.instance_folder}/var/lib/sysroot.h" assert mapped_args.pop(0) == f"-o{environment.instance_folder}/home/user/output.o" assert mapped_args.pop(0) == f"-isystem{environment.instance_folder}/var/lib/system.h" - assert mapped_args.pop(0) == f"-isystem/usr/include/x86_64-linux-gnu/qt5" + assert mapped_args.pop(0) == "-isystem/usr/include/x86_64-linux-gnu/qt5" assert mapped_args.pop(0) == f"{environment.mapped_cwd}/main.cpp" assert mapped_args.pop(0) == f"{environment.mapped_cwd}/relative/relative.cpp" assert mapped_args.pop(0) == f"{environment.instance_folder}/opt/src/absolute.cpp"