summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog2
-rw-r--r--po/python-apt.pot2
-rw-r--r--python/apt_instmodule.cc13
-rw-r--r--tests/test_extract_archive.py10
4 files changed, 23 insertions, 4 deletions
diff --git a/debian/changelog b/debian/changelog
index 1afcb16e..8cac6ae2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,8 @@ python-apt (0.7.7.2) UNRELEASED; urgency=low
- fix GetCandidateVer() reporting incorrect versions after
SetCandidateVer() was used. Thanks to Julian Andres Klode for
the test-case (LP: #237372)
+ * python/apt_instmodule.cc:
+ - do not change working dir in debExtractArchive() (LP: #184093)
* apt/cache.py:
- support "in" in apt.Cache() (LP: #251587)
diff --git a/po/python-apt.pot b/po/python-apt.pot
index 20905fdf..7e731689 100644
--- a/po/python-apt.pot
+++ b/po/python-apt.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-07-31 11:40+0200\n"
+"POT-Creation-Date: 2008-07-31 12:00+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/python/apt_instmodule.cc b/python/apt_instmodule.cc
index 43d5e7f7..6e6c89dd 100644
--- a/python/apt_instmodule.cc
+++ b/python/apt_instmodule.cc
@@ -74,6 +74,7 @@ static char *doc_debExtractArchive =
static PyObject *debExtractArchive(PyObject *Self,PyObject *Args)
{
char *Rootdir = NULL;
+ char cwd[512];
PyObject *File;
if (PyArg_ParseTuple(Args,"O!|s",&PyFile_Type,&File,&Rootdir) == 0)
return 0;
@@ -83,21 +84,27 @@ static PyObject *debExtractArchive(PyObject *Self,PyObject *Args)
{
if(Rootdir != NULL)
{
+ getcwd(cwd, sizeof(cwd));
chdir(Rootdir);
}
// Open the file and associate the .deb
FileFd Fd(fileno(PyFile_AsFile(File)),false);
debDebFile Deb(Fd);
- if (_error->PendingError() == true)
- return HandleErrors();
+ if (_error->PendingError() == true) {
+ if (cwd != NULL)
+ chdir (cwd);
+ return HandleErrors(Py_BuildValue("b",false));
+ }
// extracts relative to the current dir
pkgDirStream Extract;
res = Deb.ExtractArchive(Extract);
+ if (cwd != NULL)
+ chdir (cwd);
if (res == false)
- return HandleErrors();
+ return HandleErrors(Py_BuildValue("b",res));
}
return HandleErrors(Py_BuildValue("b",res));
}
diff --git a/tests/test_extract_archive.py b/tests/test_extract_archive.py
new file mode 100644
index 00000000..ce202b06
--- /dev/null
+++ b/tests/test_extract_archive.py
@@ -0,0 +1,10 @@
+#!/usr/bin/python
+
+import apt
+import apt_inst
+import os
+import sys
+
+print os.getcwd()
+apt_inst.debExtractArchive(open(sys.argv[1]), "/tmp/")
+print os.getcwd()