[devel] [PATCH for apt 00/38] Various fixes for Apt and basic integration test suite

Aleksei Nikiforov darktemplar на altlinux.org
Вт Дек 10 18:23:05 MSK 2019


First 21 patches are fixes for various issues and bugs found via static code analyzers,
cppcheck and clang static analyzer.
Next 10 patches are fixes for various additional issues found
during work on apt.
Last 7 patches add basic integration test suite.

It might have been a good idea to split this bunch of patches into smaller chunks,
but some patches require other patches in order to apply.

Aleksei Nikiforov (38):
  Replace post-increments with pre-increments
  Use correct types and type specifiers
  Fix potential memory corruption in pkgCache::DepIterator::AllTargets()
  Get rid of nullptr dereference
  Fix memory access outside of allocated buffer ranges
  Get rid of hardcoded array size
  Use signed types to detect IO errors
  Use 'explicit' keyword for constructors with one argument
  Rework identical conditions
  Improve member variable initialization
  Remove useless variable shadowing
  Fortify against buffer overflows
  Cacheiterators: sanitize increment operators and end() function
  Fix memory leaks
  Fix incorrect delete operator
  Don't access uninitialized data
  Fix access after free error
  Apt-pipe: ensure mainloop function doesn't return uninitialized or
    garbage value
  Don't use uninitialized value
  Get rid of dangling invalid pointer
  Fix invalid check of Queue against zero
  Fix iterators comparison
  Fortify ParseQuoteWord function
  Improve ipv6 address handling
  Check subsecond modification time for cached files
  Fix warning about truncation of value of pkgCache::Header::HeaderSz
  FileFd: all files are closed automatically
  Fix resource leaks in pkgCacheFile class
  Fix off by one error in dynamic mmap leading to resource leak
  pkgCacheFile: call Close() function in destructor
  pkgCacheFile: don't regenerate cache if it was already built
  Add support for rpm's dbpath configuration
  Import integration tests framework from Debian
  Add initial integration tests
  Add basic tests to ensure that lua and rpm scripts are called
  Add http and https methods tests
  Enable integration test suite during package build
  Add code coverage support

 apt.spec                                      |  64 +-
 apt/apt-pkg/Makefile.am                       |  10 +-
 apt/apt-pkg/acquire-item.cc                   |   4 +-
 apt/apt-pkg/acquire-method.cc                 |  13 +-
 apt/apt-pkg/acquire.cc                        |   7 +-
 apt/apt-pkg/algorithms.cc                     |   5 +-
 apt/apt-pkg/cachefile.cc                      |  22 +-
 apt/apt-pkg/cacheiterators.h                  |  22 +-
 apt/apt-pkg/contrib/cdromutl.cc               |  19 +-
 apt/apt-pkg/contrib/configuration.cc          |   4 +-
 apt/apt-pkg/contrib/fileutl.cc                |   4 +-
 apt/apt-pkg/contrib/fileutl.h                 |   8 +-
 apt/apt-pkg/contrib/mmap.cc                   |   2 +-
 apt/apt-pkg/contrib/strutl.cc                 | 295 ++++++--
 apt/apt-pkg/contrib/strutl.h                  |  35 +-
 apt/apt-pkg/defs.h                            |  18 +
 apt/apt-pkg/init.cc                           |   2 +-
 apt/apt-pkg/orderlist.cc                      |   8 +-
 apt/apt-pkg/packagemanager.cc                 |  12 +-
 apt/apt-pkg/pkgcache.cc                       |  50 +-
 apt/apt-pkg/pkgcache.h                        |  15 +-
 apt/apt-pkg/pkgcachegen.cc                    |  20 +-
 apt/apt-pkg/policy.cc                         |   6 +-
 apt/apt-pkg/rpm/rpmhandler.cc                 |  26 +-
 apt/apt-pkg/rpm/rpmhandler.h                  |   2 +
 apt/apt-pkg/rpm/rpmindexfile.cc               |  12 +-
 apt/apt-pkg/rpm/rpmlistparser.cc              |   2 +
 apt/apt-pkg/rpm/rpmpackagedata.cc             |  16 +-
 apt/apt-pkg/rpm/rpmpm.cc                      |  64 +-
 apt/apt-pkg/rpm/rpmsystem.cc                  |  17 +-
 apt/apt-pkg/sourcelist.cc                     |  22 +-
 apt/apt-pkg/srcrecords.cc                     |   6 +-
 apt/apt-pkg/versionmatch.cc                   |   2 +-
 apt/cmdline/Makefile.am                       |   9 +-
 apt/cmdline/acqprogress.cc                    |   4 +-
 apt/cmdline/apt-cache.cc                      |  20 +-
 apt/cmdline/apt-cdrom.cc                      |  24 +-
 apt/cmdline/apt-get.cc                        |  50 +-
 apt/cmdline/apt-pipe.c                        |   7 +-
 apt/cmdline/apt-shell.cc                      |  56 +-
 apt/cmdline/indexcopy.cc                      |   4 +-
 apt/cmdline/rpmindexcopy.cc                   |   8 +-
 apt/configure.in                              |   2 +
 apt/methods/Makefile.am                       |   7 +-
 apt/methods/cdrom.cc                          |   8 +-
 apt/methods/connect.cc                        |  34 +-
 apt/methods/connect.h                         |   2 +-
 apt/methods/file.cc                           |   2 +-
 apt/methods/ftp.cc                            |  61 +-
 apt/methods/ftp.h                             |   4 +-
 apt/methods/gpg.cc                            |   2 +-
 apt/methods/gzip.cc                           |   4 +-
 apt/methods/http.cc                           | 110 ++-
 apt/methods/http.h                            |  11 +-
 apt/methods/rsh.cc                            |  10 +-
 apt/methods/rsh.h                             |   4 +-
 apt/methods/rsync-method.h                    |   5 +-
 apt/methods/rsync.cc                          |  47 +-
 apt/test/integration/framework                | 656 ++++++++++++++++++
 apt/test/integration/run-tests                |  66 ++
 .../conflicting-package-distupgrade.spec      |  18 +
 .../specs/conflicting-package-one.spec        |  17 +
 .../specs/conflicting-package-two.spec        |  17 +
 .../integration/specs/missing-dependency.spec |  17 +
 .../integration/specs/simple-package-new.spec |  19 +
 .../specs/simple-package-noarch.spec          |  17 +
 .../specs/simple-package-update-conflict.spec |  17 +
 .../specs/simple-package-update.spec          |  15 +
 .../integration/specs/simple-package.spec     |  15 +
 .../integration/specs/simple-virtual.spec     |  17 +
 .../integration/test-apt-cache-depends-simple |  38 +
 apt/test/integration/test-apt-cache-dump      |  92 +++
 apt/test/integration/test-apt-cache-dumpavail | 115 +++
 apt/test/integration/test-apt-cache-pkgnames  |  32 +
 .../integration/test-apt-cache-search-simple  |  38 +
 .../integration/test-apt-cache-show-simple    |  67 ++
 .../integration/test-apt-cache-showpkg-simple |  44 ++
 apt/test/integration/test-apt-cache-stats     |  36 +
 apt/test/integration/test-apt-cache-unmet     |  31 +
 .../test-apt-cache-whatdepends-simple         |  43 ++
 apt/test/integration/test-apt-check-simple    |  26 +
 apt/test/integration/test-apt-config-dump     |  61 ++
 .../integration/test-apt-distupgrade-conflict |  30 +
 .../test-apt-distupgrade-mutual-conflict      |  31 +
 .../integration/test-apt-distupgrade-obsolete |  26 +
 .../integration/test-apt-distupgrade-simple   |  23 +
 .../test-apt-install-conflicting-packages     |  27 +
 apt/test/integration/test-apt-install-double  |  17 +
 apt/test/integration/test-apt-install-simple  |  13 +
 apt/test/integration/test-apt-lua-simple      |  82 +++
 apt/test/integration/test-apt-mark-simple     |  58 ++
 apt/test/integration/test-apt-method-http     |  29 +
 apt/test/integration/test-apt-method-https    |  56 ++
 ...est-apt-method-https-invalid-cert-hostname |  41 ++
 apt/test/integration/test-apt-remove-double   |  22 +
 apt/test/integration/test-apt-remove-simple   |  15 +
 .../test-apt-rpm-bash-scripts-simple          |  21 +
 apt/test/integration/test-apt-update-simple   |  19 +
 apt/test/integration/test-apt-upgrade-simple  |  26 +
 apt/test/uri.cc                               |  14 +-
 apt/tools/Makefile.am                         |   8 +-
 apt/tools/genpkglist.cc                       |  12 +-
 apt/tools/gensrclist.cc                       |  13 +-
 103 files changed, 2955 insertions(+), 451 deletions(-)
 create mode 100644 apt/apt-pkg/defs.h
 create mode 100644 apt/test/integration/framework
 create mode 100755 apt/test/integration/run-tests
 create mode 100644 apt/test/integration/specs/conflicting-package-distupgrade.spec
 create mode 100644 apt/test/integration/specs/conflicting-package-one.spec
 create mode 100644 apt/test/integration/specs/conflicting-package-two.spec
 create mode 100644 apt/test/integration/specs/missing-dependency.spec
 create mode 100644 apt/test/integration/specs/simple-package-new.spec
 create mode 100644 apt/test/integration/specs/simple-package-noarch.spec
 create mode 100644 apt/test/integration/specs/simple-package-update-conflict.spec
 create mode 100644 apt/test/integration/specs/simple-package-update.spec
 create mode 100644 apt/test/integration/specs/simple-package.spec
 create mode 100644 apt/test/integration/specs/simple-virtual.spec
 create mode 100755 apt/test/integration/test-apt-cache-depends-simple
 create mode 100755 apt/test/integration/test-apt-cache-dump
 create mode 100755 apt/test/integration/test-apt-cache-dumpavail
 create mode 100755 apt/test/integration/test-apt-cache-pkgnames
 create mode 100755 apt/test/integration/test-apt-cache-search-simple
 create mode 100755 apt/test/integration/test-apt-cache-show-simple
 create mode 100755 apt/test/integration/test-apt-cache-showpkg-simple
 create mode 100755 apt/test/integration/test-apt-cache-stats
 create mode 100755 apt/test/integration/test-apt-cache-unmet
 create mode 100755 apt/test/integration/test-apt-cache-whatdepends-simple
 create mode 100755 apt/test/integration/test-apt-check-simple
 create mode 100755 apt/test/integration/test-apt-config-dump
 create mode 100755 apt/test/integration/test-apt-distupgrade-conflict
 create mode 100755 apt/test/integration/test-apt-distupgrade-mutual-conflict
 create mode 100755 apt/test/integration/test-apt-distupgrade-obsolete
 create mode 100755 apt/test/integration/test-apt-distupgrade-simple
 create mode 100755 apt/test/integration/test-apt-install-conflicting-packages
 create mode 100755 apt/test/integration/test-apt-install-double
 create mode 100755 apt/test/integration/test-apt-install-simple
 create mode 100755 apt/test/integration/test-apt-lua-simple
 create mode 100755 apt/test/integration/test-apt-mark-simple
 create mode 100755 apt/test/integration/test-apt-method-http
 create mode 100755 apt/test/integration/test-apt-method-https
 create mode 100755 apt/test/integration/test-apt-method-https-invalid-cert-hostname
 create mode 100755 apt/test/integration/test-apt-remove-double
 create mode 100755 apt/test/integration/test-apt-remove-simple
 create mode 100755 apt/test/integration/test-apt-rpm-bash-scripts-simple
 create mode 100755 apt/test/integration/test-apt-update-simple
 create mode 100755 apt/test/integration/test-apt-upgrade-simple

-- 
2.24.0



Подробная информация о списке рассылки Devel