poldek make indexes crash for subpackage without Group

Bug #1077603 reported by Elan Ruusamäe
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
poldek
Confirmed
Undecided
Cactus

Bug Description

http://ep09.pld-linux.org/~pldth/jsoncpp-devel-0.6.0-0.1.20120626svn249.x86_64.rpm

save it to empty dir and execute:

poldek -s . --mkidxz --mkidx-type pndir

Starting program: /usr/bin/poldek -s . --mkidxz --mkidx-type pndir
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Missing separate debuginfo for /usr/lib64/libustr-1.0.so.1
Try to install package that provides `/usr/lib/debug/.build-id/bb/fbb3e19f7477c8cb5c25ddc7f66c5b4ef10bca.debug' file
Creating pndir index of /home/pld/admins/th/poldek-crash/ (type=dir)...
Loading [dir]/home/pld/admins/th/poldek-crash/...

Program received signal SIGSEGV, Segmentation fault.
n_hash_dohash (ht=ht@entry=0x6649d0, s=s@entry=0x656972617262694c <Address 0x656972617262694c out of bounds>, slen=slen@entry=0x7fffffffab5c)
    at n_hash_new.c:81
81 while (*s) {
(gdb) bt
#0 n_hash_dohash (ht=ht@entry=0x6649d0, s=s@entry=0x656972617262694c <Address 0x656972617262694c out of bounds>,
    slen=slen@entry=0x7fffffffab5c) at n_hash_new.c:81
#1 0x00002aaaab17e839 in n_hash_get_ex (ht=0x6649d0, key=0x656972617262694c <Address 0x656972617262694c out of bounds>,
    klen=klen@entry=0x7fffffffab5c, khash=khash@entry=0x7fffffffab58) at n_hash_get.c:44
#2 0x00002aaaab17e893 in n_hash_get (ht=<optimized out>, key=<optimized out>) at n_hash_get.c:55
#3 0x00002aaaaaf20e4a in pkgroup_idx_update_rpmhdr (idx=idx@entry=0x664bf0, rpmhdr=<optimized out>) at pkgroup.c:477
#4 0x00002aaaaaf3a37d in load_dir (pkgdir=0x669d50, dirpath=0x65a7d0 "/home/pld/admins/th/poldek-crash/", pkgs=0x664710, pkgroups=0x664bf0,
    ldflags=2870431336, prev_pkgdir=0x0, na=0x6697e0) at dir.c:265
#5 0x00002aaaaaf3a4fa in do_load (pkgdir=<optimized out>, ldflags=<optimized out>) at dir.c:322
#6 0x00002aaaaaf33675 in pkgdir_load (pkgdir=pkgdir@entry=0x669d50, depdirs=depdirs@entry=0x0, ldflags=ldflags@entry=0) at pkgdir.c:637
#7 0x00002aaaaaf3107c in load_pkgdir (src=src@entry=0x65ac10, type=type@entry=0x6638a0 "pndir",
    idxpath=idxpath@entry=0x7fffffffbe20 "/home/pld/admins/th/poldek-crash/packages.ndir.gz", with_prev=with_prev@entry=1)
    at source_mkidx.c:112
#8 0x00002aaaaaf31549 in do_makeidx (src=src@entry=0x65ac10, type=type@entry=0x6638a0 "pndir",
    idxpath=0x7fffffffbe20 "/home/pld/admins/th/poldek-crash/packages.ndir.gz", idxpath@entry=0x0, cr_flags=cr_flags@entry=256,
    kw=kw@entry=0x61cd90) at source_mkidx.c:164
#9 0x00002aaaaaf31ab1 in source_make_idx (src=src@entry=0x61cf10, stype=0x2aaaaaf60eaa "dir", stype@entry=0x0,
    dtype=dtype@entry=0x6638a0 "pndir", idxpath=idxpath@entry=0x0, flags=flags@entry=256, kw=kw@entry=0x61cd90) at source_mkidx.c:261
#10 0x00002aaaaacdf483 in make_idx (arg_s=<optimized out>) at op_makeidx.c:399
#11 oprun (rt=<optimized out>) at op_makeidx.c:433
#12 0x0000000000404893 in do_run () at main.c:505
#13 0x00000000004027c5 in main (argc=6, argv=0x7fffffffd168) at main.c:699
(gdb)

Revision history for this message
Elan Ruusamäe (glen666) wrote :

when looking rpm -qp --yaml dump of package without Group in subpackage and rebuild when subpackage has own group, they both have group present, slightly different:

- Group: Libraries
+ Group: Development/Libraries

so, original package that makes poldek crash:
http://git.pld-linux.org/?p=packages/jsoncpp.git;a=shortlog;h=refs/tags/auto/th/jsoncpp-0.6.0-0.1.20120626svn249

and package with filled Group to subpackage:
http://git.pld-linux.org/?p=packages/jsoncpp.git;a=shortlog;h=refs/tags/auto/th/jsoncpp-0.6.0-0.2.20120626svn249

Revision history for this message
Elan Ruusamäe (glen666) wrote :

could this bug importance be risen?

if such package gets sent to pld builders, it's pretty troublesome to find which package broke builders. and it needs someone with full access to infrastructure to fix.

Revision history for this message
Cactus (uzi18) wrote :

rpm version 5.x and/or 4.x?

Revision history for this message
Jeff Johnson (n3npq) wrote :

There are no rpmlib symbols from either rpm 5.x or rpm 4.x in that traceback.

Revision history for this message
Cactus (uzi18) wrote :

rpmlib returns uninitialized string here, thats why.

Revision history for this message
Jeff Johnson (n3npq) wrote :

This is not an uninitialized string, a NULL pointer for a non-existent tag
iwhich isn't being checked for in poldek.

But that is a developer's guess: if you *REALLY* think uninitialized
string rather than a NULL pointer, then either examine variables
with gdb (or easier/better: run under valgrind).

Yes the Group: tag is optional @rpm5.org: previously Group: was mandatory, and
inheirited into subpkgs (iirc: this is all from memory).

poldek needs to be fixed to check return codes and also validate pointers != NULL.

The quickest/dirtiest fix is to use strdup("Unknown") to assign a Group: tag
value that wasn't in a header (or in specspo lookaside or other retrievals).

You can also patch rpm to make Group: tag mandatory again again again.

Revision history for this message
Cactus (uzi18) wrote :

Glen please check this patch, on good and bad rpms.

Revision history for this message
Elan Ruusamäe (glen666) wrote : Re: [Bug 1077603] Re: poldek make indexes crash for subpackage without Group

On 28/12/12 00:11, Cactus wrote:
> Glen please check this patch, on good and bad rpms.
>
>
> ** Patch added: "poldek-nogroup.patch"
> https://bugs.launchpad.net/poldek/+bug/1077603/+attachment/3469300/+files/poldek-nogroup.patch
>
the test data is included in bug report (rpm and commands to test). if
these pass. consider it fixed

--
glen

Cactus (uzi18)
Changed in poldek:
assignee: nobody → Cactus (uzi18)
status: New → In Progress
status: In Progress → Fix Committed
Revision history for this message
Marcin Banasiak (megabajt) wrote :

Unfortunately, it looks like provided patch breaks group for all the other packages that have filled Group tag.

poldek:/th-test> ls -G -t
package group
libcmis-0.3.1-1.i686 hKt
libcmis-devel-0.3.1-1.i686 ��u
libcmis-static-0.3.1-1.i686 H�w
libcmis-tools-0.3.1-1.i686 ��w
gpgme-1.4.0-1.i686 8P{
gpgme-devel-1.4.0-1.i686 �.{
gpgme-static-1.4.0-1.i686 �{
fckeditor-2.6.3-1.noarch 8�g
fckeditor-connector-perl-2.6.3-1.noarch ��g
fckeditor-connector-php-2.6.3-1.noarch ��g
fckeditor-connector-python-2.6.3-1.noarch h
fckeditor-debuginfo-2.6.3-1.noarch 8�g
xorg-xserver-Xdmx-1.14.0-1.i686 �p
xorg-xserver-Xephyr-1.14.0-1.i686 � q
[...]

Changed in poldek:
status: Fix Committed → Confirmed
Revision history for this message
Elan Ruusamäe (glen666) wrote :

also, the src.rpm groups get weirdly formatted:

$ rpm -qpi ruby-1.9.3.194-5.src.rpm|head|less
Name : ruby Relocations: (not relocatable)
Version : 1.9.3.194 Vendor: PLD
Release : 5 Build Date: T 13 nov 2012 15:38:09 EET
Install Date: (not installed) Build Host: ep09-pld
Group : <EC><C7>^G^HDevelopment/Languages Source RPM: (none)
Size : 53535121 License: The Ruby License
Signature : DSA/SHA1, E 19 nov 2012 15:42:32 EET, Key ID af3f93bce4f1bc2d
Packager : PLD bug tracking system ( http://bugs.pld-linux.org/ )
URL : http://www.ruby-lang.org/
Summary : (none)
(END)

now looking closer, this src.rpm is weird other ways too that Summary is NULL

rpm-5.4.10-45.x86_64

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.