GNU bug report logs - #79234
Global completion without limit arg terminates on first libdb

Previous Next

Package: global;

Reported by: ross <at> evermain.com.au

Date: Thu, 14 Aug 2025 11:16:02 UTC

Severity: normal

Found in version 6.6.14

Full log


View this message in rfc822 format

From: Ross Bennett <ross <at> evermain.com.au>
To: 79234 <at> debbugs.gnu.org
Subject: bug#79234: Global completion without limit arg terminates on first libdb
Date: Thu, 14 Aug 2025 16:16:09 +0800
Package: global
Version: 6.6.14

When I have a GTAGSLIBPATH involving multiple directories, a global 
command to find completions of tags in the second path entry fails. It 
works if I give a limit to the completion argument.

e.g. I have 2 library directories, /srv1/source/dir1 and 
/srv1/source/dir2, and dbg_foo() defined in /srv1/source/dir2/file1.c. I 
run gtags in each of these directories. I have 
GTAGSLIBPATH=/srv1/source/dir1/:/srv1/source/dir2/

From another directory also with GTAGS I run 'global -c dbg_f' and get 
nothing.

It gives completions from the first library fine.

Also, using a limit avoids the issue. Running 'global --completion=1 
dbg_f' and it gives dbg_foo successfully.

On one occasion I think I got this to work initially, but then it failed 
on repeats, I'm not sure why or even if I was doing the tests correctly 
at that point.

Looking at the 6.6.14 code, I think the issue is in global/global.c, 
line 1091: if (total >= limit) break;

Without a completion limit argument, the limit variable is set to 0. So, 
if no entries are found in the first library path, the total is 0, which 
still qualifies for >= 0, which aborts the loop. Having a limit argument 
avoids that problem.

I adjusted the code in a local checkout to be if (total > limit) and the 
compiled binary then worked correctly for dbg_foo with global -c dbg_f.


Hope this helps

Ross
-- 
Ross Bennett




This bug report was last modified 27 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.