From a2cd48960e33043f75c81e0ecbc2d33b20b695fe Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Tue, 8 Sep 2009 00:45:56 +0200 Subject: Fix a memleak involving lazy DB loading Lazy opening of databases is supported since 34e1413d75. We don't need that setlibpath call each time we register a database. Besides this caused a memleak in case setlibpath failed, because setlibpath exit directly and we did not do the cleanup part (section string was not freed, and a file descriptor remained open). Signed-off-by: Xavier Chantry Signed-off-by: Dan McGee --- src/pacman/pacman.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 77c558d1..92aa4954 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -749,11 +749,8 @@ static int _parseconfig(const char *file, const char *givensection, ret = 1; goto cleanup; } - /* if we are not looking at the options section, register a db and also - * ensure we have set all of our library paths as the library is too stupid - * at the moment to do lazy opening of the databases */ + /* if we are not looking at the options section, register a db */ if(strcmp(section, "options") != 0) { - setlibpaths(); db = alpm_db_register_sync(section); if(db == NULL) { pm_printf(PM_LOG_ERROR, _("could not register '%s' database (%s)\n"), -- cgit v1.2.3-24-g4f1b From bc24c002fedc9a554c1fd6a9650f548ee55bd49c Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 14 Sep 2009 22:06:28 -0500 Subject: Revert "Fix a memleak involving lazy DB loading" This doesn't quite work, as can be seen by the pactest results: Total = 179 Pass = 108 ( 60.34%) Expected Fail = 5 ( 2.79%) Unexpected Pass = 0 ( 0.00%) Fail = 66 ( 36.87%) If you peek inside '_alpm_db_new' when it gets called for the sync databases, the base dbpath is still at the default value, causing things like pactest to fail miserably. We need some further work to do fully lazy loading, and that belongs on master, not maint. This reverts commit a2cd48960e33043f75c81e0ecbc2d33b20b695fe. Signed-off-by: Dan McGee --- src/pacman/pacman.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 92aa4954..77c558d1 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -749,8 +749,11 @@ static int _parseconfig(const char *file, const char *givensection, ret = 1; goto cleanup; } - /* if we are not looking at the options section, register a db */ + /* if we are not looking at the options section, register a db and also + * ensure we have set all of our library paths as the library is too stupid + * at the moment to do lazy opening of the databases */ if(strcmp(section, "options") != 0) { + setlibpaths(); db = alpm_db_register_sync(section); if(db == NULL) { pm_printf(PM_LOG_ERROR, _("could not register '%s' database (%s)\n"), -- cgit v1.2.3-24-g4f1b From d0d6c58c0579ec4d6ada9a9f91acc93215ca2773 Mon Sep 17 00:00:00 2001 From: Nagy Gabor Date: Sat, 12 Sep 2009 22:47:27 +0200 Subject: Add makepkgopt to be_package.c After commit 774c252 the --debug output shows 5-6 "syntax error..." lines for each package. After this patch pacman recognizes makepkgopt as a valid key, but doesn't do anything. Signed-off-by: Nagy Gabor Signed-off-by: Dan McGee --- lib/libalpm/be_package.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index fef4b469..9c7c1617 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -112,6 +112,8 @@ static int parse_descfile(struct archive *a, pmpkg_t *newpkg) newpkg->provides = alpm_list_add(newpkg->provides, strdup(ptr)); } else if(!strcmp(key, "backup")) { newpkg->backup = alpm_list_add(newpkg->backup, strdup(ptr)); + } else if(!strcmp(key, "makepkgopt")) { + /* not used atm */ } else { _alpm_log(PM_LOG_DEBUG, "%s: syntax error in description file line %d\n", newpkg->name ? newpkg->name : "error", linenum); -- cgit v1.2.3-24-g4f1b