Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wAerK-000CHf-24 for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Apr 2026 02:11:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wAerI-0038Ht-3C for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Apr 2026 02:11:05 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wAerH-0038Hd-3C for pgsql-hackers@lists.postgresql.org; Thu, 09 Apr 2026 02:11:05 +0000 Received: from fout-b2-smtp.messagingengine.com ([202.12.124.145]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wAerG-000000005gS-0LfL for pgsql-hackers@lists.postgresql.org; Thu, 09 Apr 2026 02:11:04 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 2F6501D001C7 for ; Wed, 8 Apr 2026 22:11:01 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Wed, 08 Apr 2026 22:11:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm2; t=1775700660; x=1775787060; bh=0gSY88XXMbpmPyIYT0Jdd9NEx6Lc6iq/ +Frc42wIilU=; b=NambXzrmyu6vDmFVrbnH48IriAX0w1BncFDSZw93uK55CT5K C3gEyfDsW3dUwEHMsrFAVv9aJmkWyv6jfO8VecRS6Mc456u5/W114K58S3pNlNN5 Xb3jE9fM4iSTxjRknUkVTsSTTA5l9lQ5OgUn30TOipy2vAK4UsfDG8xp+iHEZuBx 83CHMXCUA4TIh3MWcVmtcj3yqURIt9LrOvl2ae43s1MxLw+yPLgHcqak9p8FPvXU SmoiCemNIWSmjaz0sZSWCXHyNAYQ1PjPWehfJ9Pr2aSPG6KTej2esj9TFMuwnvl8 qO88DscwBWoAZ8g+zipubzY4Ngl+rQPkTYUZnQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1775700660; x= 1775787060; bh=0gSY88XXMbpmPyIYT0Jdd9NEx6Lc6iq/+Frc42wIilU=; b=B wzw/Rm/SBmC50t8KrbikwKrd4lmt30kPrryYSCGB1G0GwZckrC990k2XH5066Dfx szodRHafpuhiNhG2ECV9axH5m/TPNgbqB2bOqbjVK5lyhw2RBzEdKZxzhw9yci5h 95Lf0zegrw800N9j+iDcsIGIrY8nJRqWBGKeY+c+pI5/Qc1bO0MNVKfI0Sb43TYQ x5tK7gKC2mzAWcBNnzeD78pOJ/uQ9jochwM/E5Q6zcwzUR1+Q4tLl6ELIwvAb1vA mbPc8Pnpr+aawIqxHTuj18EYaK4XVNtl82YBXkaH83MpL0hzByQTmsKqDmfiY4xZ yDzfZnNwTkdwhUW3d9+cw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgddvhedvfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlh cuvffnffculdejtddmnecujfgurhepfffhvffukfggtggusehgtderredttddvnecuhfhr ohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqhhuihgvrh drgiihiieqnecuggftrfgrthhtvghrnhepvddtffetgedthfeugfevvddtjefguefggefg jefgvdehgfefveeikedtleekhffgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidpnhgspghr tghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepphhgshhqlhdqhh grtghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 8 Apr 2026 22:10:59 -0400 (EDT) Date: Thu, 9 Apr 2026 11:10:55 +0900 From: Michael Paquier To: Postgres hackers Subject: Backpatching make_ctags -e and -n to v15 and v14 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Y4mm/VKMO819Bt1M" Content-Disposition: inline List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Y4mm/VKMO819Bt1M Content-Type: multipart/mixed; boundary="x5uEd7QzM0ODVY9J" Content-Disposition: inline --x5uEd7QzM0ODVY9J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi all, While doing some work on back branches lately, I have been annoyed by the fact that the improvements done in make_ctags as of d1e2a380cb91 are not available in REL_14_STABLE and REL_15_STABLE. I don't really use the -n mode, but the emacs mode covered by -e has been a time-saver for some time now, and it's sad to have only that available in v16~. Would there by any objections in backpatching the attached down to v14 and v15? This includes d1e2a380cb91, 87f21d2c6890 and ae66716bf3ef. Opinions or comments? -- Michael --x5uEd7QzM0ODVY9J Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=0001-Enhance-make_ctags-and-make_etags-v15.patch Content-Transfer-Encoding: quoted-printable =46rom 94f85759a81572b17132085754d39498ce04564d Mon Sep 17 00:00:00 2001 =46rom: Tatsuo Ishii Date: Wed, 19 Oct 2022 12:59:29 +0900 Subject: [PATCH] Enhance make_ctags and make_etags. make_ctags did not include field members of structs since the commit 964d01ae90c314eb31132c2e7712d5d9fc237331. For example, in the following field of RestrictInfo: Selectivity norm_selec pg_node_attr(equal_ignore); pg_node_attr was mistakenly interpreted to be the name of the field. To fix this, add -I option to ctags command if the command is Exuberant ctags or Universal ctags (for plain old ctags, struct members are not included in the tags file anyway). Also add "-e" and "-n" options to make_ctags. The -e option invokes ctags command with -e option, which produces TAGS file for emacs. This allows to eliminate duplicate codes in make_etags so that make_etags just exec make_ctags with -e option. The -n option allows not to produce symbolic links in each sub directory (the default is producing symbolic links). This includes some follow-up fixes: 87f21d2c6890 and ae66716bf3ef. Author: Yugo Nagata Reviewers: Alvaro Herrera, Tatsuo Ishii Discussion: https://postgr.es/m/flat/20221007154442.76233afc7c5b255c4de6528= a%40sraoss.co.jp --- src/tools/make_ctags | 80 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 66 insertions(+), 14 deletions(-) diff --git a/src/tools/make_ctags b/src/tools/make_ctags index 9e952ce916f2..ad027c71e3dd 100755 --- a/src/tools/make_ctags +++ b/src/tools/make_ctags @@ -1,16 +1,54 @@ #!/bin/sh =20 -# src/tools/make_ctags +# src/tools/make_ctags [-e] [-n] +# If -e is specified, generate tags files for emacs. +# If -n is specified, don't create symbolic links of tags file. +usage=3D"Usage: $0 [-e][-n]" +if [ $# -gt 2 ] +then echo $usage + exit 1 +fi =20 -command -v ctags >/dev/null || \ +EMACS_MODE=3D +NO_SYMLINK=3D +IS_EXUBERANT=3D +PROG=3D"ctags" +TAGS_OPT=3D"-a -f" +TAGS_FILE=3D"tags" +FLAGS=3D +IGNORE_IDENTIFIES=3D + +while [ $# -gt 0 ] +do + if [ $1 =3D "-e" ] + then EMACS_MODE=3D"Y" + elif [ $1 =3D "-n" ] + then NO_SYMLINK=3D"Y" + else + echo $usage + exit 1 + fi + shift +done + +if [ ! "$EMACS_MODE" ] +then (command -v ctags >/dev/null) || \ { echo "'ctags' program not found" 1>&2; exit 1; } +fi =20 -trap "rm -f /tmp/$$" 0 1 2 3 15 -rm -f ./tags - -IS_EXUBERANT=3D"" ctags --version 2>&1 | grep Exuberant && IS_EXUBERANT=3D"Y" =20 +if [ "$EMACS_MODE" ] +then TAGS_FILE=3D"TAGS" + if [ "$IS_EXUBERANT" ] + then PROG=3D"ctags -e" + else (command -v etags >/dev/null) || \ + { echo "neither 'etags' nor exuberant 'ctags' program not found" 1>&2; e= xit 1; } + PROG=3D"etags" + TAGS_OPT=3D"-a -o" + fi +fi + # List of kinds supported by Exuberant Ctags 5.8 # generated by ctags --list-kinds # --c-kinds was called --c-types before 2003 @@ -31,12 +69,23 @@ ctags --version 2>&1 | grep Exuberant && IS_EXUBERANT= =3D"Y" =20 if [ "$IS_EXUBERANT" ] then FLAGS=3D"--c-kinds=3D+dfmstuv" -else FLAGS=3D"-dt" +elif [ ! "$EMACS_MODE" ] +then FLAGS=3D"-dt" fi =20 +# Use -I option to ignore a macro +if [ "$IS_EXUBERANT" ] +then IGNORE_IDENTIFIES=3D"-I pg_node_attr+" +fi + +trap "ret=3D$?; rm -rf /tmp/$$; exit $ret" 0 1 2 3 15 +rm -f ./$TAGS_FILE + # this is outputting the tags into the file 'tags', and appending -find `pwd`/ -type f -name '*.[chyl]' -print | - xargs ctags -a -f tags "$FLAGS" +find `pwd`/ \( -name tmp_install -prune -o -name tmp_check -prune \) \ + -o \( -name "*.[chly]" -o -iname "*makefile*" -o -name "*.mk" -o -name "*= =2Ein" \ + -o -name "*.sql" -o -name "*.p[lm]" \) -type f -print | + xargs $PROG $TAGS_OPT $TAGS_FILE $FLAGS $IGNORE_IDENTIFIES =20 # Sorting non-Exuberant ctags file allows for fast searching of the tags f= ile. # Since etags file has a header that we cannot sort in with the other entr= ies @@ -44,10 +93,13 @@ find `pwd`/ -type f -name '*.[chyl]' -print | if [ ! "$IS_EXUBERANT" -a ! "$EMACS_MODE" ] then LC_ALL=3DC export LC_ALL - sort tags >/tmp/$$ && mv /tmp/$$ tags + sort $TAGS_FILE >/tmp/$$ && mv /tmp/$$ $TAGS_FILE fi =20 -find . \( -name 'CVS' -prune \) -o \( -name .git -prune \) -o -type d -pri= nt | -while read DIR -do [ "$DIR" !=3D "." ] && ln -f -s `echo "$DIR" | sed 's;/[^/]*;/..;g'`/ta= gs "$DIR"/tags -done +# create symbolic links +if [ ! "$NO_SYMLINK" ] +then find . \( -name 'CVS' -prune \) -o \( -name .git -prune \) -o -typ= e d -print | + while read DIR + do [ "$DIR" !=3D "." ] && ln -f -s `echo "$DIR" | sed 's;/[^/]*;/..;g'`/$= TAGS_FILE "$DIR"/$TAGS_FILE + done +fi --=20 2.53.0 --x5uEd7QzM0ODVY9J Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=0001-Enhance-make_ctags-and-make_etags-v14.patch Content-Transfer-Encoding: quoted-printable =46rom 3a00b4cd2a6b0b4ac090fca9563dbff4cc5098ff Mon Sep 17 00:00:00 2001 =46rom: Tatsuo Ishii Date: Wed, 19 Oct 2022 12:59:29 +0900 Subject: [PATCH] Enhance make_ctags and make_etags. make_ctags did not include field members of structs since the commit 964d01ae90c314eb31132c2e7712d5d9fc237331. For example, in the following field of RestrictInfo: Selectivity norm_selec pg_node_attr(equal_ignore); pg_node_attr was mistakenly interpreted to be the name of the field. To fix this, add -I option to ctags command if the command is Exuberant ctags or Universal ctags (for plain old ctags, struct members are not included in the tags file anyway). Also add "-e" and "-n" options to make_ctags. The -e option invokes ctags command with -e option, which produces TAGS file for emacs. This allows to eliminate duplicate codes in make_etags so that make_etags just exec make_ctags with -e option. The -n option allows not to produce symbolic links in each sub directory (the default is producing symbolic links). This includes some follow-up fixes: 87f21d2c6890 and ae66716bf3ef. Author: Yugo Nagata Reviewers: Alvaro Herrera, Tatsuo Ishii Discussion: https://postgr.es/m/flat/20221007154442.76233afc7c5b255c4de6528= a%40sraoss.co.jp --- src/tools/make_ctags | 89 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 70 insertions(+), 19 deletions(-) diff --git a/src/tools/make_ctags b/src/tools/make_ctags index d8d18d1569f9..ad027c71e3dd 100755 --- a/src/tools/make_ctags +++ b/src/tools/make_ctags @@ -1,16 +1,54 @@ #!/bin/sh =20 -# src/tools/make_ctags +# src/tools/make_ctags [-e] [-n] +# If -e is specified, generate tags files for emacs. +# If -n is specified, don't create symbolic links of tags file. +usage=3D"Usage: $0 [-e][-n]" +if [ $# -gt 2 ] +then echo $usage + exit 1 +fi =20 -command -v ctags >/dev/null || \ +EMACS_MODE=3D +NO_SYMLINK=3D +IS_EXUBERANT=3D +PROG=3D"ctags" +TAGS_OPT=3D"-a -f" +TAGS_FILE=3D"tags" +FLAGS=3D +IGNORE_IDENTIFIES=3D + +while [ $# -gt 0 ] +do + if [ $1 =3D "-e" ] + then EMACS_MODE=3D"Y" + elif [ $1 =3D "-n" ] + then NO_SYMLINK=3D"Y" + else + echo $usage + exit 1 + fi + shift +done + +if [ ! "$EMACS_MODE" ] +then (command -v ctags >/dev/null) || \ { echo "'ctags' program not found" 1>&2; exit 1; } +fi =20 -trap "rm -f /tmp/$$" 0 1 2 3 15 -rm -f ./tags - -IS_EXUBERANT=3D"" ctags --version 2>&1 | grep Exuberant && IS_EXUBERANT=3D"Y" =20 +if [ "$EMACS_MODE" ] +then TAGS_FILE=3D"TAGS" + if [ "$IS_EXUBERANT" ] + then PROG=3D"ctags -e" + else (command -v etags >/dev/null) || \ + { echo "neither 'etags' nor exuberant 'ctags' program not found" 1>&2; e= xit 1; } + PROG=3D"etags" + TAGS_OPT=3D"-a -o" + fi +fi + # List of kinds supported by Exuberant Ctags 5.8 # generated by ctags --list-kinds # --c-kinds was called --c-types before 2003 @@ -31,24 +69,37 @@ ctags --version 2>&1 | grep Exuberant && IS_EXUBERANT= =3D"Y" =20 if [ "$IS_EXUBERANT" ] then FLAGS=3D"--c-kinds=3D+dfmstuv" -else FLAGS=3D"-dt" +elif [ ! "$EMACS_MODE" ] +then FLAGS=3D"-dt" fi =20 +# Use -I option to ignore a macro +if [ "$IS_EXUBERANT" ] +then IGNORE_IDENTIFIES=3D"-I pg_node_attr+" +fi + +trap "ret=3D$?; rm -rf /tmp/$$; exit $ret" 0 1 2 3 15 +rm -f ./$TAGS_FILE + # this is outputting the tags into the file 'tags', and appending -find `pwd`/ -type f -name '*.[chyl]' -print | - xargs ctags -a -f tags "$FLAGS" +find `pwd`/ \( -name tmp_install -prune -o -name tmp_check -prune \) \ + -o \( -name "*.[chly]" -o -iname "*makefile*" -o -name "*.mk" -o -name "*= =2Ein" \ + -o -name "*.sql" -o -name "*.p[lm]" \) -type f -print | + xargs $PROG $TAGS_OPT $TAGS_FILE $FLAGS $IGNORE_IDENTIFIES =20 -# Exuberant tags has a header that we cannot sort in with the other entries -# so we skip the sort step -# Why are we sorting this? I guess some tag implementation need this, -# particularly for append mode. bjm 2012-02-24 -if [ ! "$IS_EXUBERANT" ] +# Sorting non-Exuberant ctags file allows for fast searching of the tags f= ile. +# Since etags file has a header that we cannot sort in with the other entr= ies +# we skip the sort step. +if [ ! "$IS_EXUBERANT" -a ! "$EMACS_MODE" ] then LC_ALL=3DC export LC_ALL - sort tags >/tmp/$$ && mv /tmp/$$ tags + sort $TAGS_FILE >/tmp/$$ && mv /tmp/$$ $TAGS_FILE fi =20 -find . \( -name 'CVS' -prune \) -o \( -name .git -prune \) -o -type d -pri= nt | -while read DIR -do [ "$DIR" !=3D "." ] && ln -f -s `echo "$DIR" | sed 's;/[^/]*;/..;g'`/ta= gs "$DIR"/tags -done +# create symbolic links +if [ ! "$NO_SYMLINK" ] +then find . \( -name 'CVS' -prune \) -o \( -name .git -prune \) -o -typ= e d -print | + while read DIR + do [ "$DIR" !=3D "." ] && ln -f -s `echo "$DIR" | sed 's;/[^/]*;/..;g'`/$= TAGS_FILE "$DIR"/$TAGS_FILE + done +fi --=20 2.53.0 --x5uEd7QzM0ODVY9J-- --Y4mm/VKMO819Bt1M Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmnXCq8ACgkQnvQgOdby QH2bHw/+PQDhrYzXPC3YdCGWD5olhY2xQIFaWiZpGaphQ2cIesLQZTfd03czEkhX 03+WbmlpcT2lVSIAPnAv4E8sX9ObENZ6WeBNr9z5oo94V6dPZOsS8xr3kmI9ygqk z5G0Fk3J1lsitbDucWm+MZ9yLbvOpD0IM1Vv9vTJ8lK3fiK5hdKQu7XkX1boIE9J /apzl/RGRet02O80JFbXN8K2j5o3t4bPPc3n1X2nKlDEAC2FuW+icw9yQkWT2MNq fvvi/ngvSHBXNNnq1+9JFrP1jnHiUnB6BNgGlOo6k8A04UzIYUPvjTPoeuw9RueY /hcWjKr861ChmEHpq+S8QEfZxf2A8Ce6e2iBc/xYTTmuaiwIWQFoNk1Fl/tqLQEW Sq/q+9XIR0uqR6XXEJmMHO2r4+ZmAAwiZjm31BQWmqIcsGsyl3vVV+t2GOCiGn1G IRCSQ3j53I14M1tTG4QSE8ZPI9wStGI2cZ/DIcouIUF/9QvtYz/HfTuWALL3QxLl vGkMmml7UADAdvsbtRaOR1sXXgAMcbbLzqMuESmVjM21+TRu8t1OgIQFwn9OTHkH 0ytTUUW4ye9q5uwaVig4YuVVndNDSIKgtqjw4hUT6m1jaPnuQ6X/hXxv7DbRKCeG KanR/JlyyWUFUSI1qc10zfr58NBnzJue09nAXsQzB2NETaWWNxk= =t6i6 -----END PGP SIGNATURE----- --Y4mm/VKMO819Bt1M--