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

To reply to this bug, email your comments to 79234 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to help-debbugs <at> gnu.org:
bug#79234; Package global. (Thu, 14 Aug 2025 11:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to ross <at> evermain.com.au:
New bug report received and forwarded. Copy sent to help-debbugs <at> gnu.org. (Thu, 14 Aug 2025 11:16:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ross Bennett <ross <at> evermain.com.au>
To: submit <at> debbugs.gnu.org
Subject: 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 26 days ago.

Previous Next


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