From 22858186da5ac2bffa67edd862c0a4b1a45941fc Mon Sep 17 00:00:00 2001 From: Ulises Mendez Martinez Date: Tue, 16 Jan 2024 15:24:10 +0000 Subject: [PATCH] ANDROID: Revert "gen_compile_commands.py: fix path resolve with symlinks in it" * This reverts commit 880946158b01138c06e93e4aa4255ffbfe70e1c8 * Reason for revert: It breaks `kleaf_kythe` target. Bug: 320449031 Change-Id: I63ad1a8a31c48dff8c9cb699b43dee6c1d46abd6 Signed-off-by: Ulises Mendez Martinez --- scripts/clang-tools/gen_compile_commands.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/clang-tools/gen_compile_commands.py b/scripts/clang-tools/gen_compile_commands.py index 5dea4479240b..180952fb91c1 100755 --- a/scripts/clang-tools/gen_compile_commands.py +++ b/scripts/clang-tools/gen_compile_commands.py @@ -64,7 +64,7 @@ def parse_arguments(): args = parser.parse_args() return (args.log_level, - os.path.realpath(args.directory), + os.path.abspath(args.directory), args.output, args.ar, args.paths if len(args.paths) > 0 else [args.directory]) @@ -172,8 +172,8 @@ def process_line(root_directory, command_prefix, file_path): # by Make, so this code replaces the escaped version with '#'. prefix = command_prefix.replace('\#', '#').replace('$(pound)', '#') - # Return the canonical path, eliminating any symbolic links encountered in the path. - abs_path = os.path.realpath(os.path.join(root_directory, file_path)) + # Use os.path.abspath() to normalize the path resolving '.' and '..' . + abs_path = os.path.abspath(os.path.join(root_directory, file_path)) if not os.path.exists(abs_path): raise ValueError('File %s not found' % abs_path) return {