[pacman-dev] [patch]Bug in cache.c
Hi! I think that this is a bug but accidentally works because the name entry is the first member of pmgrp_t. --- cache.c.old 2007-03-09 21:21:29.000000000 +0100 +++ cache.c 2007-03-09 21:21:15.000000000 +0100 @@ -214,7 +214,7 @@ /* gross signature forces us to * discard const */ (void *)alpm_pkg_get_name(pkg), - _alpm_grp_cmp); + strcmp); db->grpcache = alpm_list_add_sorted(db->grpcache, grp, _alpm_grp_cmp); } else { alpm_list_t *j; @@ -225,7 +225,7 @@ if(strcmp(grp->name, i->data) == 0) { const char *pkgname = alpm_pkg_get_name(pkg); if(!alpm_list_find_str(grp->packages, pkgname)) { - grp->packages = alpm_list_add_sorted(grp->packages, (void *)pkgname, _alpm_grp_cmp); + grp->packages = alpm_list_add_sorted(grp->packages, (void *)pkgname, strcmp); } } }
2007/3/9, Nagy Gabor <ngaba@petra.hos.u-szeged.hu>:
Hi! I think that this is a bug but accidentally works because the name entry is the first member of pmgrp_t.
--- cache.c.old 2007-03-09 21:21:29.000000000 +0100 +++ cache.c 2007-03-09 21:21:15.000000000 +0100 @@ -214,7 +214,7 @@ /* gross signature forces us to * discard const */ (void *)alpm_pkg_get_name(pkg), - _alpm_grp_cmp); + strcmp); db->grpcache = alpm_list_add_sorted(db->grpcache, grp, _alpm_grp_cmp); } else { alpm_list_t *j; @@ -225,7 +225,7 @@ if(strcmp(grp->name, i->data) == 0) { const char *pkgname = alpm_pkg_get_name(pkg); if(!alpm_list_find_str(grp->packages, pkgname)) { - grp->packages = alpm_list_add_sorted(grp->packages, (void *)pkgname, _alpm_grp_cmp); + grp->packages = alpm_list_add_sorted(grp->packages, (void *)pkgname, strcmp); } } }
Your patch is corrupted, it contains leading spaces in few lines on top. -- Roman Kyrylych (Роман Кирилич)
I don't understand, it works for me
2007/3/9, Roman Kyrylych <roman.kyrylych@gmail.com>:
2007/3/9, Nagy Gabor <ngaba@petra.hos.u-szeged.hu>:
Hi! I think that this is a bug but accidentally works because the name entry is the first member of pmgrp_t.
--- cache.c.old 2007-03-09 21:21:29.000000000 +0100 +++ cache.c 2007-03-09 21:21:15.000000000 +0100 @@ -214,7 +214,7 @@ /* gross signature forces us to * discard const */ (void *)alpm_pkg_get_name(pkg), - _alpm_grp_cmp); + strcmp); db->grpcache = alpm_list_add_sorted(db->grpcache, grp, _alpm_grp_cmp); } else { alpm_list_t *j; @@ -225,7 +225,7 @@ if(strcmp(grp->name, i->data) == 0) { const char *pkgname = alpm_pkg_get_name(pkg); if(!alpm_list_find_str(grp->packages, pkgname)) { - grp->packages = alpm_list_add_sorted(grp->packages, (void *)pkgname, _alpm_grp_cmp); + grp->packages = alpm_list_add_sorted(grp->packages, (void *)pkgname, strcmp); } } }
Your patch is corrupted, it contains leading spaces in few lines on top.
Sorry, that's a glitch in cache.c on lines 214-217. Can someone fix this? (I'm on windoze now and cannot provide a patch) -- Roman Kyrylych (Роман Кирилич)
On Fri, Mar 09, 2007 at 09:30:28PM +0100, Nagy Gabor wrote:
Hi! I think that this is a bug but accidentally works because the name entry is the first member of pmgrp_t.
Thanks. Fixed in CVS. Jürgen
On 3/9/07, Jürgen Hötzel <juergen@hoetzel.info> wrote:
On Fri, Mar 09, 2007 at 09:30:28PM +0100, Nagy Gabor wrote:
Hi! I think that this is a bug but accidentally works because the name entry is the first member of pmgrp_t.
Thanks. Fixed in CVS.
This is a bug, but the seemingly easy fix causes compilation to spew warnings. This actually breaks compilation when --enable-debug is passed to configure because of casting issues. I've replaced it locally with _alpm_str_cmp which removes this error on compilation. -Dan
participants (4)
-
Dan McGee
-
Jürgen Hötzel
-
Nagy Gabor
-
Roman Kyrylych