Hi,
I found a bug in the global command.
------------------------------
$ cat sample.sh
echo $@
echo $@
$ GTAGSPYGMENTSOPTS= gtags --gtagslabel=pygments
$ gtags -d GRTAGS
__.COMPACT __.COMPACT
__.COMPLINE __.COMPLINE
__.COMPNAME __.COMPNAME
__.VERSION __.VERSION 6
$@ 2 @n 1-1
echo 2 @n 1-1
$ global -xs '.*'
$@ 1 sample.sh echo $@
global: Abbrev character must be a lower alphabetic character. ()
------------------------------
global exits with the message "Abbrev character must be a lower
alphabetic character. ()".
The cause is that in put_compact_format() uncompress() is applied
repeatedly when a tagline has two or more line numbers.
e.g.
uncompress("@n", "$@"); // 1st iteration
uncompress("$@", "$@"); // 2nd iteration -> error
The attached patch ensures uncompress() is called only once.
Thanks,
Index: global/output.c
===================================================================
RCS file: /sources/global/global/global/output.c,v
retrieving revision 1.5
diff -u -u -p -r1.5 output.c
--- global/output.c 4 Apr 2014 04:01:16 -0000 1.5
+++ global/output.c 26 Nov 2014 14:28:21 -0000
@@ -143,6 +143,8 @@ put_compact_format(CONVERT *cv, GTP *gtp
*/
if (!isdigit(*p))
die("invalid compact format.");
+ if (flags & GTAGS_COMPNAME)
+ tagname = (char *)uncompress(tagname, gtp->tag);
if (flags & GTAGS_COMPLINE) {
/*
* If GTAGS_COMPLINE flag is set, each line number is expressed
as
@@ -179,8 +181,6 @@ put_compact_format(CONVERT *cv, GTP *gtp
cur_lineno++;
}
}
- if (flags & GTAGS_COMPNAME)
- tagname = (char *)uncompress(tagname, gtp->tag);
convert_put_using(cv, tagname, gtp->path, n, src, fid);
count++;
last_lineno = last = n;
@@ -209,8 +209,6 @@ put_compact_format(CONVERT *cv, GTP *gtp
cur_lineno++;
}
}
- if (flags & GTAGS_COMPNAME)
- tagname = (char *)uncompress(tagname, gtp->tag);
convert_put_using(cv, tagname, gtp->path, n, src, fid);
count++;
last_lineno = n;
_______________________________________________
Bug-global mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-global