Hi,
When using gtags-cscope with the -C argument to ignore case, it passes
malformed arguments to global which prevents it from looking up the
definition points of the requested identifier.
Given bug.c:
------------
#define FOO 12
int main(int argc, const char *argv[]) {
return FOO;
}
Repro:
------
$ gtags-cscope -Cv
Expected:
---------
>> 1foo
gscope: /usr/local/bin/global --result=cscope --ignore-case 'foo'
cscope: 1 lines
bug.c FOO 1 #define FOO 12
We get:
-------
>> 1foo
gscope: /usr/local/bin/global --result=cscope -
cscope: 0 lines
The problem is in execute_command() -- when the opt argument is 0 it
adds a bad "-\0" commandline option to the command strbuf which
null-terminates it. The attached patch corrects and simplifies this
logic.
It looks like I just missed a release with this; sorry! Please consider
the patch for the next release.
Thanks,
Steve
--
Steven Mueller
Index: gtags-cscope/gtags-cscope.c
===================================================================
RCS file: /sources/global/global/gtags-cscope/gtags-cscope.c,v
retrieving revision 1.14
diff -u -r1.14 gtags-cscope.c
--- gtags-cscope/gtags-cscope.c 3 Feb 2010 12:01:08 -0000 1.14
+++ gtags-cscope/gtags-cscope.c 1 Apr 2010 10:11:32 -0000
@@ -329,17 +329,17 @@
strbuf_clear(command);
strbuf_puts(command, global_path);
strbuf_puts(command, " --result=cscope");
- if (opt || ignore_case) {
- if (opt == FROM_HERE) {
- strbuf_puts(command, " --from-here=");
- strbuf_puts(command, context);
- } else {
- strbuf_puts(command, " -");
- strbuf_putc(command, opt);
- }
- if (ignore_case)
- strbuf_puts(command, " --ignore-case");
+
+ if (opt == FROM_HERE) {
+ strbuf_puts(command, " --from-here=");
+ strbuf_puts(command, context);
+ } else if (opt) {
+ strbuf_puts(command, " -");
+ strbuf_putc(command, opt);
}
+ if (ignore_case)
+ strbuf_puts(command, " --ignore-case");
+
strbuf_putc(command, ' ');
strbuf_putc(command, QUOTE);
strbuf_puts(command, arg);
_______________________________________________
Bug-global mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-global