stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, "Ahmed S. Darwish" <darwi@linutronix.de>,
	Masahiro Yamada <masahiroy@kernel.org>
Subject: [PATCH 6.3 10/13] scripts/tags.sh: Resolve gtags empty index generation
Date: Mon,  3 Jul 2023 20:54:20 +0200	[thread overview]
Message-ID: <20230703184519.506861217@linuxfoundation.org> (raw)
In-Reply-To: <20230703184519.206275653@linuxfoundation.org>

From: Ahmed S. Darwish <darwi@linutronix.de>

commit e1b37563caffc410bb4b55f153ccb14dede66815 upstream.

gtags considers any file outside of its current working directory
"outside the source tree" and refuses to index it. For O= kernel builds,
or when "make" is invoked from a directory other then the kernel source
tree, gtags ignores the entire kernel source and generates an empty
index.

Force-set gtags current working directory to the kernel source tree.

Due to commit 9da0763bdd82 ("kbuild: Use relative path when building in
a subdir of the source tree"), if the kernel build is done in a
sub-directory of the kernel source tree, the kernel Makefile will set
the kernel's $srctree to ".." for shorter compile-time and run-time
warnings. Consequently, the list of files to be indexed will be in the
"../*" form, rendering all such paths invalid once gtags switches to the
kernel source tree as its current working directory.

If gtags indexing is requested and the build directory is not the kernel
source tree, index all files in absolute-path form.

Note, indexing in absolute-path form will not affect the generated
index, as paths in gtags indices are always relative to the gtags "root
directory" anyway (as evidenced by "gtags --dump").

Signed-off-by: Ahmed S. Darwish <darwi@linutronix.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 scripts/tags.sh |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -32,6 +32,13 @@ else
 	tree=${srctree}/
 fi
 
+# gtags(1) refuses to index any file outside of its current working dir.
+# If gtags indexing is requested and the build output directory is not
+# the kernel source tree, index all files in absolute-path form.
+if [[ "$1" == "gtags" && -n "${tree}" ]]; then
+	tree=$(realpath "$tree")/
+fi
+
 # Detect if ALLSOURCE_ARCHS is set. If not, we assume SRCARCH
 if [ "${ALLSOURCE_ARCHS}" = "" ]; then
 	ALLSOURCE_ARCHS=${SRCARCH}
@@ -131,7 +138,7 @@ docscope()
 
 dogtags()
 {
-	all_target_sources | gtags -i -f -
+	all_target_sources | gtags -i -C "${tree:-.}" -f - "$PWD"
 }
 
 # Basic regular expressions with an optional /kind-spec/ for ctags and



  parent reply	other threads:[~2023-07-03 18:56 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03 18:54 [PATCH 6.3 00/13] 6.3.12-rc1 review Greg Kroah-Hartman
2023-07-03 18:54 ` [PATCH 6.3 01/13] xtensa: fix lock_mm_and_find_vma in case VMA not found Greg Kroah-Hartman
2023-07-03 18:54 ` [PATCH 6.3 02/13] drm/amd/display: Do not update DRR while BW optimizations pending Greg Kroah-Hartman
2023-07-03 18:54 ` [PATCH 6.3 03/13] PCI/ACPI: Validate acpi_pci_set_power_state() parameter Greg Kroah-Hartman
2023-07-03 18:54 ` [PATCH 6.3 04/13] PCI/ACPI: Call _REG when transitioning D-states Greg Kroah-Hartman
2023-07-03 18:54 ` [PATCH 6.3 05/13] execve: always mark stack as growing down during early stack setup Greg Kroah-Hartman
2023-07-03 18:54 ` [PATCH 6.3 06/13] nfs: dont report STATX_BTIME in ->getattr Greg Kroah-Hartman
2023-07-03 18:54 ` [PATCH 6.3 07/13] Revert "cxl/port: Enable the HDM decoder capability for switch ports" Greg Kroah-Hartman
2023-07-03 18:54 ` [PATCH 6.3 08/13] nubus: Partially revert proc_create_single_data() conversion Greg Kroah-Hartman
2023-07-03 18:54 ` [PATCH 6.3 09/13] hugetlb: revert use of page_cache_next_miss() Greg Kroah-Hartman
2023-07-03 18:54 ` Greg Kroah-Hartman [this message]
2023-07-03 18:54 ` [PATCH 6.3 11/13] docs: Set minimal gtags / GNU GLOBAL version to 6.6.5 Greg Kroah-Hartman
2023-07-03 18:54 ` [PATCH 6.3 12/13] dm ioctl: Avoid double-fetch of version Greg Kroah-Hartman
2023-07-03 18:54 ` [PATCH 6.3 13/13] drm/amdgpu: Validate VM ioctl flags Greg Kroah-Hartman
2023-07-04  7:34 ` [PATCH 6.3 00/13] 6.3.12-rc1 review Naresh Kamboju
2023-07-04  7:43   ` Greg Kroah-Hartman
2023-07-04  8:24     ` Greg Kroah-Hartman
2023-07-04  8:39       ` Greg Kroah-Hartman
2023-07-04  8:43       ` Harshit Mogalapalli
2023-07-04  8:47         ` Greg Kroah-Hartman
2023-07-04  9:56           ` Thorsten Leemhuis
2023-07-04 12:28             ` Greg Kroah-Hartman
2023-07-05 17:36               ` Mike Kravetz
2023-07-04 10:53   ` Arnd Bergmann
2023-07-04 12:29     ` Greg Kroah-Hartman
2023-07-05  7:09 ` Conor Dooley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230703184519.506861217@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=darwi@linutronix.de \
    --cc=masahiroy@kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).