Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 885801 - app-portage/portage-utils-9999: SIGSEGV signal with qkeyword
Summary: app-portage/portage-utils-9999: SIGSEGV signal with qkeyword
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Fabian Groffen
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2022-12-13 18:31 UTC by konsolebox
Modified: 2023-02-22 20:17 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description konsolebox 2022-12-13 18:31:43 UTC
Trying to know how qkeyword works I encountered a segmentation error:

# gdb --args qkeyword -p dev-util/geany -T
GNU gdb (Gentoo 11.2 vanilla) 11.2
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from qkeyword...
Reading symbols from /usr/lib/debug//usr/bin/q.debug...
(gdb) run
Starting program: /usr/bin/qkeyword -p dev-util/geany -T
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
decode_arch (arch=0x5555555b03f0 "amd64") at qkeyword.c:124
124		for (q = archlist, a = 0; *q != NULL; q++, a++) {
(gdb) quit

Using SeerGDB I found out archlist is still 0x0. `*q != NULL` might need to be changed to `q && *q`.  Add two `!= LULL`s if preferred to be pedantic.  Obviously some parts of the code might need to be changed too, or perhaps archlist needs to be made sure to be initialized to an array, or maybe simply initialized as "" instead.  I didn't study how other parts of the code works.

Also as a side note, isn't portage-utils a "Gentoo Hosted Projects"?  I don't see it in the selectable components so I'm reporting this in "Gentoo Linux" instead.

Maybe allow https://github.com/github/portage-utils to have issues to be reported there too.
Comment 1 konsolebox 2022-12-13 18:41:24 UTC
*https://github.com/gentoo/portage-utils

I like to know why the archlist is empty too.  Is it dependent on the package matches?  Or is it system config based.  If anyone has an idea, kindly tell, thank you.
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-12-13 18:49:50 UTC
Please run 'bt' in gdb as well and include its output.
Comment 3 konsolebox 2022-12-13 18:52:41 UTC
(gdb) bt
#0  decode_arch (arch=0x5555555b03f0 "amd64") at qkeyword.c:124
#1  0x00005555555675d4 in qkeyword_traverse (
    func=func@entry=0x555555566e09 <qkeyword_ltesting>, 
    priv=priv@entry=0x7fffffffd190) at qkeyword.c:795
#2  0x0000555555568698 in qkeyword_main (argc=<optimized out>, 
    argv=<optimized out>) at qkeyword.c:923
#3  0x00005555555605ca in q_main (argc=argc@entry=4, 
    argv=argv@entry=0x7fffffffe4e8) at q.c:116
#4  0x0000555555560218 in main (argc=4, argv=0x7fffffffe4e8) at main.c:1177
(gdb)
Comment 4 Fabian Groffen gentoo-dev 2022-12-15 09:12:59 UTC
I think qkeyword_load_arches is responsible for filling archlist.  It assumes it is set, which is a bit awkward since load_arches can just fail when profiles/arch.list isn't found in the tree in question.

Can you try commit 25853d2?

Thanks
Comment 5 Larry the Git Cow gentoo-dev 2022-12-15 09:13:05 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=25853d2ea35884a7f4cf6fefa2a2c53610fc6164

commit 25853d2ea35884a7f4cf6fefa2a2c53610fc6164
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2022-12-15 09:12:10 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2022-12-15 09:12:10 +0000

    qkeyword: gracefully handle case with no found arches
    
    Bug: https://bugs.gentoo.org/885801
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 qkeyword.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Comment 6 konsolebox 2022-12-15 10:12:39 UTC
Fabian Groffen: Looks like it was a problem on my side as well.  I wrongly set [gentoo] in a local repo config probably making qkeywords detect "gentoo" as local instead, making no arch.list detected.  The suggestion in the message to run `q -o` helped me realize it.  Anyway I no longer see segmentation issues and it seems to have fixed it, thanks.
Comment 7 Fabian Groffen gentoo-dev 2022-12-15 10:41:05 UTC
cool, a nice and informative message is always better than segfault :)

Thanks for testing!
Comment 8 Larry the Git Cow gentoo-dev 2023-02-22 20:17:19 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1fa248843038ffe79d7fce8b51e7f16c65667c7e

commit 1fa248843038ffe79d7fce8b51e7f16c65667c7e
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2023-02-22 20:15:43 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2023-02-22 20:17:16 +0000

    app-portage/portage-utils-0.95: version bump
    
    Closes: https://bugs.gentoo.org/893424
    Closes: https://bugs.gentoo.org/892533
    Closes: https://bugs.gentoo.org/885801
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 app-portage/portage-utils/Manifest                 |  2 +-
 .../portage-utils/portage-utils-0.94.1.ebuild      | 67 -------------------
 .../portage-utils/portage-utils-0.95.ebuild        | 75 ++++++++++++++++++++++
 3 files changed, 76 insertions(+), 68 deletions(-)