Fix TAGS creation

Submitted by David Gibson on March 12, 2013, 2:57 a.m.

Details

Message ID 1363057048-21534-1-git-send-email-david@gibson.dropbear.id.au
State New
Headers show

Commit Message

David Gibson March 12, 2013, 2:57 a.m.
Currently the Makefile creates TAGS for emacs with the command:
    find "$(SRC_PATH)" -name '*.[hc]' -print0 | xargs -0 etags
That works only if xargs ends up invoking etags just once.  If xargs runs
etags several times, as it will if there are enough files, then the later
invocations will overwrite the output from the earlier invocations.  This
patch uses the etags --append option to fix the bug.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

---
v2: Improved portability based on suggest from Markus Armbruster.
---
 Makefile |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Markus Armbruster March 15, 2013, 6:15 a.m.
David Gibson <david@gibson.dropbear.id.au> writes:

> Currently the Makefile creates TAGS for emacs with the command:
>     find "$(SRC_PATH)" -name '*.[hc]' -print0 | xargs -0 etags
> That works only if xargs ends up invoking etags just once.  If xargs runs
> etags several times, as it will if there are enough files, then the later
> invocations will overwrite the output from the earlier invocations.  This
> patch uses the etags --append option to fix the bug.
>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

Reviewed-by: Markus Armbruster <armbru@redhat.com>
David Gibson March 19, 2013, 1:32 a.m.
On Fri, Mar 15, 2013 at 07:15:52AM +0100, Markus Armbruster wrote:
> David Gibson <david@gibson.dropbear.id.au> writes:
> 
> > Currently the Makefile creates TAGS for emacs with the command:
> >     find "$(SRC_PATH)" -name '*.[hc]' -print0 | xargs -0 etags
> > That works only if xargs ends up invoking etags just once.  If xargs runs
> > etags several times, as it will if there are enough files, then the later
> > invocations will overwrite the output from the earlier invocations.  This
> > patch uses the etags --append option to fix the bug.
> >
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> 
> Reviewed-by: Markus Armbruster <armbru@redhat.com>

Anyone? Anyone?  Please apply?
Anthony Liguori March 19, 2013, 1:38 a.m.
Applied.  Thanks.

Regards,

Anthony Liguori

Patch hide | download patch | download mbox

diff --git a/Makefile b/Makefile
index 12c7662..6915178 100644
--- a/Makefile
+++ b/Makefile
@@ -334,7 +334,8 @@  test speed: all
 
 .PHONY: TAGS
 TAGS:
-	find "$(SRC_PATH)" -name '*.[hc]' -print0 | xargs -0 etags
+	rm -f $@
+	find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
 
 cscope:
 	rm -f ./cscope.*