]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/aptconfiguration.cc
fix lzma-support detection via xz binary
[apt.git] / apt-pkg / aptconfiguration.cc
index e32e553a424ad34cb65f50a58148269e25f7c957..115d116168a5e7986c341e402e603c5aac230ae1 100644 (file)
@@ -392,7 +392,7 @@ std::vector<std::string> const Configuration::getArchitectures(bool const &Cache
                        dup2(nullfd, STDIN_FILENO);
                        dup2(external[1], STDOUT_FILENO);
                        dup2(nullfd, STDERR_FILENO);
-                       if (chrootDir != "/" && chroot(chrootDir.c_str()) != 0)
+                       if (chrootDir != "/" && chroot(chrootDir.c_str()) != 0 && chdir("/") != 0)
                                _error->WarningE("getArchitecture", "Couldn't chroot into %s for dpkg --print-foreign-architectures", chrootDir.c_str());
                        execvp(Args[0], (char**) &Args[0]);
                        _error->WarningE("getArchitecture", "Can't detect foreign architectures supported by dpkg!");
@@ -453,7 +453,7 @@ void Configuration::setDefaultConfigurationForCompressors() {
        _config->CndSet("Dir::Bin::bzip2", "/bin/bzip2");
        _config->CndSet("Dir::Bin::xz", "/usr/bin/xz");
        if (FileExists(_config->FindFile("Dir::Bin::xz")) == true) {
-               _config->Clear("Dir::Bin::lzma");
+               _config->Set("Dir::Bin::lzma", _config->FindFile("Dir::Bin::xz"));
                _config->Set("APT::Compressor::lzma::Binary", "xz");
                if (_config->Exists("APT::Compressor::lzma::CompressArg") == false) {
                        _config->Set("APT::Compressor::lzma::CompressArg::", "--format=lzma");