summaryrefslogtreecommitdiff
path: root/android-mainline/ANDROID-Revert-gen_compile_commands.py-fix-path-resolve-with-symlinks-in-it.patch
blob: 777d8050225ad836df0b23a4b2ed1919dcb43fea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ulises Mendez Martinez <umendez@google.com>
Date: Tue, 16 Jan 2024 15:24:10 +0000
Subject: 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 <umendez@google.com>
---
 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
--- 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 {