Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp676552rdb; Tue, 5 Dec 2023 17:21:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IEaA7uQ+9ICiEcCGzqCClQsHTMtOsAEiZ637RV0yZ8PRHNDaSt9tId1aiuvufZ0+CIsbVm5 X-Received: by 2002:a05:6358:9049:b0:170:17eb:378c with SMTP id f9-20020a056358904900b0017017eb378cmr224561rwf.52.1701825686053; Tue, 05 Dec 2023 17:21:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701825686; cv=none; d=google.com; s=arc-20160816; b=B0QIw34FlM5tYJCJq2W6Iu1/b59wfriSRhLOZ5eNOhYCLofR3NeD66Kf0YFDLWiglA UbqBb3KdaJ25vThz+7/gM3GfKpA88Bwoo4FVHCsvrYpYkdUVFZJ+30lLVcDeZeizGjPV onv2Z1+J668hXnE31IfMZSmFozBiYYTNqZEIaoaxh94mz984rcN+X38E4I6rRpd2Vf3Z vTQ8xVZAwYcz371XoRUQiR60nNrCo0wUbgxiNhd85QX5DNpqvZSSAE3S4EFzwNYp7RpM 0jl3/j61ho2D5oHpHZylUFXCTzeoxAPoK1ONjmNp/UnbcBiy28BeyMDmiSsMPm+srvcx TAhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=b01mbUek2aS3uxxW6oyNmrALM5QxnNWsOCXMlfLJUjc=; fh=QOostrrTAXmb7T9ajawDaKIc+XrUqDGGWegM2Zu1y8g=; b=FVZ5F5FnUnB+JIpldd6enmVXrBzjswu/HdP7ghBQRNL4tt1msLu8M2Xjf9DR1qU9GP E4m9sYX/ssqsTiRgn4zFZ6y4cE/mhYAt8YWODVQm0EwkP/cH0gp+6idwXwIIKZIBAtgx Xeb4E9xfVMUBDRb0pRplntXAn9R/n2Hx/DlxvgVoHZNqLy+IOgtf7fi0x7hTA9X1GIxN Er1B5CyMMiEEZHdXzNYkpxzGLKjbMYC0loJTqwKSmIILDuwj9GME7BDV002nqynYUOF5 aLeTPkc2e5/Y5NwJw94FEm3fTMRecWlbPhSJAJFxhaCNs5Rx7XvQhvc0upLLFsMpQofw lu3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id l18-20020a656812000000b005c6125b1733si5100118pgt.538.2023.12.05.17.21.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 17:21:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 9C02E8220347; Tue, 5 Dec 2023 17:21:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229943AbjLFBVF (ORCPT + 99 others); Tue, 5 Dec 2023 20:21:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229617AbjLFBVD (ORCPT ); Tue, 5 Dec 2023 20:21:03 -0500 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7786E196; Tue, 5 Dec 2023 17:21:09 -0800 (PST) X-QQ-mid: bizesmtp68t1701825652tqn6a9bj Received: from localhost.localdomain ( [219.147.0.78]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 06 Dec 2023 09:20:49 +0800 (CST) X-QQ-SSF: 01200000000000B0J000000A0000000 X-QQ-FEAT: /5D9664O2EUSvgP0XxT6g0eaGNcEG1H8I6GjK/tnLlRnh1xvWCndohvKG1n7j kjnnoHFErTEr7I9aeIskimiOkJk2VOMq+XwpfaDLhCVX9fLm0qgjUCclZypQBJoUPhVzgcM O6NZVg9E8qEMQHgXCLttrNTGlTYN/A0c4RQHNkH6l6txf3PMjya0CYYsSVQPX+g8s69H7jP IZFImoY/IjWWgsRMq93R9LGvdBpCASWN+VAajUXEb95jt/s3job82hab+iF1iX2cVM3u+Vy J8BFrWosr0j+S+KUxD6FUxSrffT2naQPBWVZ4+SDUbmXDsoa+lBoZWRsLw1e7WLICmpjMpE ErbQQYSsVrq3+JIoQD8teTNkxtWBQ== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 13065259714944715131 From: Jialu Xu To: nathan@kernel.org Cc: justinstitt@google.com, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, masahiroy@kernel.org, morbo@google.com, ndesaulniers@google.com, xujialu@vimux.org Subject: Re: [PATCH v2] gen_compile_commands.py: fix path resolve with symlinks in it Date: Wed, 6 Dec 2023 09:20:34 +0800 Message-Id: <20231206012034.833057-1-xujialu@vimux.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231205165648.GA391810@dev-arch.thelio-3990X> References: <20231205165648.GA391810@dev-arch.thelio-3990X> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:vimux.org:qybglogicsvrgz:qybglogicsvrgz5a-1 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 05 Dec 2023 17:21:23 -0800 (PST) Hi Nathan, >On Tue, Dec 05, 2023 at 10:15:26AM +0800, Jialu Xu wrote: >> When symbolic links are involved in the path, os.path.abspath might not >> resolve the symlinks and instead return the absolute path with the >> symlinks intact. >> >> Use pathlib.Path resolve() instead of os.path.abspath() >> >> Signed-off-by: Jialu Xu > >Thanks for the clarification in your previous message [1], I suppose >that makes sense as to why nobody has reported this to us because that >is a rather odd situation that the upstream kernel would not experience. > >I think that some of those details should be in the commit message, >along with a short example like you provided, so that we know exactly >what the situation was and how this patch resolves it. > >Perhaps something like (please feel free to correct or reword as you >feel necessary): > >"When a path contains relative symbolic links, os.path.abspath() might >not follow the symlinks and instead return the absolute path with just >the relative paths resolved, resulting in an incorrect path. > > > >Use pathlib.Path.resolve(), which resolves the symlinks and normalizes >the paths correctly. > >" > >The actual fix seems fine to me. Feel free to add > > Reviewed-by: Nathan Chancellor > >to the subsequent submission and please include both > > Masahiro Yamada > linux-kbuild@vger.kernel.org > >on it in addition to the people you have here, as he is the one who >actually applies gen_compile_commands.py changes (I am going to send a >MAINTAINERS change for this). > >[1]: https://lore.kernel.org/20231205021523.4152128-1-xujialu@vimux.org/ > Thanks for the very detailed help! Patch update as v3. Cheers, Jialu