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

Bug#704608: marked as done (apt: FileFd issues)



Your message dated Tue, 02 Jul 2013 09:03:27 +0000
with message-id <E1UtwUh-0004U1-Sj@franck.debian.org>
and subject line Bug#704608: fixed in apt 0.9.9
has caused the Debian Bug report #704608,
regarding apt: FileFd issues
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.)


-- 
704608: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=704608
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: apt
Severity: normal

Reviewing some APT code I noticed a couple of possible issues in
FileFd.

"""
In FileFd::OpenDescriptor(int Fd, unsigned int const,
  APT::Configuration::Compressor const &, bool):

  [...]
  Flags = (AutoClose) ? FileFd::AutoClose : 0;
  if (AutoClose == false && [... compress is one of gzip/bzip2...])
  {
      // Need to duplicate fd here or gzclose for cleanup will close the fd as well
      iFd = dup(Fd);
  }
  else
     iFd = Fd;
  [...]
  if (OpenInternDescriptor(Mode, compressor) == false)
  {
     if (AutoClose)
        close (iFd);
     return _error->Errno("gzdopen",_("Could not open file descriptor %d"), Fd);
  }
  return true;
"""

If OpenInternDescriptor fails, iFd will be closed if AutoClose is true
but it is not set to -1.  Since Flags have been set to
FileFd::AutoClose, the destructor will (via Close()) attempt to close
iFd again.  This is like to fail with EBADF given it was already
closed.  This given the (minor?) side-effect of causing an error being
pushed on to the _error handler (but otherwise should not cause any
issues AFAICT).

The auto-close behaviour of OpenDescriptor(...) is in general
inconsistent in regard to the input "fd".  The method above, it will
close the input file descriptor (due to iFd=Fd).  But the other
OpenDescriptor method will not close that handle on error.  This is
very unhealthy because the caller has no way of knowing what state the
fd will be in on error[2].
  At least OpenMaybeClearSignedFile appears to rely on the fd being
closed on error by OpenDescriptor.

~Niels

[1] Here I could have used a comment saying there is no need to check
the return value of dup because that OpenInternDescriptor will
eventually do it for us.  Anyway.

[2] Admittedly the other errors seem unlikely to occur in any
"pratical" use of OpenDescriptor, but still.

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

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 704608@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Michael Vogt <mvo@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: SHA1

Format: 1.8
Date: Tue, 02 Jul 2013 08:58:33 +0200
Source: apt
Binary: apt libapt-pkg4.12 libapt-inst1.5 apt-doc libapt-pkg-dev libapt-pkg-doc apt-utils apt-transport-https
Architecture: source all amd64
Version: 0.9.9
Distribution: unstable
Urgency: low
Maintainer: APT Development Team <deity@lists.debian.org>
Changed-By: Michael Vogt <mvo@debian.org>
Description: 
 apt        - commandline package manager
 apt-doc    - documentation for APT
 apt-transport-https - https download transport for APT
 apt-utils  - package managment related utility programs
 libapt-inst1.5 - 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-pkg4.12 - package managment runtime library
Closes: 645713 691453 704608 707578 711921 712433 712435 712486
Changes: 
 apt (0.9.9) unstable; urgency=low
 .
   [ Michael Vogt ]
   * improve debug output for the Debug::pkgProblemResolver and
     Debug::pkgDepCache::AutoInstall
   * improve apt-cdrom output when no CD-ROM can be auto-detected
   * document --no-auto-detect in apt-cdrom
 .
   [ David Kalnischkies ]
   * build the en manpages in subdirectory doc/en
   * remove -ldl from cdrom and -lutil from apt-get linkage
   * rewrite pkgOrderList::DepRemove to stop incorrect immediate setting
     (Closes: 645713)
   * prefer Essentials over Removals in ordering score
   * fix priority sorting by prefering higher in MarkInstall
   * try all providers in order if uninstallable in MarkInstall
   * do unpacks before configures in SmartConfigure (Closes: #707578)
   * fix support for multiple patterns in apt-cache search (Closes: #691453)
   * set Fail flag in FileFd on all errors consistently
   * don't explicitly init ExtractTar InFd with invalid fd
   * OpenDescriptor should autoclose fd always on error (Closes: #704608)
   * fail in CopyFile if the FileFds have error flag set
   * ensure state-dir exists before coyping cdrom files
   * fix file location for configure-index.gz in apt.conf(5) (Closes: #711921)
   * handle missing "Description" in apt-cache show (Closes: #712435)
   * try defaults if auto-detection failed in apt-cdrom (Closes: #712433)
   * support \n and \r\n line endings in ReadMessages
   * do not redownload unchanged InRelease files
   * trigger NODATA error for invalid InRelease files (Closes: #712486)
Checksums-Sha1: 
 be315429f4ead7dc145a59d3d192cf6978ff8ad4 1680 apt_0.9.9.dsc
 7a0744dbb4ef6706c12759793fb90fb41a71dfb4 3520687 apt_0.9.9.tar.gz
 10a29c620193d60b69692ff97b2caad51afae565 291092 apt-doc_0.9.9_all.deb
 18e5ece514b4afae24af8858eab70073bbb421fe 990278 libapt-pkg-doc_0.9.9_all.deb
 52e84efd39684e37258e89d82e3a0f2b1bad861e 925822 libapt-pkg4.12_0.9.9_amd64.deb
 9b58688b88cf68af242a1a82677ba34e8e6dde7c 169126 libapt-inst1.5_0.9.9_amd64.deb
 7e4c1a614a2d048b96d0bf7cc7905947530fcaf1 1323208 apt_0.9.9_amd64.deb
 6fe11bea294dadb18be19a254525be1cb1dcb7cb 190984 libapt-pkg-dev_0.9.9_amd64.deb
 92b65f8779c772b1bad633ef591ebbf08ef4f383 391960 apt-utils_0.9.9_amd64.deb
 50a320f02ab849ec0ad14bd6605d57a3ec7eb501 112108 apt-transport-https_0.9.9_amd64.deb
Checksums-Sha256: 
 42eeac3360f33debf3ab3b975e216556211f9ecd62bd02c02f4eb8a45ad1949a 1680 apt_0.9.9.dsc
 2765572a0c250457a2e7c40c068b077fe38ceffb294d98568b59186d7a745817 3520687 apt_0.9.9.tar.gz
 4351069e551ca083a8dedc36d63f4f679f19c4938c402e0d348f916f903cc8eb 291092 apt-doc_0.9.9_all.deb
 a96d8baaf3cb260b702662078c89c159694a4e819c74c8309828a1c32334323e 990278 libapt-pkg-doc_0.9.9_all.deb
 1d1f405864cfea66c1cd7ceb72ed10a0e5d4170870839db728ceeefb9668f025 925822 libapt-pkg4.12_0.9.9_amd64.deb
 14f5e0d05460809b43188408e03ddf7269591b3cbc30de73b3a3bbb663296d48 169126 libapt-inst1.5_0.9.9_amd64.deb
 4a5fb8f3e4df2776e18a85953fd505d17700db613be98e3f341a41db667ee724 1323208 apt_0.9.9_amd64.deb
 8c8a1450fbb3ed7c6e7b2ff9c77d2033916dca9b7d90c144ad31e5a8d271d9c5 190984 libapt-pkg-dev_0.9.9_amd64.deb
 46db3bb32df935824f97cebb031dc7f4bb3fd86d525f8c5ec7dde5101e3a35f2 391960 apt-utils_0.9.9_amd64.deb
 e4f188eb6f71d65d22e93262d471d1d5f4bd838c3df0aebfbf07c4a1b3d6e37e 112108 apt-transport-https_0.9.9_amd64.deb
Files: 
 25d895827d5ec9b89757c6e389923326 1680 admin important apt_0.9.9.dsc
 64692ec2885600e6bad631f76622ca26 3520687 admin important apt_0.9.9.tar.gz
 db81755a3d023b2261dd978b1ce80523 291092 doc optional apt-doc_0.9.9_all.deb
 4588f06d923cd5980e13949571ad2125 990278 doc optional libapt-pkg-doc_0.9.9_all.deb
 11f2f5d29d78305784dd51383287c9e2 925822 libs important libapt-pkg4.12_0.9.9_amd64.deb
 a42512fc352dd25ed6ee0e2ef4fe0571 169126 libs important libapt-inst1.5_0.9.9_amd64.deb
 f8062abb3ba32c5034374eeb0823f598 1323208 admin important apt_0.9.9_amd64.deb
 e753f7459d4103d2ee0042fd85556b4d 190984 libdevel optional libapt-pkg-dev_0.9.9_amd64.deb
 291036d85bd37ae6262b9690afefe74b 391960 admin important apt-utils_0.9.9_amd64.deb
 cf58bdd19bf84e9efffb8d8ec2154dad 112108 admin optional apt-transport-https_0.9.9_amd64.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlHSgpgACgkQliSD4VZixzQagwCfXPE0rRK2pP0fq5PwAPi5gEdY
z9AAniz4bKL5+APmKZ4AOg2WCGAy+cKS
=vSIX
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: