Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 684468 - app-portage/portage-utils-9999: q: unrecognized option '--reinitialize=/usr/portage'
Summary: app-portage/portage-utils-9999: q: unrecognized option '--reinitialize=/usr/p...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Third-Party Tools (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Fabian Groffen
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-27 07:53 UTC by Kent Fredric (IRC: kent\n) (RETIRED)
Modified: 2019-04-27 09:01 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 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2019-04-27 07:53:16 UTC
Commit: df503f922e4070fdbb5bbe4731f79b15709a5ade

 q --reinitialize=/usr/portage
q: unrecognized option '--reinitialize=/usr/portage'
Usage: q <applet> <args>  : invoke a portage utility applet

Currently defined applets:
        q <applet> <args> : virtual applet
    qatom <pkg>           : split atom strings
   qcache <action> <args> : search the metadata cache
   qcheck <pkgname>       : verify integrity of installed packages
 qdepends <pkgname>       : show dependency info
    qfile <filename>      : list all pkgs owning files
    qgrep <misc args>     : grep in ebuilds
    qlist <pkgname>       : list files owned by pkgname
     qlop <pkgname>       : emerge log analyzer
   qmerge <pkgnames>      : fetch and merge binary package
     qpkg <misc args>     : manipulate Gentoo binpkgs
  qsearch <regex>         : search pkgname/desc
    qsize <pkgname>       : calculate size usage
    qtbz2 <misc args>     : manipulate tbz2 packages
     quse <useflag>       : find pkgs using useflags
    qxpak <misc args>     : manipulate xpak archives
 qtegrity <misc args>     : verify files with IMA

Options: -[iM:vqChV]
  -i, --install       * Install symlinks for applets
  -M, --modpath <arg> * Module path
      --root <arg>    * Set the ROOT env var
  -v, --verbose       * Make a lot of noise
  -q, --quiet         * Tighter output; suppress warnings
  -C, --nocolor       * Don't output color
  -h, --help          * Print this help and exit
  -V, --version       * Print version and exit

/etc/portage/repo.postsync.d/q-reinit 

> 	q ${PORTAGE_QUIET:+-q} --reinitialize="${repository_path}"

qfile /etc/portage/repo.postsync.d/q-reinit
> *** buffer overflow detected ***: qfile terminated
> Aborted


....

 qlist portage-utils | grep reinit
/etc/portage/repo.postsync.d/q-reinit


( Backtrace for qfile buffer overflow: 

gdb --args qfile /etc/portage/repo.postsync.d/q-reinit

(gdb) run
Starting program: /usr/bin/qfile /etc/portage/repo.postsync.d/q-reinit
*** buffer overflow detected ***: /usr/bin/qfile terminated

Program received signal SIGABRT, Aborted.
0x00007ffff7bdbf3b in raise () from /lib64/libc.so.6
(gdb) thread apply all bt full

Thread 1 (process 20081):
#0  0x00007ffff7bdbf3b in raise () from /lib64/libc.so.6
No symbol table info available.
#1  0x00007ffff7bc5535 in abort () from /lib64/libc.so.6
No symbol table info available.
#2  0x00007ffff7c21c59 in __libc_message () from /lib64/libc.so.6
No symbol table info available.
#3  0x00007ffff7cbc765 in __fortify_fail_abort () from /lib64/libc.so.6
No symbol table info available.
#4  0x00007ffff7cbc7a1 in __fortify_fail () from /lib64/libc.so.6
No symbol table info available.
#5  0x00007ffff7cba8d0 in __chk_fail () from /lib64/libc.so.6
No symbol table info available.
#6  0x00007ffff7cbb00b in __realpath_chk () from /lib64/libc.so.6
No symbol table info available.
#7  0x0000555555562e65 in qfile_main ()
No symbol table info available.
#8  0x000055555555dcf8 in q_main ()
No symbol table info available.
#9  0x000055555555c52b in main ()
No symbol table info available.
Comment 1 Larry the Git Cow gentoo-dev 2019-04-27 08:33:44 UTC
The bug has been closed via the following commit(s):

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

commit f5e47a9148cdd26eaddca435d3f313c8ffbd1946
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2019-04-27 08:32:05 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2019-04-27 08:32:05 +0000

    buildsys: don't install q-reinit script anymore
    
    flat caches were removed, so were the options to generate them, no need
    to call and fail
    Thanks Kent Fredric
    
    Closes: https://bugs.gentoo.org/684468
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 Makefile.am            |   5 --
 Makefile.in            | 129 +++++++++++++++++--------------------------------
 repo.postsync/q-reinit |  10 ----
 3 files changed, 43 insertions(+), 101 deletions(-)
Comment 2 Fabian Groffen gentoo-dev 2019-04-27 08:52:55 UTC
I don't get it yet, without fortification (e.g. without -O2) it all works fine and valgrind is happy too.
Comment 3 Larry the Git Cow gentoo-dev 2019-04-27 09:01:57 UTC
The bug has been referenced in the following commit(s):

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

commit 0a3db7b186f0785d29c2c72c5ad6dbb93381ac35
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2019-04-27 09:00:05 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2019-04-27 09:00:05 +0000

    main.h: include limits.h for Linux PATH_MAX
    
    make PATH_MAX available, such that the logic can properly use it (again)
    
    This issue showed itself as a fortification error on Linux, because
    _Q_PATH_MAX was defined as less than PATH_MAX making realpath_chk fail.
    
    Bug: https://bugs.gentoo.org/684468
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 main.h | 1 +
 1 file changed, 1 insertion(+)