[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#808383: marked as done (apt: fix FileUtlTest.GetTempDir failure when run as root)



Your message dated Thu, 24 Dec 2015 22:24:16 +0000
with message-id <E1aCEIy-0005t6-Jm@franck.debian.org>
and subject line Bug#808383: fixed in apt 1.1.6
has caused the Debian Bug report #808383,
regarding apt: fix FileUtlTest.GetTempDir failure when run as root
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
808383: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=808383
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Source: apt
Version: 1.1.5
Severity: minor
Tags: patch

Hi,

yes, I know, running builds as root is bad. OTOH, testing things under
pbuilder might be handy.

FileUtlTest.GetTempDir fails when run as root, as one of the tests
assumes that the current user cannot write to /usr; since root can,
the check fails. Attached there is a simple patch to run that case
only when running as non-root.

Thanks,
-- 
Pino
>From 958ad64f27ec2a35ffdfe7c1bb0e7570f83d0c1e Mon Sep 17 00:00:00 2001
From: Pino Toscano <pino@debian.org>
Date: Sat, 19 Dec 2015 12:09:18 +0100
Subject: [PATCH] Fix FileUtlTest.GetTempDir failure when run as root

Testing /usr as TMPDIR assumes that GetTempDir() cannot use it
because it cannot write to it; this is true for non-root users, but
not so much for root.

Since root can access everything, perform this particular test case
only when not running as root.
---
 test/libapt/fileutl_test.cc | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc
index 2bd090e..7d1368f 100644
--- a/test/libapt/fileutl_test.cc
+++ b/test/libapt/fileutl_test.cc
@@ -222,9 +222,13 @@ TEST(FileUtlTest, GetTempDir)
    setenv("TMPDIR", "/not-there-no-really-not", 1);
    EXPECT_EQ("/tmp", GetTempDir());
 
-   // here but not accessible for non-roots
-   setenv("TMPDIR", "/usr", 1);
-   EXPECT_EQ("/tmp", GetTempDir());
+   // root can access everything, so /usr will be accepted
+   if (geteuid() != 0)
+   {
+       // here but not accessible for non-roots
+       setenv("TMPDIR", "/usr", 1);
+       EXPECT_EQ("/tmp", GetTempDir());
+   }
 
    // files are no good for tmpdirs, too
    setenv("TMPDIR", "/dev/null", 1);
-- 
2.6.4


--- End Message ---
--- Begin Message ---
Source: apt
Source-Version: 1.1.6

We believe that the bug you reported is fixed in the latest version of
apt, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 808383@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Julian Andres Klode <jak@debian.org> (supplier of updated apt package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Thu, 24 Dec 2015 17:01:49 +0100
Source: apt
Binary: apt libapt-pkg5.0 libapt-inst2.0 apt-doc libapt-pkg-dev libapt-pkg-doc apt-utils apt-transport-https
Architecture: source
Version: 1.1.6
Distribution: unstable
Urgency: medium
Maintainer: APT Development Team <deity@lists.debian.org>
Changed-By: Julian Andres Klode <jak@debian.org>
Description:
 apt        - commandline package manager
 apt-doc    - documentation for APT
 apt-transport-https - https download transport for APT
 apt-utils  - package management related utility programs
 libapt-inst2.0 - deb package format runtime library
 libapt-pkg-dev - development files for APT's libapt-pkg and libapt-inst
 libapt-pkg-doc - documentation for APT development
 libapt-pkg5.0 - package management runtime library
Closes: 808381 808383 808561 808579
Changes:
 apt (1.1.6) unstable; urgency=medium
 .
   Merry Christmas from the APT Team
 .
   [ Pino Toscano ]
   * Fix FileUtlTest.GetTempDir failure when run as root (Closes: #808383)
   * CopyFile: fix BufSize to a sane value (Closes: #808381)
   * CopyFile: avoid failing on EOF on some systems (Closes: #808381)
 .
   [ Julian Andres Klode ]
   * Do nothing in FileFd::Write() if Size is 0 (Closes: #808381)
 .
   [ David Kalnischkies ]
   * avoid evaluating shell in paths used in apt-key
   * avoid triggering gpg2 migration in apt-key
   * follow dpkg and xz and use CRC64 for xz compression
   * parse xz-compression level from configuration
   * implement a buffer system for FileFd::ReadLine (Closes: 808579)
   * ensure we got a lock in clean operation (Closes: 808561)
Checksums-Sha1:
 40e5ec78a052d829cfb62e434723425cb3e44ba3 2297 apt_1.1.6.dsc
 33c4a78823ba38d3f947870e11cf609a4908cd14 1992680 apt_1.1.6.tar.xz
Checksums-Sha256:
 391e1606e768b3a60bc837bcbd730f1f76373d340501556629f31343512073d9 2297 apt_1.1.6.dsc
 3e0c999fe74cfaebd1d24efc9e39dd56a697b80afacb4a556431b9385d411221 1992680 apt_1.1.6.tar.xz
Files:
 de5e8c3008a90dd904018c51ef5cc436 2297 admin important apt_1.1.6.dsc
 f71ca903958b4cf3962b670aa4a73bc6 1992680 admin important apt_1.1.6.tar.xz

-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJWfBoDAAoJENc8OeVlgLOG6A8P/1mQs+oLrrhYUlzyiPppSNgb
pNwfsb1ZNFj1SZUlKlXGRQcs8aYvsN1WIYD1mYS9gp5Hwi3rNtidy03nRH3phsFD
f8IOCfAV3UCzg84L0Gi2w6WtWrz2uCH/Qj6jlEjeiV3N6r9XQUdYMMJIzQo0sv4L
O8Dr7hLoPd8JcShWGrTl50e5n6H/xA08a1MuGkcYHqIhAnZbSIlclAEB7Dg8+y7P
5Ze57Gm6BhSryI+5s1yLcgTvl+0fFMoF1xCmEzd8LtxOOqms8WBYnnUF7nagl5Fy
aZve8hiuEqQEXGpTepFTeyfv4wenzrKCQ7VUVnzAyCSKZ9RW1jJwUrdOZ+DMvvnE
sBPcAvPZVvIHLgs7FTEqsESZkr/RtbojjdfCW1BitiksP2KaUJq/LbBsMOSUGTDr
ZktGMJJkvKAZ0Ao5SPjLlKdtWBKui/v7zKHi2XzmTvyoKbQOc9jvA25EOgHsTNH1
zVt+03JdC4txVZOJYEtlFJCVr7lb14d9rHFom+y7XeKsSo2x5i6MsGktsS9Wpiat
XOq0c3ULGfFynDqf9k3qrIfQZzk6ldMDBhvUxYg10GQ0YERCdVcbIDR9BxUOwt5B
rR2QhO/RCrWT4YOY8czqcpMm5nW9w0ClNAriE2v+6q8k+DGkDzpFxtVrTYdU4IzA
iky55QBk4cm5HcvEH/oU
=sN4b
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: