summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-05-19 17:17:32 -0500
committerDan McGee <dan@archlinux.org>2011-05-19 17:17:32 -0500
commit11fb9c767450dc193bbeef755c228aa620df75d9 (patch)
tree9f47a77d27b39ee7ddef40edba7bed3016d3ba08
parent70cf4546d6d35ef9ef2751f37853cde679c88aa7 (diff)
parentf2c4e7e55220addef0581d1c38cc7363b5a0884c (diff)
downloadpacman-11fb9c767450dc193bbeef755c228aa620df75d9.tar.xz
Merge branch 'maint'
Conflicts: lib/libalpm/trans.c src/pacman/query.c
-rw-r--r--lib/libalpm/remove.c2
-rw-r--r--lib/libalpm/trans.c19
-rw-r--r--po/fi.po15
-rw-r--r--src/pacman/pacman.c5
-rw-r--r--src/pacman/query.c4
-rwxr-xr-xtest/pacman/pmpkg.py2
-rwxr-xr-xtest/pacman/pmrule.py8
-rw-r--r--test/pacman/tests/symlink002.py43
-rwxr-xr-xtest/pacman/util.py6
9 files changed, 80 insertions, 24 deletions
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index cf416d52..2d840ceb 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -265,7 +265,7 @@ static void unlink_file(pmpkg_t *info, char *filename, alpm_list_t *skip_remove,
FREE(pkghash);
} else {
char *filehash = alpm_compute_md5sum(file);
- int cmp = strcmp(filehash,pkghash);
+ int cmp = filehash ? strcmp(filehash, pkghash) : 0;
FREE(filehash);
FREE(pkghash);
if(cmp != 0) {
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 4e88668b..af1bccee 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -116,15 +116,6 @@ int SYMEXPORT alpm_trans_init(pmtransflag_t flags,
}
}
- /* check database version */
- db_version = _alpm_db_version(handle->db_local);
- if(db_version < required_db_version) {
- _alpm_log(PM_LOG_ERROR,
- _("%s database version is too old\n"), handle->db_local->treename);
- remove_lock(handle);
- RET_ERR(PM_ERR_DB_VERSION, -1);
- }
-
trans = _alpm_trans_new();
if(trans == NULL) {
RET_ERR(PM_ERR_MEMORY, -1);
@@ -138,6 +129,16 @@ int SYMEXPORT alpm_trans_init(pmtransflag_t flags,
handle->trans = trans;
+ /* check database version */
+ db_version = _alpm_db_version(handle->db_local);
+ if(db_version < required_db_version) {
+ _alpm_log(PM_LOG_ERROR,
+ _("%s database version is too old\n"), handle->db_local->treename);
+ remove_lock(handle);
+ _alpm_trans_free(trans);
+ RET_ERR(PM_ERR_DB_VERSION, -1);
+ }
+
return 0;
}
diff --git a/po/fi.po b/po/fi.po
index 3f32cbd4..5881f51e 100644
--- a/po/fi.po
+++ b/po/fi.po
@@ -8,9 +8,10 @@ msgstr ""
"Project-Id-Version: Arch Linux Pacman package manager\n"
"Report-Msgid-Bugs-To: http://bugs.archlinux.org/index.php?project=3\n"
"POT-Creation-Date: 2011-04-18 11:23-0500\n"
-"PO-Revision-Date: 2011-04-15 17:59+0000\n"
-"Last-Translator: apuasi <kaannokset.hellberg@gmail.com>\n"
-"Language-Team: Finnish <None>\n"
+"PO-Revision-Date: 2011-05-11 14:51+0000\n"
+"Last-Translator: Larso <larso@gmx.com>\n"
+"Language-Team: Finnish (http://www.transifex.net/projects/p/archlinux-pacman/"
+"team/fi/)\n"
"Language: fi\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -349,7 +350,7 @@ msgstr " -c, --cascade poista paketit ja kaikki niiden riippuvuudet\n"
#, c-format
msgid " -n, --nosave remove configuration files\n"
-msgstr ""
+msgstr " -n, --nosave poista myös asetustiedostot\n"
#, c-format
msgid ""
@@ -359,7 +360,7 @@ msgstr ""
#, c-format
msgid " -u, --unneeded remove unneeded packages\n"
-msgstr ""
+msgstr " -u, --unneeded poista tarpeettomat paketit\n"
#, c-format
msgid " -c, --changelog view the changelog of a package\n"
@@ -550,7 +551,7 @@ msgstr ""
msgid ""
" --print print the targets instead of performing the "
"operation\n"
-msgstr ""
+msgstr " --print listaa paketit, mutta älä suorita operaatiota\n"
#, c-format
msgid ""
@@ -950,7 +951,7 @@ msgstr "paketti %s ei ole kelvollinen tai se on vahingoittunut\n"
#, c-format
msgid "Errors occurred, no packages were upgraded.\n"
-msgstr "Yhtään pakettia ei ole päivitetty tapahtuneiden virheiden vuoksi.\n"
+msgstr "Yhtään pakettia ei päivitetty tapahtuneiden virheiden vuoksi.\n"
#, c-format
msgid ":: Synchronizing package databases...\n"
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 1a6e3eb4..008a8066 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -732,8 +732,9 @@ static void cl_to_log(int argc, char* argv[])
size += strlen(argv[i]) + 1;
}
char *cl_text = malloc(size);
- if(!cl_text)
+ if(!cl_text) {
return;
+ }
char *p = cl_text;
for(i = 0; i<argc-1; i++) {
strcpy(p, argv[i]);
@@ -884,7 +885,7 @@ int main(int argc, char *argv[])
}
/* set up the print operations */
- if(config->print) {
+ if(config->print && !config->op_s_clean) {
config->noconfirm = 1;
config->flags |= PM_TRANS_FLAG_NOCONFLICTS;
config->flags |= PM_TRANS_FLAG_NOLOCK;
diff --git a/src/pacman/query.c b/src/pacman/query.c
index 5ca52c38..d1105b4a 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -77,6 +77,10 @@ static int search_path(char **filename, struct stat *bufptr)
}
fullname = malloc(plen + flen + 2);
+ if(!fullname) {
+ free(envpath);
+ return(-1);
+ }
sprintf(fullname, "%s/%s", path, *filename);
if(lstat(fullname, bufptr) == 0) {
diff --git a/test/pacman/pmpkg.py b/test/pacman/pmpkg.py
index 59204265..42573428 100755
--- a/test/pacman/pmpkg.py
+++ b/test/pacman/pmpkg.py
@@ -103,7 +103,7 @@ class pmpkg(object):
# Generate package file system
for f in self.files:
util.mkfile(f, f)
- self.size += os.stat(util.getfilename(f))[stat.ST_SIZE]
+ self.size += os.lstat(util.getfilename(f))[stat.ST_SIZE]
# .PKGINFO
data = ["pkgname = %s" % self.name]
diff --git a/test/pacman/pmrule.py b/test/pacman/pmrule.py
index c68d085e..0f6ae602 100755
--- a/test/pacman/pmrule.py
+++ b/test/pacman/pmrule.py
@@ -146,6 +146,14 @@ class pmrule(object):
else:
print "FILE rule '%s' not found" % case
success = -1
+ elif kind == "LINK":
+ filename = os.path.join(test.root, key)
+ if case == "EXIST":
+ if not os.path.islink(filename):
+ success = 0
+ else:
+ print "LINK rule '%s' not found" % case
+ success = -1
elif kind == "CACHE":
cachedir = os.path.join(test.root, util.PM_CACHEDIR)
if case == "EXISTS":
diff --git a/test/pacman/tests/symlink002.py b/test/pacman/tests/symlink002.py
new file mode 100644
index 00000000..6b7423d9
--- /dev/null
+++ b/test/pacman/tests/symlink002.py
@@ -0,0 +1,43 @@
+self.description = "Dead backed-up symlink when removing package (FS#24230)"
+
+# symlink file is changed
+lp = pmpkg("dummy")
+lp.files = ["etc/brokenlink -> nonexistent",
+ "etc/exists"]
+lp.backup = ["etc/brokenlink*"]
+self.addpkg2db("local", lp)
+
+# symlink file is not changed
+lp2 = pmpkg("dummy2")
+lp2.files = ["etc/brokenlink2 -> nonexistent2",
+ "etc/exists2"]
+lp2.backup = ["etc/brokenlink2"]
+self.addpkg2db("local", lp2)
+
+# package is left alone, not uninstalled
+lp3 = pmpkg("dummy3")
+lp3.files = ["etc/brokenlink3 -> nonexistent3",
+ "etc/exists3"]
+self.addpkg2db("local", lp3)
+
+self.args = "-R %s %s" % (lp.name, lp2.name)
+#self.args = "-R"
+
+self.addrule("PACMAN_RETCODE=0")
+
+self.addrule("!PKG_EXIST=dummy")
+self.addrule("!LINK_EXIST=etc/brokenlink")
+self.addrule("!FILE_EXIST=etc/nonexistent")
+self.addrule("!FILE_EXIST=etc/exists")
+
+self.addrule("!PKG_EXIST=dummy2")
+self.addrule("!LINK_EXIST=etc/brokenlink2")
+self.addrule("!FILE_EXIST=etc/nonexistent2")
+self.addrule("!FILE_EXIST=etc/exists2")
+
+self.addrule("PKG_EXIST=dummy3")
+self.addrule("LINK_EXIST=etc/brokenlink3")
+self.addrule("!FILE_EXIST=etc/nonexistent")
+self.addrule("FILE_EXIST=etc/exists3")
+self.addrule("FILE_TYPE=etc/brokenlink3|link")
+self.addrule("FILE_TYPE=etc/exists3|file")
diff --git a/test/pacman/util.py b/test/pacman/util.py
index 47255923..ddd955a2 100755
--- a/test/pacman/util.py
+++ b/test/pacman/util.py
@@ -150,7 +150,6 @@ def getmd5sum(filename):
"""
"""
if not os.path.isfile(filename):
- print "file %s does not exist!" % filename
return ""
fd = open(filename, "rb")
checksum = hashlib.md5()
@@ -178,9 +177,8 @@ def getmtime(filename):
"""
"""
if not os.path.exists(filename):
- print "path %s does not exist!" % filename
- return 0, 0, 0
- st = os.stat(filename)
+ return None, None, None
+ st = os.lstat(filename)
return st[stat.ST_ATIME], st[stat.ST_MTIME], st[stat.ST_CTIME]
#