FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 11-13-2009, 02:58 PM
Nagy Gabor
 
Default Print error on duplicated database entries

Some users reported duplicated database entries in /var/lib/pacman/local/,
for example, both foo-1.0-1 and foo-2.0-1 subdirectories existed. (Bogus
3rd-party scripts, backup?) In this case pacman reported no error and its
behaviour was mysterious.

>From now on, pacman detects this situation and prints an error message.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
---
lib/libalpm/be_files.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c
index ffbaa8d..feb71f8 100644
--- a/lib/libalpm/be_files.c
+++ b/lib/libalpm/be_files.c
@@ -348,6 +348,13 @@ int _alpm_db_populate(pmdb_t *db)
continue;
}

+ /* duplicated database entries are not allowed */
+ if(_alpm_pkg_find(db->pkgcache, pkg->name)) {
+ _alpm_log(PM_LOG_ERROR, _("duplicated database entry '%s'
"), pkg->name);
+ _alpm_pkg_free(pkg);
+ continue;
+ }
+
/* explicitly read with only 'BASE' data, accessors will handle the rest */
if(_alpm_db_read(db, pkg, INFRQ_BASE) == -1) {
_alpm_log(PM_LOG_ERROR, _("corrupted database entry '%s'
"), name);
--
1.6.5.2
 
Old 11-14-2009, 04:33 AM
Allan McRae
 
Default Print error on duplicated database entries

Nagy Gabor wrote:

Some users reported duplicated database entries in /var/lib/pacman/local/,
for example, both foo-1.0-1 and foo-2.0-1 subdirectories existed. (Bogus
3rd-party scripts, backup?) In this case pacman reported no error and its
behaviour was mysterious.


From now on, pacman detects this situation and prints an error message.


Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
---


Looks good to me. I have seen this on the forums a couple of times on
the forums and it is very confusing to diagnose what the problem is.


Allan
 
Old 11-14-2009, 05:04 AM
Dan McGee
 
Default Print error on duplicated database entries

On Fri, Nov 13, 2009 at 11:33 PM, Allan McRae <allan@archlinux.org> wrote:
> Nagy Gabor wrote:
>>
>> Some users reported duplicated database entries in /var/lib/pacman/local/,
>> for example, both foo-1.0-1 and foo-2.0-1 subdirectories existed. (Bogus
>> 3rd-party scripts, backup?) In this case pacman reported no error and its
>> behaviour was mysterious.
>>
>>> From now on, pacman detects this situation and prints an error message.
>>
>> Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
>> ---
>
> Looks good to me. *I have seen this on the forums a couple of times on the
> forums and it is very confusing to diagnose what the problem is.

How does `testdb` come into play here?

-Dan
 
Old 11-14-2009, 05:17 AM
Allan McRae
 
Default Print error on duplicated database entries

Dan McGee wrote:

On Fri, Nov 13, 2009 at 11:33 PM, Allan McRae <allan@archlinux.org> wrote:

Nagy Gabor wrote:

Some users reported duplicated database entries in /var/lib/pacman/local/,
for example, both foo-1.0-1 and foo-2.0-1 subdirectories existed. (Bogus
3rd-party scripts, backup?) In this case pacman reported no error and its
behaviour was mysterious.


From now on, pacman detects this situation and prints an error message.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
---

Looks good to me. I have seen this on the forums a couple of times on the
forums and it is very confusing to diagnose what the problem is.


How does `testdb` come into play here?


I just created a fake duplicate db entry and ran testdb but it gave no
output.


Allan
 
Old 11-14-2009, 08:45 AM
Nagy Gabor
 
Default Print error on duplicated database entries

> Dan McGee wrote:
> > On Fri, Nov 13, 2009 at 11:33 PM, Allan McRae <allan@archlinux.org> wrote:
> >> Nagy Gabor wrote:
> >>> Some users reported duplicated database entries in /var/lib/pacman/local/,
> >>> for example, both foo-1.0-1 and foo-2.0-1 subdirectories existed. (Bogus
> >>> 3rd-party scripts, backup?) In this case pacman reported no error and its
> >>> behaviour was mysterious.
> >>>
> >>>> From now on, pacman detects this situation and prints an error message.
> >>> Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
> >>> ---
> >> Looks good to me. I have seen this on the forums a couple of times on the
> >> forums and it is very confusing to diagnose what the problem is.
> >
> > How does `testdb` come into play here?
>
> I just created a fake duplicate db entry and ran testdb but it gave no
> output.

With the patch, testdb just prints the error (when loading pkgcache),
but the retval is 0. If _alpm_db_populate() returned with -1, then
testdb would catch the error (and pacman would exit). First I wanted to
choose this strict behaviour (duplicated entries => error, exit), but I
saw that we never do that atm (with broken entries, etc.) and I was a
bit unsure about sync repos (hm, maybe we should print the repo name in
the error message...): Iirc pacman always loaded sync repos' pkgcache
earlier, so a bogus sync repo would have made pacman disfunctional
(including -Sy), and we have different GUIs.

If we prefer the strict behaviour, I will resubmit the patch.

Bye
 

Thread Tools




All times are GMT. The time now is 10:02 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org