├── debian ├── apt.docs ├── source │ └── format ├── apt-doc.install ├── apt.examples ├── libapt-pkg-doc.install ├── apt-utils.examples ├── libapt-pkg-doc.docs ├── apt.dirs ├── apt-utils.links ├── libapt-pkg7.0.install ├── libapt-pkg-doc.lintian-overrides ├── libapt-pkg-dev.install ├── apt-utils.install ├── apt.maintscript ├── apt-daily.timer ├── apt-doc.docs ├── apt-utils.manpages ├── apt-daily-upgrade.timer ├── apt.logrotate ├── gbp.conf ├── apt-daily.service ├── apt-daily-upgrade.service ├── apt-doc.doc-base.guide ├── apt-doc.doc-base.offline ├── apt.postinst ├── libapt-pkg-doc.doc-base.method ├── tests │ ├── control │ └── run-tests ├── apt.postrm ├── libapt-pkg-doc.doc-base.files ├── apt.conf.autoremove ├── libapt-pkg-doc.doc-base.dpkg-tech ├── libapt-pkg-doc.doc-base.design ├── apt.install ├── default-sequoia.config ├── apt.lintian-overrides ├── apt.manpages └── apt.bug-script ├── dselect ├── names ├── CMakeLists.txt └── desc.apt ├── po ├── nn.po └── CMakeLists.txt ├── test ├── thread-safety │ ├── thread-check-internal.txt │ └── not-thread-safe.sh ├── CMakeLists.txt ├── integration │ ├── joesixpack.pub │ ├── joesixpack.sec │ ├── rexexpired.pub │ ├── rexexpired.sec │ ├── marvinparanoid.pub │ ├── marvinparanoid.sec │ ├── sebastiansubkey.pub │ ├── sebastiansubkey.sec │ ├── deb-lp1274466-cachedb.deb │ ├── sebastiansubkey.master.sec │ ├── cachedb-lp1274466-old-format.db │ ├── keyrings │ │ ├── test-archive-keyring.pub │ │ ├── test-archive-keyring.sec │ │ ├── test-master-keyring.pub │ │ └── test-master-keyring.sec │ ├── deb-bug-330162-encoded-tar-header.deb │ ├── test-bug-lp1347721-dpkg-ordering │ ├── test-bug-330162-encoded-tar-header │ ├── test-ubuntu-bug-1549819-empty-arch-list │ ├── test-bug-633350-do-not-kill-last-char-in-Release │ ├── Packages-policy-pinning │ ├── test-bug-762160-relpath │ ├── varianttable │ ├── test-bug-990518-sourceslist-volatile │ ├── test-github-23-too-long-dependency-line │ ├── test-bug-728500-tempdir │ ├── test-ubuntu-bug-1876495-pkgnames-virtual │ ├── test-bug-807012-mixed-case-package-names │ ├── test-ubuntu-bug-365611-long-package-names │ ├── test-method-connect │ ├── test-dpkg-protected │ ├── test-solver3-similar-depends │ ├── header-compilation │ ├── test-bug-1053887-regex-return-failure │ ├── test-bug-733028-gpg-resource-limit │ ├── status-xorg-break-providers │ ├── test-apt-cli-update │ ├── test-apt-get-remove-depends │ ├── test-bug-734922-apt-showsrc-duplicate │ ├── test-bug-732746-preferences │ ├── test-ubuntu-bug-985852-pre-depends-or-group-ordering │ ├── test-bug-921685-binary-detached-signature │ ├── test-bug-lp1445239-download-loop │ ├── status-bug-613420-new-garbage-dependency │ ├── skip-avoid-avoiding-breaks-predepends │ ├── test-bug-1120463-multi-arch-provides-version │ ├── test-bug-829651 │ ├── Packages-hashsum-verification │ ├── test-bug-745036-new-foreign-invalidates-cache │ ├── test-ubuntu-bug-802901-multiarch-early-remove │ ├── test-releasefile-verification-noflat │ ├── solver3.broken │ ├── test-apt-redirect-loop │ ├── test-solver3-break-recommends │ ├── test-bug-679371-apt-get-autoclean-multiarch │ ├── test-bug-879591-dont-warn-for-hidden-but-good-components │ ├── test-security-no-remote-status │ ├── test-srcrecord │ ├── test-prefer-native-architecture-over-higher-priority │ ├── test-solver3-suggests-last │ ├── test-ubuntu-bug-1651923-requote-https-uri │ ├── test-provides-arch-all │ ├── test-bug-753297-upgradable │ ├── test-apt-progress-fd-error │ ├── test-package-reinstallation │ ├── Packages-releasefile-verification │ ├── test-bug-796070-downgrade-realpkg │ ├── test-provides-gone-with-upgrade │ ├── test-bug-737130-multicompress-file-modes │ ├── test-dpkg-path │ ├── test-apt-update-reporting │ ├── Packages-releasefile-verification-new │ ├── test-bug-623443-fail-on-bad-proxies │ ├── test-apt-get-mark-auto │ ├── test-ubuntu-bug-1990586 │ ├── Packages-bug-598669-install-postfix-gets-exim-heavy │ ├── test-proxy-connect │ ├── status-bug-598669-install-postfix-gets-exim-heavy │ ├── test-ubuntu-bug-859188-multiarch-reinstall │ ├── test-apt-get-source-authenticated │ ├── test-apt-cli-upgrade │ ├── test-bug-709560-set-candidate-release │ ├── test-bug-718329-support-data.tar-uncompressed │ ├── test-bug-605394-versioned-or-groups │ ├── status-bug-612557-garbage-upgrade │ ├── test-bug-992993-marked-cycles │ ├── status-bug-605394-versioned-or-groups │ ├── test-ubuntu-bug-1078697-missing-source-hashes │ ├── test-bug-multiarch-upgrade │ ├── test-bug-507998-dist-upgrade-recommends │ ├── test-dont-forget-conflicts-via-unknown-architectures │ ├── test-apt-helper-cat-file │ ├── test-bug-598669-install-postfix-gets-exim-heavy │ ├── test-cve-2019-3462-Release.gpg-payload │ ├── test-bug-673536-pre-depends-breaks-loop │ ├── test-resolve-by-keep-new-recommends │ ├── status-bug-601961-install-info │ ├── test-apt-translation-has-no-packages │ ├── test-bug-990555-https-proxy-for-http │ ├── test-cve-2018-0501-mirror-alternatives │ ├── test-apt-update-hashsum-mismatch │ ├── test-ubuntu-bug-784473-InRelease-one-message-only │ ├── test-github-111-invalid-armember │ ├── test-ubuntu-bug-2003851-retry-after │ ├── test-apt-cache-showsrc │ ├── test-bug-689582-100-char-long-path-names │ ├── test-solver3-alternatives │ ├── test-bug-872963-apt-ftparchive-disable-hashes │ ├── skip-apt-dropprivs │ ├── test-bug-719263-print-uris-removes-authentication │ ├── test-apt-update-simple │ ├── test-bug-691453-apt-cache-search-multi-pattern │ ├── test-apt-get-source-multisources │ ├── test-apt-edit-sources │ ├── test-cve-2020-27350 │ ├── test-ubuntu-bug-1921626-unsized-packages │ ├── test-apt-progress-fd-deb822 │ ├── test-bug-870675-hang-on-unsupported-method │ ├── status-github-23-too-long-dependency-line │ ├── test-different-methods-for-same-source │ ├── Packages-bug-593360-modifiers-in-names │ └── test-apt-get-autoremove-real-virtual-provider ├── interactive-helper │ ├── networkless-install-fixes │ │ ├── README │ │ ├── test.sh │ │ └── sources.test.list │ ├── test_udevcdrom.cc │ ├── mthdcat.cc │ ├── aptdropprivs.cc │ ├── extract-control.cc │ ├── test_fileutl.cc │ ├── testdeb.cc │ └── libnoprofile.c └── libapt │ ├── apt-proxy-script │ ├── common.h │ ├── priority_test.cc │ ├── sourcelist_test.cc │ ├── gtest_runner.cc │ └── teestream_test.cc ├── vendor ├── ubuntu │ ├── apt.conf-01-vendor-ubuntu │ └── apt-vendor.ent ├── steamos │ ├── sources.list.in │ └── apt-vendor.ent ├── procursus │ ├── sources.list.in │ └── apt-vendor.ent ├── raspbian │ ├── sources.list.in │ └── apt-vendor.ent ├── blankon │ ├── sources.list.in │ └── apt-vendor.ent └── debian │ └── apt-vendor.ent ├── apt-pkg ├── contrib │ ├── header-is-private.h │ ├── proxy.h │ ├── cdromutl.h │ ├── netrc.h │ └── extracttar.h ├── apt-pkg.pc.in ├── versionscript.in ├── update.h ├── init.h ├── clean.h ├── upgrade.h ├── deb │ └── debversion.h ├── prettyprinters.h └── version.cc ├── doc ├── po │ └── header.pot.txt ├── xml.add ├── examples │ ├── preferences │ ├── CMakeLists.txt │ └── apt.conf ├── manpage-style.xsl.cmake.in └── srv-records-support.md ├── CMake ├── endian.h.in ├── statvfs.h.in ├── run_if_exists.sh ├── vendor_substitute.cmake ├── FindIconv.cmake ├── FindLZ4.cmake ├── FindLZMA.cmake ├── FindZSTD.cmake ├── FindUdev.cmake ├── FindXXHASH.cmake ├── FindSECCOMP.cmake ├── FindSystemd.cmake └── apti18n.h.in ├── apt-private ├── private-moo.h ├── private-list.h ├── private-unmet.h ├── private-update.h ├── private-depends.h ├── private-source.h ├── private-sources.h ├── private-utils.h ├── private-search.h ├── private-upgrade.h ├── private-main.h ├── private-json-hooks.h ├── private-show.h ├── CMakeLists.txt ├── private-download.h ├── private-history.h └── private-cmndline.h ├── completions └── CMakeLists.txt ├── abicheck ├── apt_installed.xml.in ├── apt_build.xml.in └── run_abi_test ├── ftparchive ├── sources.h ├── CMakeLists.txt ├── apt-ftparchive.h ├── byhash.h └── override.h ├── shippable.yml ├── git-clang-format.sh ├── Dockerfile ├── mirror-failure.py ├── .clang-format ├── cmdline ├── apt-report-mirror-failure └── apt-extracttemplates.h ├── .mailmap └── methods └── CMakeLists.txt /debian/apt.docs: -------------------------------------------------------------------------------- 1 | README.md 2 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /debian/apt-doc.install: -------------------------------------------------------------------------------- 1 | usr/share/doc/apt-doc 2 | -------------------------------------------------------------------------------- /debian/apt.examples: -------------------------------------------------------------------------------- 1 | usr/share/doc/apt/examples/* 2 | -------------------------------------------------------------------------------- /debian/libapt-pkg-doc.install: -------------------------------------------------------------------------------- 1 | usr/share/doc/libapt-pkg-doc 2 | -------------------------------------------------------------------------------- /dselect/names: -------------------------------------------------------------------------------- 1 | 70 apt APT Acquisition [file,https,http,ftp] 2 | -------------------------------------------------------------------------------- /po/nn.po: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Debian/apt/main/po/nn.po -------------------------------------------------------------------------------- /debian/apt-utils.examples: -------------------------------------------------------------------------------- 1 | usr/share/doc/apt-utils/examples/* 2 | -------------------------------------------------------------------------------- /debian/libapt-pkg-doc.docs: -------------------------------------------------------------------------------- 1 | doc/libapt-pkg2_to_3.txt 2 | doc/style.txt 3 | -------------------------------------------------------------------------------- /test/thread-safety/thread-check-internal.txt: -------------------------------------------------------------------------------- 1 | CndSet() 2 | Set() 3 | Clear() 4 | -------------------------------------------------------------------------------- /debian/apt.dirs: -------------------------------------------------------------------------------- 1 | etc/kernel/postinst.d 2 | usr/share/bug/apt 3 | etc/apt/keyrings 4 | -------------------------------------------------------------------------------- /debian/apt-utils.links: -------------------------------------------------------------------------------- 1 | ../lib/apt/apt-extracttemplates usr/bin/apt-extracttemplates 2 | 3 | -------------------------------------------------------------------------------- /test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(libapt) 2 | add_subdirectory(interactive-helper) 3 | -------------------------------------------------------------------------------- /debian/libapt-pkg7.0.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/libapt-pkg*.so.* 2 | usr/share/locale/*/*/libapt-pkg*.mo 3 | -------------------------------------------------------------------------------- /test/integration/joesixpack.pub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Debian/apt/main/test/integration/joesixpack.pub -------------------------------------------------------------------------------- /test/integration/joesixpack.sec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Debian/apt/main/test/integration/joesixpack.sec -------------------------------------------------------------------------------- /test/integration/rexexpired.pub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Debian/apt/main/test/integration/rexexpired.pub -------------------------------------------------------------------------------- /test/integration/rexexpired.sec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Debian/apt/main/test/integration/rexexpired.sec -------------------------------------------------------------------------------- /debian/libapt-pkg-doc.lintian-overrides: -------------------------------------------------------------------------------- 1 | libapt-pkg-doc: duplicate-files usr/share/doc/libapt-pkg-doc/html/* 2 | -------------------------------------------------------------------------------- /debian/libapt-pkg-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/apt-pkg/ 2 | usr/lib/*/libapt-pkg*.so 3 | usr/lib/*/pkgconfig/apt-*.pc 4 | -------------------------------------------------------------------------------- /test/integration/marvinparanoid.pub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Debian/apt/main/test/integration/marvinparanoid.pub -------------------------------------------------------------------------------- /test/integration/marvinparanoid.sec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Debian/apt/main/test/integration/marvinparanoid.sec -------------------------------------------------------------------------------- /test/integration/sebastiansubkey.pub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Debian/apt/main/test/integration/sebastiansubkey.pub -------------------------------------------------------------------------------- /test/integration/sebastiansubkey.sec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Debian/apt/main/test/integration/sebastiansubkey.sec -------------------------------------------------------------------------------- /test/integration/deb-lp1274466-cachedb.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Debian/apt/main/test/integration/deb-lp1274466-cachedb.deb -------------------------------------------------------------------------------- /test/integration/sebastiansubkey.master.sec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Debian/apt/main/test/integration/sebastiansubkey.master.sec -------------------------------------------------------------------------------- /test/integration/cachedb-lp1274466-old-format.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Debian/apt/main/test/integration/cachedb-lp1274466-old-format.db -------------------------------------------------------------------------------- /vendor/ubuntu/apt.conf-01-vendor-ubuntu: -------------------------------------------------------------------------------- 1 | Acquire::Changelogs::AlwaysOnline "true"; 2 | Acquire::http::User-Agent-Non-Interactive "true"; 3 | -------------------------------------------------------------------------------- /test/integration/keyrings/test-archive-keyring.pub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Debian/apt/main/test/integration/keyrings/test-archive-keyring.pub -------------------------------------------------------------------------------- /test/integration/keyrings/test-archive-keyring.sec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Debian/apt/main/test/integration/keyrings/test-archive-keyring.sec -------------------------------------------------------------------------------- /test/integration/keyrings/test-master-keyring.pub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Debian/apt/main/test/integration/keyrings/test-master-keyring.pub -------------------------------------------------------------------------------- /test/integration/keyrings/test-master-keyring.sec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Debian/apt/main/test/integration/keyrings/test-master-keyring.sec -------------------------------------------------------------------------------- /test/integration/deb-bug-330162-encoded-tar-header.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Debian/apt/main/test/integration/deb-bug-330162-encoded-tar-header.deb -------------------------------------------------------------------------------- /apt-pkg/contrib/header-is-private.h: -------------------------------------------------------------------------------- 1 | #ifndef APT_COMPILING_APT 2 | #error Internal header without ABI stability. Should only be used by apt itself! 3 | #endif 4 | -------------------------------------------------------------------------------- /debian/apt-utils.install: -------------------------------------------------------------------------------- 1 | usr/bin/apt-ftparchive 2 | usr/bin/apt-sortpkgs 3 | usr/lib/apt/planners/ 4 | usr/lib/apt/solvers/ 5 | usr/share/locale/*/*/apt-utils.mo 6 | -------------------------------------------------------------------------------- /vendor/steamos/sources.list.in: -------------------------------------------------------------------------------- 1 | # See sources.list(5) manpage for more information 2 | # Remember that CD-ROMs, DVDs and such are managed through the apt-cdrom tool. 3 | &sourceslist-list-format; 4 | -------------------------------------------------------------------------------- /vendor/procursus/sources.list.in: -------------------------------------------------------------------------------- 1 | # See sources.list(5) manpage for more information 2 | # Remember that CD-ROMs, DVDs and such are managed through the apt-cdrom tool. 3 | &sourceslist-list-format; 4 | -------------------------------------------------------------------------------- /doc/po/header.pot.txt: -------------------------------------------------------------------------------- 1 | # Translation of apt manpages and documentation to LANGUAGE 2 | # This file is distributed under the same license as the apt-doc package. 3 | # FIRST AUTHOR , YEAR. 4 | -------------------------------------------------------------------------------- /test/interactive-helper/networkless-install-fixes/README: -------------------------------------------------------------------------------- 1 | 2 | Those tests aim at making the networkless install timeout 3 | quicker, see 4 | https://wiki.ubuntu.com/NetworklessInstallationFixes 5 | for details 6 | -------------------------------------------------------------------------------- /debian/apt.maintscript: -------------------------------------------------------------------------------- 1 | rm_conffile /etc/apt/apt.conf.d/20changelog 1.2.4~ 2 | # we use a systemd timer unit now 3 | rm_conffile /etc/cron.daily/apt 1.2.10~ 4 | rm_conffile /etc/kernel/postinst.d/apt-auto-removal 2.4.5~ 5 | -------------------------------------------------------------------------------- /CMake/endian.h.in: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef HAVE_MACHINE_ENDIAN_H 4 | #include 5 | #endif 6 | #ifdef HAVE_SYS_ENDIAN_H 7 | #include 8 | #include 9 | #endif 10 | -------------------------------------------------------------------------------- /apt-private/private-moo.h: -------------------------------------------------------------------------------- 1 | #ifndef APT_PRIVATE_MOO_H 2 | #define APT_PRIVATE_MOO_H 3 | 4 | #include 5 | 6 | class CommandLine; 7 | 8 | APT_PUBLIC bool DoMoo(CommandLine &CmdL); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /debian/apt-daily.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Daily apt download activities 3 | 4 | [Timer] 5 | OnCalendar=*-*-* 6,18:00 6 | RandomizedDelaySec=12h 7 | Persistent=true 8 | 9 | [Install] 10 | WantedBy=timers.target 11 | -------------------------------------------------------------------------------- /doc/xml.add: -------------------------------------------------------------------------------- 1 | PO4A-HEADER:mode=after;position=manbugs;beginboundary=^ 2 | &translation-title; 3 | &translation-holder; 4 | &translation-english; 5 | 6 | -------------------------------------------------------------------------------- /apt-private/private-list.h: -------------------------------------------------------------------------------- 1 | #ifndef APT_PRIVATE_LIST_H 2 | #define APT_PRIVATE_LIST_H 3 | 4 | #include 5 | 6 | class CommandLine; 7 | 8 | APT_PUBLIC bool DoList(CommandLine &Cmd); 9 | 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /apt-private/private-unmet.h: -------------------------------------------------------------------------------- 1 | #ifndef APT_PRIVATE_UNMET_H 2 | #define APT_PRIVATE_UNMET_H 3 | 4 | #include 5 | 6 | class CommandLine; 7 | 8 | APT_PUBLIC bool UnMet(CommandLine &CmdL); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /dselect/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | install(PROGRAMS install setup update 2 | DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/dpkg/methods/apt) 3 | install(FILES desc.apt names 4 | DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/dpkg/methods/apt) 5 | -------------------------------------------------------------------------------- /debian/apt-doc.docs: -------------------------------------------------------------------------------- 1 | doc/acquire-additional-files.md 2 | doc/external-dependency-solver-protocol.md 3 | doc/external-installation-planner-protocol.md 4 | doc/json-hooks-protocol.md 5 | doc/progress-reporting.md 6 | doc/srv-records-support.md 7 | -------------------------------------------------------------------------------- /doc/examples/preferences: -------------------------------------------------------------------------------- 1 | Package: * 2 | Pin: release a=stable 3 | Pin-Priority: 500 4 | 5 | Package: * 6 | Pin: release a=testing 7 | Pin-Priority: 101 8 | 9 | Package: * 10 | Pin: release a=unstable 11 | Pin-Priority: 99 12 | -------------------------------------------------------------------------------- /completions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(BASH_COMPLETION_DIR "${CMAKE_INSTALL_DATAROOTDIR}/bash-completion/completions" 2 | CACHE PATH "Path to the bash-completion completions directory") 3 | 4 | install(FILES bash/apt DESTINATION ${BASH_COMPLETION_DIR}) 5 | -------------------------------------------------------------------------------- /debian/apt-utils.manpages: -------------------------------------------------------------------------------- 1 | usr/share/man/*/*/apt-extracttemplates.* 2 | usr/share/man/*/*/apt-ftparchive.* 3 | usr/share/man/*/*/apt-sortpkgs.* 4 | usr/share/man/*/apt-extracttemplates.* 5 | usr/share/man/*/apt-ftparchive.* 6 | usr/share/man/*/apt-sortpkgs.* 7 | -------------------------------------------------------------------------------- /apt-private/private-update.h: -------------------------------------------------------------------------------- 1 | #ifndef APT_PRIVATE_UPDATE_H 2 | #define APT_PRIVATE_UPDATE_H 3 | 4 | #include 5 | 6 | class CommandLine; 7 | 8 | APT_PUBLIC bool DoUpdate(CommandLine &CmdL); 9 | APT_PUBLIC bool DoUpdate(); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /debian/apt-daily-upgrade.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Daily apt upgrade and clean activities 3 | After=apt-daily.timer 4 | 5 | [Timer] 6 | OnCalendar=*-*-* 6:00 7 | RandomizedDelaySec=60m 8 | Persistent=true 9 | 10 | [Install] 11 | WantedBy=timers.target 12 | -------------------------------------------------------------------------------- /doc/examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | install(FILES apt.conf configure-index preferences 2 | DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples) 3 | install(FILES apt-ftparchive.conf ftp-archive.conf 4 | DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/apt-utils/examples) 5 | -------------------------------------------------------------------------------- /debian/apt.logrotate: -------------------------------------------------------------------------------- 1 | /var/log/apt/term.log { 2 | rotate 12 3 | monthly 4 | compress 5 | missingok 6 | notifempty 7 | } 8 | 9 | /var/log/apt/history.log { 10 | rotate 12 11 | monthly 12 | compress 13 | missingok 14 | notifempty 15 | } 16 | 17 | -------------------------------------------------------------------------------- /apt-pkg/apt-pkg.pc.in: -------------------------------------------------------------------------------- 1 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 2 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ 3 | 4 | Name: apt-pkg 5 | Description: package management runtime library 6 | Version: @PROJECT_VERSION@ 7 | Libs: -L${libdir} -lapt-pkg -pthread 8 | Cflags: -I${includedir} 9 | -------------------------------------------------------------------------------- /apt-private/private-depends.h: -------------------------------------------------------------------------------- 1 | #ifndef APT_PRIVATE_DEPENDS_H 2 | #define APT_PRIVATE_DEPENDS_H 3 | 4 | #include 5 | 6 | class CommandLine; 7 | 8 | APT_PUBLIC bool Depends(CommandLine &CmdL); 9 | APT_PUBLIC bool RDepends(CommandLine &CmdL); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /apt-private/private-source.h: -------------------------------------------------------------------------------- 1 | #ifndef APT_PRIVATE_SOURCE_H 2 | #define APT_PRIVATE_SOURCE_H 3 | 4 | #include 5 | 6 | class CommandLine; 7 | 8 | APT_PUBLIC bool DoSource(CommandLine &CmdL); 9 | APT_PUBLIC bool DoBuildDep(CommandLine &CmdL); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /test/libapt/apt-proxy-script: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ $1 = "http://www.debian.org:90/temp/test" ]; then 4 | echo "http://example.com" 5 | fi 6 | if [ $1 = "http://www.debian.org:91/temp/test" ]; then 7 | echo "This works" >&2 8 | echo "http://example.com/foo" 9 | fi 10 | -------------------------------------------------------------------------------- /apt-private/private-sources.h: -------------------------------------------------------------------------------- 1 | #ifndef APT_PRIVATE_SOURCES_H 2 | #define APT_PRIVATE_SOURCES_H 3 | 4 | #include 5 | 6 | class CommandLine; 7 | 8 | APT_PUBLIC bool EditSources(CommandLine &CmdL); 9 | APT_PUBLIC bool ModernizeSources(CommandLine &CmdL); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /apt-private/private-utils.h: -------------------------------------------------------------------------------- 1 | #ifndef APT_PRIVATE_UTILS_H 2 | #define APT_PRIVATE_UTILS_H 3 | 4 | #include 5 | 6 | bool DisplayFileInPager(std::string const &filename); 7 | bool EditFileInSensibleEditor(std::string const &filename); 8 | time_t GetSecondsSinceEpoch(); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /CMake/statvfs.h.in: -------------------------------------------------------------------------------- 1 | /* Compatibility for systems with out Single Unix Spec statvfs */ 2 | #include 3 | 4 | #ifdef HAVE_VFS_H 5 | #include 6 | #endif 7 | 8 | #ifdef HAVE_MOUNT_H 9 | #include 10 | #include 11 | #endif 12 | 13 | #define statvfs statfs 14 | -------------------------------------------------------------------------------- /test/integration/test-bug-lp1347721-dpkg-ordering: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture "i386" 8 | setupaptarchive 9 | 10 | # ensure we find a valid ordering 11 | testsuccess aptget dist-upgrade -s 12 | -------------------------------------------------------------------------------- /CMake/run_if_exists.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Small helper for running a command 3 | out="" 4 | if [ "$1" = "--stdout" ]; then 5 | out="$2" 6 | shift 2 7 | fi 8 | 9 | if [ -e "$1" ]; then 10 | shift 11 | if [ "$out" ]; then 12 | exec "$@" > $out 13 | else 14 | exec "$@" 15 | fi 16 | fi 17 | -------------------------------------------------------------------------------- /debian/gbp.conf: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | ; we need a preexport here 3 | ;preexport = ./prepare-release pre-export 4 | prebuild = ./prepare-release pre-build 5 | postbuild = ./prepare-release post-build 6 | debian-branch = main 7 | debian-tag = %(version)s 8 | export-dir = ../build-area 9 | sign-tags = True 10 | multimaint-merge = True 11 | -------------------------------------------------------------------------------- /abicheck/apt_installed.xml.in: -------------------------------------------------------------------------------- 1 | 2 | installed 3 | 4 | 5 | 6 | /usr/include/apt-pkg/ 7 | 8 | 9 | 10 | @installed_libapt@ 11 | 12 | 13 | 14 | SubstVar 15 | _ns_flagdata 16 | 17 | 18 | 19 | #define APT_COMPILING_APT 1 20 | 21 | -------------------------------------------------------------------------------- /vendor/raspbian/sources.list.in: -------------------------------------------------------------------------------- 1 | # See sources.list(5) manpage for more information 2 | # Remember that CD-ROMs, DVDs and such are managed through the apt-cdrom tool. 3 | &sourceslist-list-format; 4 | 5 | # Uncomment if you want the apt-get source function to work 6 | #deb-src http://mirrordirector.raspbian.org/raspbian &debian-stable-codename; main contrib non-free 7 | -------------------------------------------------------------------------------- /abicheck/apt_build.xml.in: -------------------------------------------------------------------------------- 1 | 2 | build-branch 3 | 4 | 5 | 6 | @build_path@/include/apt-pkg 7 | 8 | 9 | 10 | @build_path@/apt-pkg/ 11 | 12 | 13 | 14 | SubstVar 15 | _ns_flagdata 16 | 17 | 18 | 19 | #define APT_COMPILING_APT 1 20 | 21 | -------------------------------------------------------------------------------- /apt-private/private-search.h: -------------------------------------------------------------------------------- 1 | #ifndef APT_PRIVATE_SEARCH_H 2 | #define APT_PRIVATE_SEARCH_H 3 | 4 | #include 5 | #include 6 | 7 | class CommandLine; 8 | 9 | APT_PUBLIC bool DoSearch(CommandLine &CmdL); 10 | APT_PUBLIC void LocalitySort(pkgCache::VerFile ** const begin, unsigned long long const Count,size_t const Size); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /test/libapt/common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GTest is a horribly broken library needing lots of diagnostic overrides, 3 | * do them here. 4 | */ 5 | #pragma GCC diagnostic push 6 | #pragma GCC diagnostic ignored "-Wdouble-promotion" 7 | #pragma GCC diagnostic ignored "-Wsign-promo" 8 | #pragma GCC diagnostic ignored "-Wsign-compare" 9 | #include 10 | #pragma GCC diagnostic pop 11 | 12 | -------------------------------------------------------------------------------- /debian/apt-daily.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Daily apt download activities 3 | Documentation=man:apt(8) 4 | ConditionACPower=true 5 | After=network.target network-online.target systemd-networkd.service NetworkManager.service connman.service 6 | 7 | [Service] 8 | Type=oneshot 9 | ExecStartPre=-/usr/lib/apt/apt-helper wait-online 10 | ExecStart=/usr/lib/apt/apt.systemd.daily update 11 | 12 | -------------------------------------------------------------------------------- /test/integration/test-bug-330162-encoded-tar-header: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture "i386" 8 | 9 | msgtest 'Test apt-ftparchive with encoded tar header package' 10 | cp "$TESTDIR/deb-bug-330162-encoded-tar-header.deb" aptarchive/ 11 | testsuccess aptftparchive packages aptarchive/ 12 | -------------------------------------------------------------------------------- /apt-private/private-upgrade.h: -------------------------------------------------------------------------------- 1 | #ifndef APTPRIVATE_PRIVATE_UPGRADE_H 2 | #define APTPRIVATE_PRIVATE_UPGRADE_H 3 | 4 | #include 5 | 6 | class CommandLine; 7 | 8 | APT_PUBLIC bool DoDistUpgrade(CommandLine &CmdL); 9 | APT_PUBLIC bool DoUpgrade(CommandLine &CmdL); 10 | bool DoUpgradeNoNewPackages(CommandLine &CmdL); 11 | bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /apt-private/private-main.h: -------------------------------------------------------------------------------- 1 | #ifndef APT_PRIVATE_MAIN_H 2 | #define APT_PRIVATE_MAIN_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | class CommandLine; 9 | 10 | void InitLocale(APT_CMD const binary); 11 | APT_PUBLIC void InitSignals(); 12 | APT_PUBLIC void CheckIfSimulateMode(CommandLine &CmdL); 13 | APT_PUBLIC void CheckIfCalledByScript(int argc, const char *argv[]); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /test/integration/test-ubuntu-bug-1549819-empty-arch-list: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture "" 8 | echo 'APT::Architecture "";' > rootdir/etc/apt/apt.conf 9 | echo 'APT::Architectures:: "";' >> rootdir/etc/apt/apt.conf 10 | setupaptarchive 11 | 12 | # test success 13 | testsuccess aptcache -c rootdir/etc/apt/apt.conf gencaches -o debug::NoLocking=1 14 | -------------------------------------------------------------------------------- /debian/apt-daily-upgrade.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Daily apt upgrade and clean activities 3 | Documentation=man:apt(8) 4 | ConditionACPower=true 5 | After=apt-daily.service network.target network-online.target systemd-networkd.service NetworkManager.service connman.service 6 | 7 | [Service] 8 | Type=oneshot 9 | ExecStartPre=-/usr/lib/apt/apt-helper wait-online 10 | ExecStart=/usr/lib/apt/apt.systemd.daily install 11 | KillMode=process 12 | TimeoutStopSec=900 13 | -------------------------------------------------------------------------------- /CMake/vendor_substitute.cmake: -------------------------------------------------------------------------------- 1 | file(READ ${IN} input) 2 | foreach(variable ${VARS}) 3 | execute_process(COMMAND ${PROJECT_SOURCE_DIR}/vendor/getinfo 4 | --vendor ${CURRENT_VENDOR} ${variable} 5 | OUTPUT_VARIABLE value OUTPUT_STRIP_TRAILING_WHITESPACE 6 | COMMAND_ERROR_IS_FATAL ANY) 7 | string(REPLACE "&${variable};" "${value}" input "${input}") 8 | endforeach() 9 | file(WRITE ${OUT} "${input}") 10 | -------------------------------------------------------------------------------- /test/integration/test-bug-633350-do-not-kill-last-char-in-Release: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | insertpackage 'unstable' 'cool' 'amd64' '1.0' 10 | 11 | export APT_DONT_SIGN='InRelease' 12 | setupaptarchive --no-update 13 | 14 | echo 'NotAutomatic: yes' >> aptarchive/dists/unstable/Release 15 | signreleasefiles 16 | testsuccess aptget update 17 | -------------------------------------------------------------------------------- /apt-private/private-json-hooks.h: -------------------------------------------------------------------------------- 1 | /* 2 | * private-json-hooks.h - 2nd generation, JSON-RPC, hooks for APT 3 | * 4 | * Copyright (c) 2018 Canonical Ltd 5 | * 6 | * SPDX-License-Identifier: GPL-2.0+ 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | bool RunJsonHook(std::string const &option, std::string const &method, const char **FileList, CacheFile &Cache, std::set const &UnknownPackages = {}); 15 | -------------------------------------------------------------------------------- /debian/apt-doc.doc-base.guide: -------------------------------------------------------------------------------- 1 | Document: apt-user-guide 2 | Title: APT User's Guide 3 | Author: Jason Gunthorpe 4 | Abstract: The APT User's Guide provides an overview of how to use the 5 | APT package manager, and provides a detailed look at the apt-get tool. 6 | Section: Debian 7 | 8 | Format: html 9 | Index: /usr/share/doc/apt-doc/guide.html/index.html 10 | Files: /usr/share/doc/apt-doc/guide.html/*.html 11 | 12 | Format: text 13 | Files: /usr/share/doc/apt-doc/guide.text.gz 14 | -------------------------------------------------------------------------------- /vendor/procursus/apt-vendor.ent: -------------------------------------------------------------------------------- 1 | 2 | 3 | procursus-keyring"> 4 | 5 | 6 | 7 | 8 | 12 | -------------------------------------------------------------------------------- /debian/apt-doc.doc-base.offline: -------------------------------------------------------------------------------- 1 | Document: apt-offline-usage-guide 2 | Title: APT Offline Usage Guide 3 | Author: Jason Gunthorpe 4 | Abstract: The APT Offline Usage Guide provides detailed instructions and 5 | examples of how to use APT on an unconnected computer. 6 | Section: Debian 7 | 8 | Format: html 9 | Index: /usr/share/doc/apt-doc/offline.html/index.html 10 | Files: /usr/share/doc/apt-doc/offline.html/*.html 11 | 12 | Format: text 13 | Files: /usr/share/doc/apt-doc/offline.text.gz 14 | -------------------------------------------------------------------------------- /debian/apt.postinst: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | set -e 3 | 4 | if [ "$1" = 'configure' ] && [ -z "$DPKG_ROOT" ] && ! getent passwd _apt >/dev/null; then 5 | # add unprivileged user for the apt methods 6 | adduser --force-badname --system --home /nonexistent \ 7 | --no-create-home --quiet _apt || true 8 | fi 9 | 10 | if [ "$1" = "configure" ] && [ -n "$2" ] && dpkg --compare-versions -- "$2" le-nl "2.4.5~"; then 11 | rm -f /etc/apt/apt.conf.d/01autoremove-kernels 12 | fi 13 | 14 | 15 | #DEBHELPER# 16 | -------------------------------------------------------------------------------- /test/integration/Packages-policy-pinning: -------------------------------------------------------------------------------- 1 | Package: oldstuff 2 | Version: 1.0 3 | Architecture: i386 4 | Maintainer: Joe Sixpack 5 | Installed-Size: 100 6 | Filename: pool/oldstuff_1.0_i386.deb 7 | Size: 100000 8 | MD5sum: 311aeeadf78324aaff54c9b4e1f76671 9 | SHA1: 3c695e028f74d5c544deeddaaa1242desa81088c 10 | SHA256: b46fd1546151c545fe4bfa56a5cc0e7deaef23e2da3e4f129727fd660f28f050 11 | Description: some old but cool stuff 12 | This package will disappear in the next mirror update 13 | -------------------------------------------------------------------------------- /test/integration/test-bug-762160-relpath: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # regression test for bug #762160 where apt-get update fails when a 3 | # relative directory is given 4 | # 5 | set -e 6 | 7 | TESTDIR="$(readlink -f "$(dirname "$0")")" 8 | . "$TESTDIR/framework" 9 | setupenvironment 10 | configarchitecture 'amd64' 11 | 12 | insertpackage 'unstable' 'foo' 'all' '1' 13 | setupaptarchive 14 | changetowebserver 15 | 16 | testsuccess aptget update -o Dir=./rootdir 17 | testsuccess aptget update -o Dir=./rootdir 18 | -------------------------------------------------------------------------------- /debian/libapt-pkg-doc.doc-base.method: -------------------------------------------------------------------------------- 1 | Document: libapt-pkg-doc-method 2 | Title: APT Method Interface 3 | Author: Jason Gunthorpe 4 | Abstract: The APT Method Interface document describes the interface that 5 | APT uses to the archive access methods. 6 | Section: Debian 7 | 8 | Format: html 9 | Index: /usr/share/doc/libapt-pkg-doc/method.html/index.html 10 | Files: /usr/share/doc/libapt-pkg-doc/method.html/*.html 11 | 12 | Format: text 13 | Files: /usr/share/doc/libapt-pkg-doc/method.text.gz 14 | 15 | -------------------------------------------------------------------------------- /debian/tests/control: -------------------------------------------------------------------------------- 1 | Tests: pkg-config-test 2 | Restrictions: superficial 3 | Depends: libapt-pkg-dev, pkg-config, g++ 4 | 5 | Tests: run-tests 6 | Restrictions: allow-stderr 7 | Depends: @, @builddeps@, dpkg (>= 1.20.8), expect, fakeroot, wget, stunnel4, lsof, db-util, 8 | gpgv, 9 | gpgv-sq, 10 | sq (>= 0.40), 11 | sqv, 12 | moreutils, 13 | jq, 14 | libfile-fcntllock-perl, python3-apt, aptitude, 15 | valgrind-if-available [!armhf !ppc64el], gdb 16 | -------------------------------------------------------------------------------- /ftparchive/sources.h: -------------------------------------------------------------------------------- 1 | #ifndef SOURCES_H 2 | #define SOURCES_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | class DscExtract 9 | { 10 | public: 11 | std::string Data; 12 | pkgTagSection Section; 13 | unsigned long long Length; 14 | bool IsClearSigned; 15 | 16 | bool TakeDsc(const void *Data, unsigned long long Size); 17 | bool Read(std::string FileName); 18 | 19 | DscExtract() : Length(0), IsClearSigned(false) {}; 20 | ~DscExtract() {}; 21 | }; 22 | 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /vendor/raspbian/apt-vendor.ent: -------------------------------------------------------------------------------- 1 | 2 | 3 | raspbian-archive-keyring"> 4 | 5 | 6 | 10 | -------------------------------------------------------------------------------- /test/integration/varianttable: -------------------------------------------------------------------------------- 1 | # 2 | amd64v4 amd64 lm,cmov,cx8,fpu,fxsr,mmx,syscall,sse2,cx16,lahf_lm,popcnt,sse4_1,sse4_2,ssse3,avx,avx2,bmi1,bmi2,f16c,fma,abm,movbe,xsave,avx512f,avx512bw,avx512cd,avx512dq,avx512vl 3 | amd64v3 amd64 lm,cmov,cx8,fpu,fxsr,mmx,syscall,sse2,cx16,lahf_lm,popcnt,sse4_1,sse4_2,ssse3,avx,avx2,bmi1,bmi2,f16c,fma,abm,movbe,xsave 4 | amd64v2 amd64 lm,cmov,cx8,fpu,fxsr,mmx,syscall,sse2,cx16,lahf_lm,popcnt,sse4_1,sse4_2,ssse3 5 | amd64v1 amd64 lm,cmov,cx8,fpu,fxsr,mmx,syscall,sse2 6 | -------------------------------------------------------------------------------- /shippable.yml: -------------------------------------------------------------------------------- 1 | language: none 2 | env: 3 | - DEBIAN_FRONTEND=noninteractive 4 | 5 | build: 6 | pre_ci_boot: 7 | image_name: debian 8 | image_tag: unstable 9 | pull: true 10 | ci: 11 | - apt-get install -qq build-essential expect 12 | - ./prepare-release travis-ci 13 | - mkdir build 14 | - ( cd build && cmake -DWITH_CURL=OFF .. ) 15 | - make -C build -j 4 16 | - rm -f /etc/dpkg/dpkg.cfg.d/excludes 17 | - CTEST_OUTPUT_ON_FAILURE=1 make -C build test 18 | - unbuffer ./test/integration/run-tests -q -j 4 19 | -------------------------------------------------------------------------------- /test/integration/test-bug-990518-sourceslist-volatile: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | configarchitecture 'amd64' 9 | 10 | buildsimplenativepackage 'foo' 'amd64' '1' 11 | 12 | echo foo > rootdir/etc/apt/sources.list.d/test.list 13 | 14 | testfailureequal "E: Malformed line 1 in source list ${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list.d/test.list (type) 15 | E: The list of sources could not be read." apt install ./incoming/foo_1_amd64.deb -s 16 | -------------------------------------------------------------------------------- /apt-pkg/contrib/proxy.h: -------------------------------------------------------------------------------- 1 | // -*- mode: cpp; mode: fold -*- 2 | // Description /*{{{*/ 3 | /* ###################################################################### 4 | 5 | Proxy - Proxy operations 6 | 7 | ##################################################################### */ 8 | /*}}}*/ 9 | #ifndef PKGLIB_PROXY_H 10 | #define PKGLIB_PROXY_H 11 | 12 | #include 13 | 14 | class URI; 15 | APT_PUBLIC bool AutoDetectProxy(URI &URL); 16 | APT_HIDDEN bool CanURIBeAccessedViaProxy(URI const &URL); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /debian/apt.postrm: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # apt postrm 4 | # Copyright (C) 1998, Ben Gertzfield 5 | 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | 11 | set -e 12 | 13 | #DEBHELPER# 14 | 15 | case "$1" in 16 | remove) 17 | ;; 18 | purge) 19 | rm -rf /var/cache/apt 20 | rm -rf /var/lib/apt 21 | esac 22 | 23 | -------------------------------------------------------------------------------- /debian/libapt-pkg-doc.doc-base.files: -------------------------------------------------------------------------------- 1 | Document: libapt-pkg-doc-files 2 | Title: APT Files 3 | Author: Jason Gunthorpe 4 | Abstract: The APT Files document describes the complete implementation and 5 | format of the installed APT directory structure. It also serves as guide 6 | to how APT views the Debian archive. 7 | Section: Debian 8 | 9 | Format: html 10 | Index: /usr/share/doc/libapt-pkg-doc/files.html/index.html 11 | Files: /usr/share/doc/libapt-pkg-doc/files.html/*.html 12 | 13 | Format: text 14 | Files: /usr/share/doc/libapt-pkg-doc/files.text.gz 15 | -------------------------------------------------------------------------------- /git-clang-format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd "$(dirname "$0")" 3 | CLANG_FORMAT="$(find $(echo "$PATH" | tr ':' ' ') -name 'git-clang-format-*' | sort | tail -n1 )" 4 | if [ -z "$CLANG_FORMAT" ]; then 5 | echo >&2 'Could not find a clang-format to use. Is the package clang-format installed?' 6 | exit 1 7 | fi 8 | git "$(basename "$CLANG_FORMAT" | cut -d'-' -f 2-)" --diff "$@" | \ 9 | sed "s#+/\*\}\}\}\*/#+ /*}}}*/#" | \ 10 | grep -v '^clang-format did not modify any files$' | \ 11 | grep -v '^no modified files to format$' | \ 12 | patch -p1 13 | -------------------------------------------------------------------------------- /test/integration/test-github-23-too-long-dependency-line: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture "amd64" 8 | setupaptarchive 9 | 10 | 11 | testsuccessequal "network-manager-strongswan: 12 | Installed: 1.3.1-14 13 | Candidate: 1.3.1-14 14 | Version table: 15 | *** 1.3.1-14 500 16 | 500 file:${TMPWORKINGDIRECTORY}/aptarchive Packages 17 | 100 ${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" aptcache policy network-manager-strongswan 18 | -------------------------------------------------------------------------------- /debian/apt.conf.autoremove: -------------------------------------------------------------------------------- 1 | APT 2 | { 3 | NeverAutoRemove 4 | { 5 | "^firmware-linux.*"; 6 | "^linux-firmware$"; 7 | "^linux-image-[a-z0-9]*$"; 8 | "^linux-image-[a-z0-9]*-[a-z0-9]*$"; 9 | }; 10 | 11 | VersionedKernelPackages 12 | { 13 | # kernels 14 | "linux-.*"; 15 | "kfreebsd-.*"; 16 | "gnumach-.*"; 17 | # (out-of-tree) modules 18 | ".*-modules"; 19 | ".*-kernel"; 20 | }; 21 | 22 | Never-MarkAuto-Sections 23 | { 24 | "metapackages"; 25 | "tasks"; 26 | }; 27 | 28 | Move-Autobit-Sections 29 | { 30 | "oldlibs"; 31 | }; 32 | }; 33 | -------------------------------------------------------------------------------- /debian/libapt-pkg-doc.doc-base.dpkg-tech: -------------------------------------------------------------------------------- 1 | Document: libapt-pkg-doc-dpkg-tech 2 | Title: APT's interpretation of DPkg Technical Specification 3 | Author: Jason Gunthorpe 4 | Abstract: The DPkg Technical Manual gives an overview of dpkg's external 5 | functions(as APT sees them) and describes how it views the world. 6 | Section: Debian 7 | 8 | Format: html 9 | Index: /usr/share/doc/libapt-pkg-doc/dpkg-tech.html/index.html 10 | Files: /usr/share/doc/libapt-pkg-doc/dpkg-tech.html/*.html 11 | 12 | Format: text 13 | Files: /usr/share/doc/libapt-pkg-doc/dpkg-tech.text.gz 14 | -------------------------------------------------------------------------------- /debian/libapt-pkg-doc.doc-base.design: -------------------------------------------------------------------------------- 1 | Document: libapt-pkg-doc-design 2 | Title: APT Design Document 3 | Author: Jason Gunthorpe 4 | Abstract: The APT Design Document is an overview of the specifications and 5 | design goals of the APT project. It also attempts to give a broad 6 | description of the implementation as well. 7 | Section: Debian 8 | 9 | Format: html 10 | Index: /usr/share/doc/libapt-pkg-doc/design.html/index.html 11 | Files: /usr/share/doc/libapt-pkg-doc/design.html/*.html 12 | 13 | Format: text 14 | Files: /usr/share/doc/libapt-pkg-doc/design.text.gz 15 | -------------------------------------------------------------------------------- /test/interactive-helper/test_udevcdrom.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | int main() 12 | { 13 | pkgUdevCdromDevices c; 14 | assert(c.Dlopen()); 15 | 16 | std::vector l; 17 | l = c.Scan(); 18 | assert(l.empty() == false); 19 | for (size_t i = 0; i < l.size(); ++i) 20 | std::cerr << l[i].DeviceName << " " 21 | << l[i].Mounted << " " 22 | << l[i].MountPath << std::endl; 23 | } 24 | -------------------------------------------------------------------------------- /test/interactive-helper/mthdcat.cc: -------------------------------------------------------------------------------- 1 | /* Usage, mthdcat < cmds | methods/mthd 2 | All this does is cat a file into the method without closing the FD when 3 | the file ends */ 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | int main() 11 | { 12 | char Buffer[APT_BUFFER_SIZE]; 13 | 14 | while (1) 15 | { 16 | int Res = read(STDIN_FILENO,Buffer,sizeof(Buffer)); 17 | if (Res <= 0) 18 | while (1) sleep(100); 19 | if (write(STDOUT_FILENO,Buffer,Res) != Res) 20 | break; 21 | } 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /apt-pkg/versionscript.in: -------------------------------------------------------------------------------- 1 | APTPKG_@MAJOR@ 2 | { 3 | global: 4 | *; 5 | local: 6 | extern "C++" { 7 | std::*; 8 | typeinfo?for?std::*; 9 | vtable?for?std::*; 10 | typeinfo?name?for?std::*; 11 | guard?variable?for?std::*; 12 | void?std::*; 13 | bool?std::*; 14 | *std::__do_uninit_copy*; 15 | typeinfo?for?__gnu_cxx::*; 16 | vtable?for?__gnu_cxx::*; 17 | typeinfo?name?for?__gnu_cxx::*; 18 | guard?variable?for?__gnu_cxx::*; 19 | __gnu_cxx::*; 20 | int?__gnu_cxx::*; 21 | }; 22 | }; 23 | -------------------------------------------------------------------------------- /test/integration/test-bug-728500-tempdir: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | TESTDIR="$(readlink -f "$(dirname "$0")")" 6 | . "$TESTDIR/framework" 7 | setupenvironment 8 | configarchitecture 'i386' 9 | 10 | insertpackage 'unstable' 'coolstuff' 'all' '1.0' 11 | 12 | setupaptarchive 13 | changetowebserver 14 | 15 | msgtest 'Test apt-get update with incorrect' 'TMPDIR' 16 | 17 | export TMPDIR=/does-not-exists 18 | testsuccess aptget update -o Debug::Acquire::gpg=1 19 | unset TMPDIR 20 | 21 | testsuccessequal 'coolstuff' aptcache pkgnames 22 | testsuccess ls rootdir/var/lib/apt/lists/*InRelease 23 | -------------------------------------------------------------------------------- /test/integration/test-ubuntu-bug-1876495-pkgnames-virtual: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | TESTDIR="$(readlink -f "$(dirname "$0")")" 6 | . "$TESTDIR/framework" 7 | setupenvironment 8 | configarchitecture 'i386' 9 | 10 | insertinstalledpackage 'coolstuff' 'all' '1.0' 'Provides: virtual-package 11 | Source: source-package' 12 | 13 | setupaptarchive 14 | changetowebserver 15 | 16 | testsuccess aptget update -o Debug::Acquire::gpg=1 17 | testsuccessequal 'coolstuff' aptcache pkgnames 18 | 19 | testsuccessequal 'source-package 20 | virtual-package 21 | coolstuff' aptcache pkgnames --all-names 22 | -------------------------------------------------------------------------------- /doc/examples/apt.conf: -------------------------------------------------------------------------------- 1 | /* This file is a sample configuration file with a few harmless sample 2 | options. 3 | */ 4 | 5 | APT 6 | { 7 | // Options for apt-get 8 | Get 9 | { 10 | Download-Only "false"; 11 | }; 12 | 13 | }; 14 | 15 | // Options for the downloading routines 16 | Acquire 17 | { 18 | Retries "0"; 19 | }; 20 | 21 | // Things that effect the APT dselect method 22 | DSelect 23 | { 24 | Clean "auto"; // always|auto|prompt|never 25 | }; 26 | 27 | DPkg 28 | { 29 | // Probably don't want to use force-downgrade.. 30 | Options {"--force-overwrite";} 31 | } 32 | -------------------------------------------------------------------------------- /doc/manpage-style.xsl.cmake.in: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | <> 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:unstable 2 | COPY . /tmp 3 | WORKDIR /tmp 4 | RUN sed -i s#://deb.debian.org#://cdn-fastly.deb.debian.org# /etc/apt/sources.list \ 5 | && apt-get update \ 6 | && adduser --home /home/travis travis --quiet --disabled-login --gecos "" --uid 1000 \ 7 | && env DEBIAN_FRONTEND=noninteractive apt-get install build-essential ccache ninja-build expect curl git -q -y \ 8 | && env DEBIAN_FRONTEND=noninteractive ./prepare-release travis-ci \ 9 | && dpkg-reconfigure ccache \ 10 | && rm -f /etc/dpkg/dpkg.cfg.d/excludes \ 11 | && rm -r /tmp/* \ 12 | && apt-get clean 13 | -------------------------------------------------------------------------------- /dselect/desc.apt: -------------------------------------------------------------------------------- 1 | The APT installation method encompasses most other installation methods 2 | under the umbrella of the new Package Acquisition code. This method allows 3 | installation from locations in the filesystem, https, http and ftp URLs, 4 | supports full installation ordering and dependency checking as well as 5 | multiple sources. See the man pages apt-get(8) and sources.list(5) 6 | 7 | HTTP proxies can be used by setting http_proxy="http://proxy:port/" before 8 | running DSelect. FTP proxies require special configuration detailed in 9 | the apt.conf(5) man page (see /usr/share/doc/apt/examples/apt.conf) 10 | -------------------------------------------------------------------------------- /test/integration/test-bug-807012-mixed-case-package-names: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | TMPDIR=$(readlink -f .) 8 | 9 | insertinstalledpackage 'worldofgoo' 'all' '1' 10 | insertpackage 'unstable' 'WorldOfGoo' 'all' '1' 11 | 12 | setupaptarchive 13 | 14 | testsuccessequal "worldofgoo: 15 | Installed: 1 16 | Candidate: 1 17 | Version table: 18 | *** 1 500 19 | 500 file:${TMPDIR}/aptarchive unstable/main all Packages 20 | 100 ${TMPDIR}/rootdir/var/lib/dpkg/status" \ 21 | aptcache policy worldofgoo 22 | -------------------------------------------------------------------------------- /test/integration/test-ubuntu-bug-365611-long-package-names: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'i386' 8 | setupaptarchive 9 | 10 | aptget install $(for i in $(seq 0 1000); do echo -n 'a'; done) 2> longpackagename.log > /dev/null || true 11 | testfileequal 'longpackagename.log' "E: Unable to locate package $(for i in $(seq 0 1000); do echo -n 'a'; done)" 12 | 13 | # … and the opposite of long: 14 | aptget install "" -s >longpackagename.log 2>&1 || true 15 | testfileequal 'longpackagename.log' "$(aptget install -s)" 16 | -------------------------------------------------------------------------------- /debian/apt.install: -------------------------------------------------------------------------------- 1 | debian/*.service /usr/lib/systemd/system/ 2 | debian/*.timer /usr/lib/systemd/system/ 3 | debian/apt.systemd.daily usr/lib/apt 4 | debian/default-sequoia.config usr/share/apt/ 5 | etc/apt/ 6 | usr/bin/apt 7 | usr/bin/apt-cache 8 | usr/bin/apt-cdrom 9 | usr/bin/apt-config 10 | usr/bin/apt-get 11 | usr/bin/apt-mark 12 | usr/lib/*/libapt-private.so* 13 | usr/lib/apt/apt-helper 14 | usr/lib/apt/apt-extracttemplates 15 | usr/lib/apt/methods/ 16 | usr/lib/apt/planners/dump 17 | usr/lib/apt/solvers/dump 18 | usr/lib/dpkg/methods/apt/ 19 | usr/share/bash-completion/completions/ 20 | usr/share/locale/*/*/apt.mo 21 | var/ 22 | -------------------------------------------------------------------------------- /vendor/steamos/apt-vendor.ent: -------------------------------------------------------------------------------- 1 | 2 | 3 | valve-archive-keyring"> 4 | 5 | 6 | 8 | 12 | -------------------------------------------------------------------------------- /debian/default-sequoia.config: -------------------------------------------------------------------------------- 1 | # Default APT Sequoia configuration. To overwrite, consider copying this 2 | # to /etc/crypto-policies/back-ends/apt-sequoia.config and modify the 3 | # desired values. 4 | [asymmetric_algorithms] 5 | dsa2048 = 2024-02-01 6 | dsa3072 = 2024-02-01 7 | dsa4096 = 2024-02-01 8 | brainpoolp256 = 2028-02-01 9 | brainpoolp384 = 2028-02-01 10 | brainpoolp512 = 2028-02-01 11 | rsa2048 = 2030-02-01 12 | 13 | [hash_algorithms] 14 | sha1.second_preimage_resistance = 2026-02-01 # Extend the expiry for legacy repositories 15 | sha224 = 2026-02-01 16 | 17 | [packets] 18 | signature.v3 = 2026-02-01 # Extend the expiry 19 | -------------------------------------------------------------------------------- /test/integration/test-method-connect: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | 9 | cd downloaded 10 | testfailureequal 'Err:1 http://vwakviie2ienjx6t.onion/ 11 | Direct connection to .onion domains is blocked by default. If you meant to use Tor remember to use tor+http instead of http. 12 | E: Failed to fetch http://vwakviie2ienjx6t.onion/ Direct connection to .onion domains is blocked by default. If you meant to use Tor remember to use tor+http instead of http. 13 | E: Download Failed' apthelper download-file 'http://vwakviie2ienjx6t.onion/' ftp.debian.org.html 14 | -------------------------------------------------------------------------------- /CMake/FindIconv.cmake: -------------------------------------------------------------------------------- 1 | find_path(ICONV_INCLUDE_DIR NAMES iconv.h) 2 | 3 | find_library(ICONV_LIBRARY NAMES iconv) 4 | if (ICONV_LIBRARY) 5 | set(ICONV_SYMBOL_FOUND "${ICONV_LIBRARY}") 6 | else() 7 | check_function_exists(iconv_open ICONV_SYMBOL_FOUND) 8 | endif() 9 | 10 | include(FindPackageHandleStandardArgs) 11 | find_package_handle_standard_args(Iconv DEFAULT_MESSAGE ICONV_INCLUDE_DIR ICONV_SYMBOL_FOUND) 12 | 13 | if(ICONV_LIBRARY) 14 | set(ICONV_LIBRARIES "${ICONV_LIBRARY}") 15 | else() 16 | set(ICONV_LIBRARIES) 17 | endif() 18 | set(ICONV_INCLUDE_DIRS "${ICONV_INCLUDE_DIR}") 19 | 20 | mark_as_advanced(ICONV_LIBRARY ICONV_INCLUDE_DIR) 21 | -------------------------------------------------------------------------------- /test/integration/test-dpkg-protected: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | insertinstalledpackage 'protected-package' 'native' '1' 'Protected: yes' 10 | 11 | setupaptarchive 12 | 13 | 14 | if dpkg --assert-protected-field 2>/dev/null; then 15 | testsuccess aptget remove protected-package "$@" -o Debug::pkgDpkgPm=1 -y --allow-remove-essential 16 | cp rootdir/tmp/testsuccess.output rootdir/tmp/output 17 | testsuccess grep -- '--force-remove-protected' rootdir/tmp/output 18 | else 19 | msgskip "dpkg does not support protected field" 20 | fi 21 | -------------------------------------------------------------------------------- /test/libapt/priority_test.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "common.h" 4 | #include 5 | 6 | using std::string; 7 | 8 | // Tests for Bug#807523 9 | TEST(PriorityTest, PriorityPrinting) 10 | { 11 | EXPECT_EQ("required", string(pkgCache::Priority(pkgCache::State::Required))); 12 | EXPECT_EQ("important", string(pkgCache::Priority(pkgCache::State::Important))); 13 | EXPECT_EQ("standard", string(pkgCache::Priority(pkgCache::State::Standard))); 14 | EXPECT_EQ("optional", string(pkgCache::Priority(pkgCache::State::Optional))); 15 | EXPECT_EQ("extra", string(pkgCache::Priority(pkgCache::State::Extra))); 16 | } 17 | -------------------------------------------------------------------------------- /test/integration/test-solver3-similar-depends: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | insertpackage 'installed' 'a' 'all' '2' 'Depends: a|b' 10 | insertpackage 'unstable' 'a' 'all' '3' 'Depends: a|c' 11 | 12 | setupaptarchive 13 | testsuccess apt install -o debug::apt::solver=3 a -s --solver 3.0 14 | cp rootdir/tmp/testsuccess.output log 15 | msgmsg "Test that æ|b and a|c are different or groups" 16 | testsuccess grep "Found dependency critical a:amd64=2 -> a:amd64" log 17 | testsuccess grep "Found dependency critical a:amd64=3 -> a:amd64" log 18 | 19 | -------------------------------------------------------------------------------- /mirror-failure.py: -------------------------------------------------------------------------------- 1 | # File: cgihttpserver-example-1.py 2 | 3 | import CGIHTTPServer 4 | import BaseHTTPServer 5 | 6 | class Handler(CGIHTTPServer.CGIHTTPRequestHandler): 7 | #cgi_directories = ["/cgi"] 8 | def do_POST(self): 9 | print "do_POST" 10 | #print self.command 11 | #print self.path 12 | #print self.headers 13 | print self.client_address 14 | data = self.rfile.read(int(self.headers["content-length"])) 15 | print data 16 | self.wfile.write("200 Ok\n"); 17 | 18 | PORT = 8000 19 | 20 | httpd = BaseHTTPServer.HTTPServer(("", PORT), Handler) 21 | print "serving at port", PORT 22 | httpd.serve_forever() 23 | 24 | -------------------------------------------------------------------------------- /CMake/FindLZ4.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find LZ4 2 | # Once done, this will define 3 | # 4 | # LZ4_FOUND - system has LZ4 5 | # LZ4_INCLUDE_DIRS - the LZ4 include directories 6 | # LZ4_LIBRARIES - the LZ4 library 7 | find_package(PkgConfig) 8 | 9 | pkg_check_modules(LZ4_PKGCONF liblz4) 10 | 11 | find_path(LZ4_INCLUDE_DIRS 12 | NAMES lz4frame.h 13 | PATHS ${LZ4_PKGCONF_INCLUDE_DIRS} 14 | ) 15 | 16 | 17 | find_library(LZ4_LIBRARIES 18 | NAMES lz4 19 | PATHS ${LZ4_PKGCONF_LIBRARY_DIRS} 20 | ) 21 | 22 | include(FindPackageHandleStandardArgs) 23 | find_package_handle_standard_args(LZ4 DEFAULT_MSG LZ4_INCLUDE_DIRS LZ4_LIBRARIES) 24 | 25 | mark_as_advanced(LZ4_INCLUDE_DIRS LZ4_LIBRARIES) 26 | -------------------------------------------------------------------------------- /CMake/FindLZMA.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find LZMA 2 | # Once done, this will define 3 | # 4 | # LZMA_FOUND - system has LZMA 5 | # LZMA_INCLUDE_DIRS - the LZMA include directories 6 | # LZMA_LIBRARIES - the LZMA library 7 | find_package(PkgConfig) 8 | 9 | pkg_check_modules(LZMA_PKGCONF liblzma) 10 | 11 | find_path(LZMA_INCLUDE_DIRS 12 | NAMES lzma.h 13 | PATHS ${LZMA_PKGCONF_INCLUDE_DIRS} 14 | ) 15 | 16 | 17 | find_library(LZMA_LIBRARIES 18 | NAMES lzma 19 | PATHS ${LZMA_PKGCONF_LIBRARY_DIRS} 20 | ) 21 | 22 | include(FindPackageHandleStandardArgs) 23 | find_package_handle_standard_args(LZMA DEFAULT_MSG LZMA_INCLUDE_DIRS LZMA_LIBRARIES) 24 | 25 | mark_as_advanced(LZMA_INCLUDE_DIRS LZMA_LIBRARIES) 26 | -------------------------------------------------------------------------------- /CMake/FindZSTD.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find ZSTD 2 | # Once done, this will define 3 | # 4 | # ZSTD_FOUND - system has ZSTD 5 | # ZSTD_INCLUDE_DIRS - the ZSTD include directories 6 | # ZSTD_LIBRARIES - the ZSTD library 7 | find_package(PkgConfig) 8 | 9 | pkg_check_modules(ZSTD_PKGCONF libzstd) 10 | 11 | find_path(ZSTD_INCLUDE_DIRS 12 | NAMES zstd.h 13 | PATHS ${ZSTD_PKGCONF_INCLUDE_DIRS} 14 | ) 15 | 16 | 17 | find_library(ZSTD_LIBRARIES 18 | NAMES zstd 19 | PATHS ${ZSTD_PKGCONF_LIBRARY_DIRS} 20 | ) 21 | 22 | include(FindPackageHandleStandardArgs) 23 | find_package_handle_standard_args(ZSTD DEFAULT_MSG ZSTD_INCLUDE_DIRS ZSTD_LIBRARIES) 24 | 25 | mark_as_advanced(ZSTD_INCLUDE_DIRS ZSTD_LIBRARIES) 26 | -------------------------------------------------------------------------------- /debian/apt.lintian-overrides: -------------------------------------------------------------------------------- 1 | # the private library is for internal sharing only 2 | apt: package-name-doesnt-match-sonames 3 | apt: exit-in-shared-library [usr/lib*/libapt-private.so.0.0.0] 4 | # we are implementing our own fallback and it is a minor usecase only 5 | apt: missing-depends-on-sensible-utils sensible-pager [usr/lib*/libapt-private.so.0.0.0] 6 | # these man pages document usage/config for things called via apt 7 | apt: spare-manual-page [usr/share/man*/man1/apt-transport-http.1.gz] 8 | apt: spare-manual-page [usr/share/man*/man1/apt-transport-https.1.gz] 9 | apt: spare-manual-page [usr/share/man*/man1/apt-transport-mirror.1.gz] 10 | apt: spare-manual-page [usr/share/man*/man8/apt-secure.8.gz] 11 | -------------------------------------------------------------------------------- /ftparchive/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${BERKELEY_INCLUDE_DIRS}) 2 | # Definition of the C++ files used to build the program - note that this 3 | # is expanded at CMake time, so you have to rerun cmake if you add or remove 4 | # a file (you can just run cmake . in the build directory) 5 | file(GLOB_RECURSE source "*.cc") 6 | add_executable(apt-ftparchive ${source}) 7 | 8 | # Link the executables against the libraries 9 | target_include_directories(apt-ftparchive PRIVATE ${BERKELEY_INCLUDE_DIRS}) 10 | target_link_libraries(apt-ftparchive apt-pkg apt-private ${BERKELEY_LIBRARIES}) 11 | 12 | # Install the executables 13 | install(TARGETS apt-ftparchive RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 14 | -------------------------------------------------------------------------------- /CMake/FindUdev.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find UDEV 2 | # Once done, this will define 3 | # 4 | # UDEV_FOUND - system has UDEV 5 | # UDEV_INCLUDE_DIRS - the UDEV include directories 6 | # UDEV_LIBRARIES - the UDEV library 7 | find_package(PkgConfig) 8 | 9 | pkg_check_modules(UDEV_PKGCONF libudev) 10 | 11 | find_path(UDEV_INCLUDE_DIRS 12 | NAMES libudev.h 13 | PATHS ${UDEV_PKGCONF_INCLUDE_DIRS} 14 | ) 15 | 16 | 17 | find_library(UDEV_LIBRARIES 18 | NAMES udev 19 | PATHS ${UDEV_PKGCONF_LIBRARY_DIRS} 20 | ) 21 | 22 | include(FindPackageHandleStandardArgs) 23 | find_package_handle_standard_args(Udev DEFAULT_MSG UDEV_INCLUDE_DIRS UDEV_LIBRARIES) 24 | 25 | mark_as_advanced(UDEV_INCLUDE_DIRS UDEV_LIBRARIES) 26 | -------------------------------------------------------------------------------- /test/integration/header-compilation: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | 8 | (for i in $TESTDIR/../../build/include/apt-pkg/*.h; do echo "#include \"$i\""; done) > include.h 9 | 10 | 11 | testone() { 12 | local cxx=$1 13 | shift 14 | 15 | if type $cxx 2>&1 1>/dev/null; then 16 | testsuccess $cxx -c -o /dev/null include.h 17 | testsuccess $cxx -c -o /dev/null -std=c++98 include.h 18 | testsuccess $cxx -c -o /dev/null -std=c++11 include.h 19 | else 20 | msgskip "Compile $cxx is not installed" 21 | fi 22 | } 23 | 24 | testone clang++ 25 | testone g++ 26 | testone g++-4.8 27 | -------------------------------------------------------------------------------- /vendor/blankon/sources.list.in: -------------------------------------------------------------------------------- 1 | # See sources.list(5) manpage for more information 2 | # Remember that CD-ROMs, DVDs and such are managed through the apt-cdrom tool. 3 | deb http://arsip.blankonlinux.or.id/blankon ¤t-codename; main restricted 4 | deb-src http://arsip.blankonlinux.or.id/blankon ¤t-codename; main restricted 5 | 6 | deb http://arsip.blankonlinux.or.id/blankon ¤t-codename;-security main restricted 7 | deb-src http://arsip.blankonlinux.or.id/blankon ¤t-codename;-security main restricted 8 | 9 | deb http://arsip.blankonlinux.or.id/blankon ¤t-codename;-updates main restricted 10 | deb-src http://arsip.blankonlinux.or.id/blankon ¤t-codename;-updates main restricted 11 | -------------------------------------------------------------------------------- /ftparchive/apt-ftparchive.h: -------------------------------------------------------------------------------- 1 | // -*- mode: cpp; mode: fold -*- 2 | // Description /*{{{*/ 3 | /* ###################################################################### 4 | 5 | Writer 6 | 7 | The file writer classes. These write various types of output, sources, 8 | packages and contents. 9 | 10 | ##################################################################### */ 11 | /*}}}*/ 12 | #ifndef APT_FTPARCHIVE_H 13 | #define APT_FTPARCHIVE_H 14 | 15 | #include 16 | 17 | using std::ostream; 18 | using std::ofstream; 19 | 20 | extern ostream c0out; 21 | extern ostream c1out; 22 | extern ostream c2out; 23 | extern ofstream devnull; 24 | extern unsigned Quiet; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /test/interactive-helper/networkless-install-fixes/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | OPTS="-o Dir::Etc::sourcelist=./sources.test.list -o Acquire::http::timeout=20" 4 | 5 | # setup 6 | unset http_proxy 7 | iptables --flush 8 | 9 | echo "No network at all" 10 | ifdown eth0 11 | time apt-get update $OPTS 2>&1 |grep system 12 | ifup eth0 13 | echo "" 14 | 15 | echo "no working DNS (port 53 DROP)" 16 | iptables -A OUTPUT -p udp --dport 53 -j DROP 17 | time apt-get update $OPTS 2>&1 |grep system 18 | iptables --flush 19 | echo "" 20 | 21 | echo "DNS but no access to archive.ubuntu.com (port 80 DROP)" 22 | iptables -A OUTPUT -p tcp --dport 80 -j DROP 23 | time apt-get update $OPTS 2>&1 |grep system 24 | iptables --flush 25 | echo "" 26 | -------------------------------------------------------------------------------- /test/integration/test-bug-1053887-regex-return-failure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | rm -f rootdir/etc/apt/sources.list 10 | rm -f rootdir/etc/apt/sources.list.d/* 11 | 12 | insertinstalledpackage 'foo' 'all' '1' 13 | 14 | testfailureequal "Reading package lists... 15 | Building dependency tree... 16 | Note, selecting 'foo' for regex '^foo$' 17 | Package foo is not available, but is referred to by another package. 18 | This may mean that the package is missing, has been obsoleted, or 19 | is only available from another source 20 | 21 | E: Version '2' for 'foo' was not found" apt install '^foo$'=2 22 | -------------------------------------------------------------------------------- /test/integration/test-bug-733028-gpg-resource-limit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'i386' 8 | 9 | insertpackage 'unstable' 'foobar' 'all' '1' 10 | 11 | setupaptarchive --no-update 12 | 13 | for i in $(seq 1 50); do 14 | touch rootdir/etc/apt/trusted.gpg.d/emptykey-${i}.gpg 15 | done 16 | 17 | testsuccess aptget update 18 | msgtest 'Test for no gpg errors/warnings in' 'apt-get update' 19 | sed -i -e "s#${TMPWORKINGDIRECTORY}#/tmp/tmp.XXXXXX#g" rootdir/tmp/testsuccess.output 20 | if grep -iq 'GPG' rootdir/tmp/testsuccess.output; then 21 | cat rootdir/tmp/testsuccess.output 22 | msgfail 23 | else 24 | msgpass 25 | fi 26 | -------------------------------------------------------------------------------- /test/integration/status-xorg-break-providers: -------------------------------------------------------------------------------- 1 | Package: xserver-xorg-core 2 | Status: install ok installed 3 | Priority: optional 4 | Section: x11 5 | Installed-Size: 4436 6 | Maintainer: Debian X Strike Force 7 | Architecture: i386 8 | Source: xorg-server 9 | Version: 2:1.7.7-8 10 | Breaks: xserver-xorg-video-5 11 | Description: Xorg X server - core server 12 | 13 | Package: xserver-xorg-video-intel 14 | Status: install ok installed 15 | Priority: optional 16 | Section: x11 17 | Installed-Size: 1268 18 | Maintainer: Debian X Strike Force 19 | Architecture: i386 20 | Version: 2:2.13.0-2 21 | Provides: xserver-xorg-video-6 22 | Description: X.Org X server -- Intel i8xx, i9xx display driver 23 | -------------------------------------------------------------------------------- /test/integration/test-apt-cli-update: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | configarchitecture "i386" 9 | 10 | insertpackage 'unstable' 'foo' 'all' '2.0' 11 | insertinstalledpackage 'foo' 'all' '1.0' 12 | 13 | setupaptarchive --no-update 14 | 15 | testfailuremsg 'E: The update command takes no arguments' apt update arguments 16 | 17 | testempty apt update -qq -o pkgCacheFile::Generate=false 18 | testsuccessequal "1 package can be upgraded. Run 'apt list --upgradable' to see it." apt update -qq 19 | 20 | rm -f rootdir/var/lib/dpkg/status 21 | insertinstalledpackage 'foo' 'all' '2.0' 22 | testsuccessequal 'All packages are up to date.' apt update -qq 23 | -------------------------------------------------------------------------------- /CMake/FindXXHASH.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find XXHASH 2 | # Once done, this will define 3 | # 4 | # XXHASH_FOUND - system has XXHASH 5 | # XXHASH_INCLUDE_DIRS - the XXHASH include directories 6 | # XXHASH_LIBRARIES - the XXHASH library 7 | find_package(PkgConfig) 8 | 9 | pkg_check_modules(XXHASH_PKGCONF libxxhash) 10 | 11 | find_path(XXHASH_INCLUDE_DIRS 12 | NAMES xxhash.h 13 | PATHS ${XXHASH_PKGCONF_INCLUDE_DIRS} 14 | ) 15 | 16 | 17 | find_library(XXHASH_LIBRARIES 18 | NAMES xxhash 19 | PATHS ${XXHASH_PKGCONF_LIBRARY_DIRS} 20 | ) 21 | 22 | include(FindPackageHandleStandardArgs) 23 | find_package_handle_standard_args(XXHASH DEFAULT_MSG XXHASH_INCLUDE_DIRS XXHASH_LIBRARIES) 24 | 25 | mark_as_advanced(XXHASH_INCLUDE_DIRS XXHASH_LIBRARIES) 26 | -------------------------------------------------------------------------------- /apt-pkg/update.h: -------------------------------------------------------------------------------- 1 | // -*- mode: cpp; mode: fold -*- 2 | // Description /*{{{*/ 3 | /* ###################################################################### 4 | 5 | Update - ListUpdate related code 6 | 7 | ##################################################################### */ 8 | /*}}}*/ 9 | 10 | #ifndef PKGLIB_UPDATE_H 11 | #define PKGLIB_UPDATE_H 12 | 13 | class pkgAcquireStatus; 14 | class pkgSourceList; 15 | class pkgAcquire; 16 | 17 | APT_PUBLIC bool ListUpdate(pkgAcquireStatus &progress, pkgSourceList &List, int PulseInterval=0); 18 | APT_PUBLIC bool AcquireUpdate(pkgAcquire &Fetcher, int const PulseInterval = 0, 19 | bool const RunUpdateScripts = true, bool const ListCleanup = true); 20 | 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | Language: Cpp 2 | # BasedOnStyle 3 | 4 | TabWidth: 8 5 | UseTab: Always 6 | IndentWidth: 3 7 | ContinuationIndentWidth: 3 8 | ColumnLimit: 0 9 | BreakBeforeBraces: Allman 10 | AccessModifierOffset: 0 11 | IncludeCategories: 12 | - Regex: 'apti18n.h' 13 | Priority: 9999 14 | - Regex: 'apt-[^/]*/' 15 | Priority: 20 16 | - Regex: '^"' 17 | Priority: 10 18 | - Regex: 'config.h' 19 | Priority: 0 20 | - Regex: '(zlib|bzlib|lzma|lz4frame|gtest/gtest|db|gnutls/.*)\.h' 21 | Priority: 30 22 | - Regex: '\.h' 23 | Priority: 100 24 | - Regex: '.*' 25 | Priority: 99 26 | -------------------------------------------------------------------------------- /ftparchive/byhash.h: -------------------------------------------------------------------------------- 1 | // -*- mode: cpp; mode: fold -*- 2 | // Description /*{{{*/ 3 | /* ###################################################################### 4 | 5 | ByHash 6 | 7 | ByHash helper functions 8 | 9 | ##################################################################### */ 10 | /*}}}*/ 11 | #ifndef BYHASH_H 12 | #define BYHASH_H 13 | 14 | #include 15 | 16 | class HashString; 17 | 18 | // Delete all files in "dir" except for the number specified in "KeepFiles" 19 | // that are the most recent ones 20 | void DeleteAllButMostRecent(std::string dir, int KeepFiles); 21 | 22 | // takes a regular input filename 23 | std::string GenByHashFilename(std::string Input, HashString const &h); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /vendor/blankon/apt-vendor.ent: -------------------------------------------------------------------------------- 1 | 2 | 3 | blankon-keyring"> 4 | 5 | 6 | 9 | 10 | 14 | -------------------------------------------------------------------------------- /CMake/FindSECCOMP.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find SECCOMP 2 | # Once done, this will define 3 | # 4 | # SECCOMP_FOUND - system has SECCOMP 5 | # SECCOMP_INCLUDE_DIRS - the SECCOMP include directories 6 | # SECCOMP_LIBRARIES - the SECCOMP library 7 | find_package(PkgConfig) 8 | 9 | pkg_check_modules(SECCOMP_PKGCONF libseccomp) 10 | 11 | find_path(SECCOMP_INCLUDE_DIRS 12 | NAMES seccomp.h 13 | PATHS ${SECCOMP_PKGCONF_INCLUDE_DIRS} 14 | ) 15 | 16 | 17 | find_library(SECCOMP_LIBRARIES 18 | NAMES seccomp 19 | PATHS ${SECCOMP_PKGCONF_LIBRARY_DIRS} 20 | ) 21 | 22 | include(FindPackageHandleStandardArgs) 23 | find_package_handle_standard_args(SECCOMP DEFAULT_MSG SECCOMP_INCLUDE_DIRS SECCOMP_LIBRARIES) 24 | 25 | mark_as_advanced(SECCOMP_INCLUDE_DIRS SECCOMP_LIBRARIES) 26 | -------------------------------------------------------------------------------- /CMake/FindSystemd.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find SYSTEMD 2 | # Once done, this will define 3 | # 4 | # SYSTEMD_FOUND - system has SYSTEMD 5 | # SYSTEMD_INCLUDE_DIRS - the SYSTEMD include directories 6 | # SYSTEMD_LIBRARIES - the SYSTEMD library 7 | find_package(PkgConfig) 8 | 9 | pkg_check_modules(SYSTEMD_PKGCONF libsystemd) 10 | 11 | find_path(SYSTEMD_INCLUDE_DIRS 12 | NAMES systemd/sd-bus.h 13 | PATHS ${SYSTEMD_PKGCONF_INCLUDE_DIRS} 14 | ) 15 | 16 | find_library(SYSTEMD_LIBRARIES 17 | NAMES systemd 18 | PATHS ${SYSTEMD_PKGCONF_LIBRARY_DIRS} 19 | ) 20 | 21 | include(FindPackageHandleStandardArgs) 22 | find_package_handle_standard_args(Systemd DEFAULT_MSG SYSTEMD_INCLUDE_DIRS SYSTEMD_LIBRARIES) 23 | 24 | mark_as_advanced(SYSTEMD_INCLUDE_DIRS SYSTEMD_LIBRARIES) 25 | -------------------------------------------------------------------------------- /test/integration/test-apt-get-remove-depends: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'i386' 8 | 9 | buildsimplenativepackage 'alpha' 'all' '1' 'unstable' 'Depends: beta' 10 | buildsimplenativepackage 'beta' 'all' '1' 'unstable' 11 | setupaptarchive 12 | 13 | testsuccess aptget install alpha -y 14 | 15 | cat > rootdir/var/lib/dpkg/info/alpha.prerm << EOF 16 | #!/bin/sh 17 | exit 42 18 | EOF 19 | chmod 755 rootdir/var/lib/dpkg/info/alpha.prerm 20 | 21 | 22 | testdpkginstalled 'alpha' 'beta' 23 | 24 | 25 | testfailure aptget remove -y beta 26 | 27 | # Beta should not be removed because alpha failed to be removed and depends on it 28 | 29 | testdpkginstalled 'alpha' 'beta' 30 | -------------------------------------------------------------------------------- /test/integration/test-bug-734922-apt-showsrc-duplicate: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR=$(readlink -f $(dirname $0)) 5 | . $TESTDIR/framework 6 | setupenvironment 7 | configarchitecture 'i386' 8 | 9 | # foo is identical, show it only once in showsrc 10 | insertpackage "unstable" "foo" "i386" "1.0" 11 | insertpackage "testing" "foo" "i386" "1.0" 12 | insertsource "unstable" "foo" "i386" "1.0" 13 | insertsource "testing" "foo" "i386" "1.0" 14 | 15 | # bar is different, show twice 16 | insertsource "unstable" "bar" "i386" "1.0" 17 | insertsource "testing" "bar" "i386" "2.0" 18 | 19 | setupaptarchive 20 | 21 | # ensure "foo" is not shown twice 22 | aptcache showsrc foo bar|grep ^Package: > out.txt 23 | testequal "Package: foo 24 | Package: bar 25 | Package: bar" cat out.txt 26 | -------------------------------------------------------------------------------- /apt-private/private-show.h: -------------------------------------------------------------------------------- 1 | #ifndef APT_PRIVATE_SHOW_H 2 | #define APT_PRIVATE_SHOW_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | class CommandLine; 11 | class pkgCacheFile; 12 | 13 | APT_PUBLIC bool ShowPackage(CommandLine &CmdL); 14 | APT_PUBLIC bool ShowSrcPackage(CommandLine &CmdL); 15 | APT_PUBLIC bool Policy(CommandLine &CmdL); 16 | 17 | pkgRecords::Parser &LookupParser(pkgRecords &Recs, pkgCache::VerIterator const &V, pkgCache::VerFileIterator &Vf); 18 | bool DisplayRecordV1(pkgCacheFile &CacheFile, pkgRecords &Recs, 19 | pkgCache::VerIterator const &V, pkgCache::VerFileIterator const &Vf, 20 | char const *Buffer, size_t const Length, std::ostream &out); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /test/integration/test-bug-732746-preferences: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'i386' 8 | 9 | insertinstalledpackage 'bar' 'i386' '1.0' 10 | 11 | cat > rootdir/etc/apt/preferences << EOF 12 | # random test comment header 13 | 14 | # commented out by puppy^Wpuppet 15 | #Package: foo 16 | #Pin: origin "ftp.debian.org" 17 | #Pin: 800 18 | 19 | Package: bar 20 | Pin: version 1.0 21 | Pin-Priority: 700 22 | 23 | #Package: bar 24 | #Pin: version 1.0 25 | #Pin: 800 26 | EOF 27 | 28 | testsuccessequal "Reading package lists... 29 | Building dependency tree..." aptget check 30 | 31 | msgtest "Ensure policy is applied" 32 | aptcache policy bar|grep -q "*** 1.0 700" && msgpass || msgfail 33 | -------------------------------------------------------------------------------- /abicheck/run_abi_test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # ensure we are in the abibreak subdirectory 4 | cd "$(readlink -f $(dirname $0))" 5 | 6 | if [ ! -d ../build ]; then 7 | echo "../build missing, did you run make?" 8 | exit 1 9 | fi 10 | 11 | if ! command -v abi-compliance-checker 2>/dev/null >&2; then 12 | echo "Please install the 'abi-compliance-checker' package" 13 | exit 1 14 | fi 15 | 16 | LIBPATH=$(find /usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH) -type f -regex '.*/libapt-\(pkg\|inst\)\.so\..*' -printf %p\\\\n) 17 | sed s#@installed_libapt@#$LIBPATH# apt_installed.xml.in > apt_installed.xml 18 | 19 | BUILDPATH=$(readlink -f ../build) 20 | sed s#@build_path@#$BUILDPATH# apt_build.xml.in > apt_build.xml 21 | 22 | abi-compliance-checker -l apt -d1 apt_installed.xml -d2 apt_build.xml $@ 23 | -------------------------------------------------------------------------------- /cmdline/apt-report-mirror-failure: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # 3 | # This is a stub that is meant to support failure reporting of 4 | # mirrors to a central database 5 | # 6 | # its currently not used 7 | 8 | import sys 9 | import urllib 10 | import apt_pkg 11 | 12 | apt_pkg.init() 13 | url = apt_pkg.Config.find("Acquire::Mirror::ReportFailures", "") 14 | #"http://people.ubuntu.com:9000/mirror-failure") 15 | #"http://localhost:9000/mirror-failure") 16 | if not url: 17 | sys.exit(0) 18 | 19 | print "Reporting mirror failure to '%s'" % url 20 | 21 | data = {} 22 | data['mirror'] = sys.argv[1] 23 | data['failurl'] = sys.argv[2] 24 | data['error'] = sys.argv[3] 25 | f = urllib.urlopen(url, urllib.urlencode(data)) 26 | f.read() 27 | f.close() 28 | 29 | 30 | -------------------------------------------------------------------------------- /test/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | insertinstalledpackage 'custom' 'amd64' '1.0' 'Pre-Depends: grub-pc | grub' 10 | insertinstalledpackage 'grub' 'amd64' '1.0' 11 | insertpackage 'unstable' 'custom' 'amd64' '2.0' 'Pre-Depends: grub-pc | grub' 12 | 13 | setupaptarchive 14 | 15 | testsuccessequal 'Reading package lists... 16 | Building dependency tree... 17 | Calculating upgrade... 18 | The following packages will be upgraded: 19 | custom 20 | 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 21 | Inst custom [1.0] (2.0 unstable [amd64]) 22 | Conf custom (2.0 unstable [amd64])' aptget dist-upgrade -s 23 | -------------------------------------------------------------------------------- /test/integration/test-bug-921685-binary-detached-signature: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | insertpackage 'unstable' 'foo' 'all' '1' 10 | 11 | buildaptarchive 12 | setupdistsaptarchive 13 | 14 | for RELEASE in $(find aptarchive -name 'Release'); do 15 | # note the missing --armor 16 | if command sq --cli-version 0.40 version 2>/dev/null; then 17 | sq sign --binary --signer-file "keys/joesixpack.sec" --output "${RELEASE}.gpg" --signature-file "${RELEASE}" 18 | else 19 | sq sign --binary --signer-file "keys/joesixpack.sec" --signature-file "${RELEASE}.gpg" "${RELEASE}" 20 | fi 21 | done 22 | 23 | testfailure apt show foo 24 | testfailure aptget update 25 | testfailure apt show foo 26 | -------------------------------------------------------------------------------- /test/thread-safety/not-thread-safe.sh: -------------------------------------------------------------------------------- 1 | git grep -p --color -n -E "$(grep -v ^# test/thread-safety/thread-check.txt | sed 's/(.*/\\\\ *\\\\(/' | xargs | tr ' ' '|')" \ 2 | apt-inst/ apt-pkg/ | ansi2html | ssh alioth.debian.org 'cat > /home/groups/apt/htdocs/not-thread-safe/index.html' 3 | git grep -p --color -n -E "$(grep ^# test/thread-safety/thread-check.txt | cut -f2 -d# | sed 's/(.*/\\\\ *\\\\(/' | xargs | tr ' ' '|')" \ 4 | apt-inst/ apt-pkg/ | ansi2html | ssh alioth.debian.org 'cat > /home/groups/apt/htdocs/not-thread-safe/portable.html' 5 | 6 | git grep -p --color -n -E "$(grep -v ^# test/thread-safety/thread-check-internal.txt | sed 's/(.*/\\\\ *\\\\(/' | xargs | tr ' ' '|')" \ 7 | apt-inst/ apt-pkg/ | ansi2html | ssh alioth.debian.org 'cat > /home/groups/apt/htdocs/not-thread-safe/internal.html' 8 | -------------------------------------------------------------------------------- /test/integration/test-bug-lp1445239-download-loop: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # this is a regression test for LP: #1445239 where a partial download can 4 | # trigger an endless hang of the download method 5 | # 6 | 7 | set -e 8 | 9 | TESTDIR="$(readlink -f "$(dirname "$0")")" 10 | . "$TESTDIR/framework" 11 | setupenvironment 12 | configarchitecture 'amd64' 13 | 14 | changetowebserver 15 | 16 | TESTFILE='aptarchive/testfile' 17 | dd if=/dev/zero of=$TESTFILE bs=100k count=1 2>/dev/null 18 | 19 | DOWNLOADLOG='rootdir/tmp/testdownloadfile.log' 20 | 21 | TARGET=./downloaded/testfile-downloaded 22 | dd if=/dev/zero of=$TARGET bs=99k count=1 2>/dev/null 23 | if ! downloadfile http://localhost:${APTHTTPPORT}/testfile "$TARGET" > "$DOWNLOADLOG"; then 24 | cat >&2 "$DOWNLOADLOG" 25 | msgfail 26 | else 27 | msgpass 28 | fi 29 | -------------------------------------------------------------------------------- /apt-pkg/init.h: -------------------------------------------------------------------------------- 1 | // -*- mode: cpp; mode: fold -*- 2 | // Description /*{{{*/ 3 | /* ###################################################################### 4 | 5 | Init - Initialize the package library 6 | 7 | This function must be called to configure the config class before 8 | calling many APT library functions. 9 | 10 | ##################################################################### */ 11 | /*}}}*/ 12 | #ifndef PKGLIB_INIT_H 13 | #define PKGLIB_INIT_H 14 | 15 | #include 16 | 17 | class pkgSystem; 18 | class Configuration; 19 | 20 | APT_PUBLIC extern const char *pkgVersion; 21 | APT_PUBLIC extern const char *pkgLibVersion; 22 | 23 | APT_PUBLIC bool pkgInitConfig(Configuration &Cnf); 24 | APT_PUBLIC bool pkgInitSystem(Configuration &Cnf,pkgSystem *&Sys); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /debian/apt.manpages: -------------------------------------------------------------------------------- 1 | usr/share/man/*/*/apt-cache.* 2 | usr/share/man/*/*/apt-cdrom.* 3 | usr/share/man/*/*/apt-config.* 4 | usr/share/man/*/*/apt-get.* 5 | usr/share/man/*/*/apt-mark.* 6 | usr/share/man/*/*/apt-secure.* 7 | usr/share/man/*/*/apt-patterns.* 8 | usr/share/man/*/*/apt.* 9 | usr/share/man/*/*/apt_preferences.* 10 | usr/share/man/*/*/apt_auth.* 11 | usr/share/man/*/*/apt-transport-*.* 12 | usr/share/man/*/*/sources.list.* 13 | usr/share/man/*/apt-cache.* 14 | usr/share/man/*/apt-cdrom.* 15 | usr/share/man/*/apt-config.* 16 | usr/share/man/*/apt-get.* 17 | usr/share/man/*/apt-mark.* 18 | usr/share/man/*/apt-secure.* 19 | usr/share/man/*/apt-patterns.* 20 | usr/share/man/*/apt.* 21 | usr/share/man/*/apt_preferences.* 22 | usr/share/man/*/apt_auth.* 23 | usr/share/man/*/apt-transport-*.* 24 | usr/share/man/*/sources.list.* 25 | -------------------------------------------------------------------------------- /test/integration/status-bug-613420-new-garbage-dependency: -------------------------------------------------------------------------------- 1 | Package: openoffice.org-officebean 2 | Status: install ok installed 3 | Priority: optional 4 | Section: java 5 | Installed-Size: 1656 6 | Maintainer: Debian OpenOffice Team 7 | Architecture: i386 8 | Source: openoffice.org 9 | Version: 1:3.2.1-11+squeeze2 10 | Depends: openoffice.org-core (= 1:3.2.1-11+squeeze2) 11 | Description: office productivity suite -- Java bean 12 | 13 | Package: openoffice.org-core 14 | Status: install ok installed 15 | Priority: optional 16 | Section: editors 17 | Installed-Size: 121724 18 | Maintainer: Debian OpenOffice Team 19 | Architecture: i386 20 | Source: openoffice.org 21 | Version: 1:3.2.1-11+squeeze2 22 | Description: office productivity suite -- arch-dependent files 23 | -------------------------------------------------------------------------------- /test/interactive-helper/aptdropprivs.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | int main(int const argc, const char * argv[]) 11 | { 12 | CommandLine::Args Args[] = { 13 | {'c',"config-file",0,CommandLine::ConfigFile}, 14 | {'o',"option",0,CommandLine::ArbItem}, 15 | {0, "user", "APT::Sandbox::User", CommandLine::HasArg}, 16 | {0,0,0,0} 17 | }; 18 | 19 | CommandLine CmdL(Args, _config); 20 | if(CmdL.Parse(argc,argv) == false || DropPrivileges() == false) 21 | { 22 | _error->DumpErrors(std::cerr, GlobalError::DEBUG); 23 | return 42; 24 | } 25 | 26 | return execv(CmdL.FileList[0], const_cast(CmdL.FileList)); 27 | } 28 | -------------------------------------------------------------------------------- /test/integration/skip-avoid-avoiding-breaks-predepends: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'native' 8 | 9 | insertinstalledpackage 'looping' 'native' '1' 10 | insertinstalledpackage 'loop1' 'native' '1' 'Depends: loop2 (= 1)' 11 | insertinstalledpackage 'loop2' 'native' '1' 'Depends: loop1 (= 1)' 12 | 13 | buildsimplenativepackage 'looping' 'native' '1.15.7.2' 'stable' 'Breaks: loop2 (<= 1)' 14 | buildsimplenativepackage 'loop1' 'native' '2' 'stable' 'Depends: loop2 (= 2)' 15 | buildsimplenativepackage 'loop2' 'native' '2' 'stable' 'Depends: loop1 (= 2) 16 | Pre-Depends: looping (>= 1.15)' 17 | 18 | setupaptarchive 19 | 20 | aptget dist-upgrade -y -o Debug::pkgOrderList=1 #-qq >/dev/null 2>&1 21 | testdpkginstalled looping loop1 loop2 22 | -------------------------------------------------------------------------------- /test/integration/test-bug-1120463-multi-arch-provides-version: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | configarchitecture 'amd64' 'i386' 9 | 10 | # This first initializes a "dep-virt" provides, but then lazy-inits the 11 | # dep-virt:amd64 one when this is being used later on. 12 | # In bug 1120463, we accidentally copied version 1.0 instead of 2.0... 13 | insertpackage 'unstable' 'dep' 'amd64' '1.0' 'Provides: dep-virt (= 2.0)' 14 | insertpackage 'unstable' 'app' 'i386' '1.0' 'Depends: dep-virt:amd64 (= 2.0)' 15 | 16 | 17 | setupaptarchive 18 | 19 | testsuccess aptcache showpkg dep 20 | mv rootdir/tmp/testsuccess.output showpkg 21 | testsuccessequal "Provides: 22 | 1.0 - dep-virt:amd64 (= 2.0) dep-virt (= 2.0) " grep ^Provides -A1 showpkg 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/integration/test-bug-829651: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | if [ "$(id -u)" = '0' ]; then 10 | msgskip 'Tests for unreadable files do not work as root' 11 | exit 0 12 | fi 13 | 14 | insertinstalledpackage 'foo' 'amd64' '1' 15 | insertpackage 'unstable' 'foo' 'amd64' '2' 16 | 17 | setupaptarchive 18 | 19 | 20 | testsuccess aptget indextargets 21 | 22 | aptget clean 23 | chmod -r rootdir/var/lib/dpkg/status 24 | 25 | testfailureequal "E: Could not open file ${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status - open (13: Permission denied) 26 | E: Problem opening ${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status 27 | E: The package lists or status file could not be parsed or opened." aptget indextargets 28 | -------------------------------------------------------------------------------- /test/integration/Packages-hashsum-verification: -------------------------------------------------------------------------------- 1 | Package: apt 2 | Version: 0.7.25.3 3 | Architecture: i386 4 | Maintainer: APT Development Team 5 | Installed-Size: 5244 6 | Replaces: libapt-pkg-dev (<< 0.3.7), libapt-pkg-doc (<< 0.3.7) 7 | Provides: libapt-pkg-libc6.9-6-4.8 8 | Suggests: aptitude | synaptic | wajig, dpkg-dev, apt-doc, bzip2, lzma, python-apt 9 | Filename: apt.deb 10 | Size: 0 11 | MD5sum: d41d8cd98f00b204e9800998ecf8427e 12 | Description: Advanced front-end for dpkg 13 | This is Debian's next generation front-end for the dpkg package manager. 14 | It provides the apt-get utility and APT dselect method that provides a 15 | simpler, safer way to install and upgrade packages. 16 | . 17 | APT features complete installation ordering, multiple source capability 18 | and several other unique features, see the Users Guide in apt-doc. 19 | -------------------------------------------------------------------------------- /test/integration/test-bug-745036-new-foreign-invalidates-cache: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | insertpackage 'unstable,installed' 'cool-foo' 'amd64' '1.0' 'Depends: foo' 10 | insertpackage 'unstable,installed' 'foo' 'amd64' '1.0' 'Multi-Arch: foreign' 11 | 12 | setupaptarchive 13 | 14 | testsuccess aptget check -s 15 | 16 | configarchitecture 'amd64' 'i386' 17 | testfailureequal 'E: The package cache was built for different architectures: amd64 vs amd64,i386' aptget check -s -o pkgCacheFile::Generate=false 18 | 19 | testsuccess aptget check -s 20 | 21 | insertinstalledpackage 'awesome-foo' 'i386' '1.0' 'Depends: foo' 22 | 23 | testsuccess aptget check -s 24 | 25 | testsuccess aptget update --no-download 26 | 27 | testsuccess aptget check -s 28 | -------------------------------------------------------------------------------- /test/integration/test-ubuntu-bug-802901-multiarch-early-remove: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 'i386' 8 | 9 | insertinstalledpackage 'libgl1-mesa-glx' 'amd64' '2.0' 'Multi-Arch: same 10 | Provides: libgl1 11 | Conflicts: libgl1' 12 | insertpackage 'unstable' 'libgl1-mesa-glx' 'i386,amd64' '2.0' 'Multi-Arch: same 13 | Provides: libgl1 14 | Conflicts: libgl1' 15 | 16 | setupaptarchive 17 | 18 | testsuccessequal 'Reading package lists... 19 | Building dependency tree... 20 | The following NEW packages will be installed: 21 | libgl1-mesa-glx:i386 22 | 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. 23 | Inst libgl1-mesa-glx:i386 (2.0 unstable [i386]) 24 | Conf libgl1-mesa-glx:i386 (2.0 unstable [i386])' aptget install libgl1-mesa-glx:i386 -s 25 | -------------------------------------------------------------------------------- /test/integration/test-releasefile-verification-noflat: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | configarchitecture "i386" 9 | 10 | export APT_DONT_SIGN='Release.gpg' 11 | insertpackage 'unstable' 'foo' 'i386' '1.0' 12 | setupaptarchive "now" "now + 1 year" 13 | changetowebserver 14 | 15 | SIXPACK="34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE" 16 | 17 | testsuccess aptget update 18 | 19 | msgmsg 'Warm archive with signed-by' 'Joe Sixpack' 20 | sed -i "/^Valid-Until: / a\ 21 | Signed-By: ${SIXPACK}" rootdir/var/lib/apt/lists/*Release 22 | touch -d 'now - 1 year' rootdir/var/lib/apt/lists/*Release 23 | testsuccessequal "Get:1 http://localhost:${APTHTTPPORT} unstable InRelease [$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B] 24 | Reading package lists..." aptget update 25 | testsuccess aptcache show foo 26 | -------------------------------------------------------------------------------- /test/integration/solver3.broken: -------------------------------------------------------------------------------- 1 | test-allow-scores-for-all-dependency-types # TBD: We are lacking single-sided conflicts preferences 2 | test-apt-get-upgrade-by-source # TBD: Upgrading by source is not supported yet, mostly same issue as above 3 | test-apt-install-order-matters-a-bit # Wontfix: Cannot fix, the order is not recorded in the depcache 4 | test-bug-470115-new-and-tighten-recommends # TBD: Calculation of what is already satisfied Recommends is broken 5 | test-prevent-markinstall-multiarch-same-versionscrew # TBD: We consider the skewed ones obsolete and remove them... 6 | test-resolve-by-keep-obsolete-removals # TBD: ResolveByKeep() usage is badly aligned here 7 | test-ubuntu-bug-1304403-obsolete-priority-standard # TBD: Solver3 here happily removes 10 deps to upgrade a package 8 | -------------------------------------------------------------------------------- /test/integration/test-apt-redirect-loop: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | configarchitecture "i386" 9 | 10 | echo 'alright' > aptarchive/working 11 | changetohttpswebserver 12 | webserverconfig 'aptwebserver::redirect::replace::/redirectme3/' '/redirectme/' 13 | webserverconfig 'aptwebserver::redirect::replace::/redirectme2/' '/redirectme3/' 14 | webserverconfig 'aptwebserver::redirect::replace::/redirectme/' '/redirectme2/' 15 | 16 | testfailure apthelper download-file "http://localhost:${APTHTTPPORT}/redirectme/working" httpfile 17 | testsuccess grep 'Redirection loop encountered' rootdir/tmp/testfailure.output 18 | 19 | testfailure apthelper download-file "https://localhost:${APTHTTPSPORT}/redirectme/working" httpsfile 20 | testsuccess grep 'Redirection loop encountered' rootdir/tmp/testfailure.output 21 | -------------------------------------------------------------------------------- /apt-pkg/contrib/cdromutl.h: -------------------------------------------------------------------------------- 1 | // -*- mode: cpp; mode: fold -*- 2 | // Description /*{{{*/ 3 | /* ###################################################################### 4 | 5 | CDROM Utilities - Some functions to manipulate CDROM mounts. 6 | 7 | ##################################################################### */ 8 | /*}}}*/ 9 | #ifndef PKGLIB_CDROMUTL_H 10 | #define PKGLIB_CDROMUTL_H 11 | 12 | #include 13 | 14 | #include 15 | 16 | 17 | // mount cdrom, DeviceName (e.g. /dev/sr0) is optional 18 | APT_PUBLIC bool MountCdrom(std::string Path, std::string DeviceName=""); 19 | APT_PUBLIC bool UnmountCdrom(std::string Path); 20 | APT_PUBLIC bool IdentCdrom(std::string CD,std::string &Res,unsigned int Version = 2); 21 | APT_PUBLIC bool IsMounted(std::string &Path); 22 | APT_PUBLIC std::string FindMountPointForDevice(const char *device); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /test/integration/test-solver3-break-recommends: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | insertpackage 'installed' 'root' 'all' '1' 'Recommends: a | b' 10 | insertpackage 'installed,unstable' 'a' 'all' '1' 11 | insertpackage 'unstable' 'b' 'all' '1' 12 | 13 | setupaptarchive 14 | 15 | msgmsg "b should not be installed" 16 | 17 | testsuccessequal "Reading package lists... 18 | Building dependency tree... 19 | The following packages will be REMOVED: 20 | a 21 | 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. 22 | Remv a [1]" aptget remove a -s 23 | 24 | testsuccessequal "Reading package lists... 25 | Building dependency tree... 26 | The following packages will be REMOVED: 27 | a 28 | 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. 29 | Remv a [1]" apt remove a -s 30 | -------------------------------------------------------------------------------- /test/integration/test-bug-679371-apt-get-autoclean-multiarch: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 'i386' 8 | 9 | buildsimplenativepackage 'pkgall' 'all' '1' 'stable' 10 | buildsimplenativepackage 'pkgnative' 'amd64' '1' 'stable' 11 | buildsimplenativepackage 'pkgforeign' 'i386' '1' 'stable' 12 | 13 | setupaptarchive 14 | 15 | changetowebserver 16 | 17 | testsuccess aptget update 18 | testsuccess aptget install pkgall pkgnative pkgforeign -y 19 | 20 | # if we work with an old dpkg, pkgforeign will be listed differently, 21 | # so test with aptcache for install status instead 22 | testdpkginstalled pkgall pkgnative 23 | testsuccess aptcache show pkgforeign/installed 24 | 25 | testsuccessequal 'Reading package lists... 26 | Building dependency tree... 27 | Reading state information...' aptget autoclean -s 28 | -------------------------------------------------------------------------------- /test/integration/test-bug-879591-dont-warn-for-hidden-but-good-components: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | insertpackage 'stable' 'foo' 'all' '1' 10 | insertpackage 'stable' 'bar' 'all' '1' '' '' '' 'main/debian-installer/others' 11 | insertpackage 'stable-backports' 'foo' 'all' '1+sb' 12 | insertpackage 'stable-backports' 'bar' 'all' '1+sb' '' '' '' 'main/debian-installer/others' 13 | 14 | find aptarchive/dists -path '*/debian-installer/i18n/Translation-en*' -delete 15 | 16 | setupaptarchive --no-update 17 | sed -i -e '/^Codename: / a\ 18 | Components: main contrib' $(find ./aptarchive -name 'Release') 19 | signreleasefiles 20 | 21 | testsuccess aptget update 22 | 23 | sed -i -e 's# main\w*$# main main/debian-installer#' rootdir/etc/apt/sources.list.d/* 24 | 25 | testsuccess aptget update 26 | -------------------------------------------------------------------------------- /test/integration/test-security-no-remote-status: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Test that packages from remote sources cannot set the Status field. 4 | # 5 | set -e 6 | 7 | TESTDIR="$(readlink -f "$(dirname "$0")")" 8 | . "$TESTDIR/framework" 9 | setupenvironment 10 | configarchitecture 'amd64' 11 | 12 | TMPDIR=$(readlink -f .) 13 | 14 | insertpackage 'unstable' 'pretends-installed' 'all' '1' 'Status: install ok installed' 15 | insertinstalledpackage 'really-installed' 'all' '1' 16 | setupaptarchive 17 | 18 | testequal "pretends-installed: 19 | Installed: (none) 20 | Candidate: 1 21 | Version table: 22 | 1 500 23 | 500 file:${TMPDIR}/aptarchive unstable/main all Packages" aptcache policy pretends-installed 24 | 25 | testequal "really-installed: 26 | Installed: 1 27 | Candidate: 1 28 | Version table: 29 | *** 1 100 30 | 100 ${TMPDIR}/rootdir/var/lib/dpkg/status" aptcache policy really-installed 31 | -------------------------------------------------------------------------------- /test/integration/test-srcrecord: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | configarchitecture 'native' 9 | 10 | cat > aptarchive/Sources < 15 | Architecture: all 16 | 17 | Package: broken-field 18 | Binary:, broken-field2 19 | Version: 1.0 20 | Maintainer: Joe Sixpack 21 | Architecture: all 22 | 23 | Package: broken-field-b 24 | Binary: , broken-field-b2 25 | Version: 1.0 26 | Maintainer: Joe Sixpack 27 | Architecture: all 28 | EOF 29 | 30 | setupaptarchive --no-update 31 | 32 | testsuccess aptget update 33 | testsuccess aptcache showsrc space-before-comma1 34 | testsuccess aptcache showsrc broken-field2 35 | testsuccess aptcache showsrc broken-field-b2 36 | -------------------------------------------------------------------------------- /test/libapt/sourcelist_test.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "common.h" 12 | 13 | #include "file-helpers.h" 14 | 15 | TEST(SourceListTest,ParseFileDeb822) 16 | { 17 | auto const file = createTemporaryFile("parsefiledeb822.XXXXXX.sources", 18 | "Types: deb\n" 19 | "URIs: http://ftp.debian.org/debian\n" 20 | "Suites: stable\n" 21 | "Components: main\n" 22 | "Description: short\n" 23 | " long description that can be very long\n" 24 | "\n" 25 | "Types: deb\n" 26 | "URIs: http://ftp.debian.org/debian\n" 27 | "Suites: unstable\n" 28 | "Components: main non-free\n"); 29 | 30 | pkgSourceList sources; 31 | EXPECT_TRUE(sources.Read(file.Name())); 32 | EXPECT_EQ(2u, sources.size()); 33 | } 34 | -------------------------------------------------------------------------------- /apt-pkg/contrib/netrc.h: -------------------------------------------------------------------------------- 1 | // -*- mode: cpp; mode: fold -*- 2 | // SPDX-License-Identifier: GPL-2.0+ 3 | // Description /*{{{*/ 4 | /* ###################################################################### 5 | 6 | netrc file parser - returns the login and password of a give host in 7 | a specified netrc-type file 8 | 9 | This file had this historic note, but now includes further changes 10 | under the GPL-2.0+: 11 | 12 | Originally written by Daniel Stenberg, , et al. and 13 | placed into the Public Domain, do with it what you will. 14 | 15 | ##################################################################### */ 16 | /*}}}*/ 17 | #ifndef NETRC_H 18 | #define NETRC_H 19 | 20 | #include 21 | 22 | #include 23 | 24 | 25 | 26 | class URI; 27 | class FileFd; 28 | 29 | APT_PUBLIC bool MaybeAddAuth(FileFd &NetRCFile, URI &Uri); 30 | #endif 31 | -------------------------------------------------------------------------------- /test/integration/test-prefer-native-architecture-over-higher-priority: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 'arm64' 8 | 9 | insertpackage 'unstable' 'm4' 'amd64' '1' 'Multi-Arch: foreign' 'optional' 10 | insertpackage 'unstable' 'm4' 'arm64' '1' 'Multi-Arch: foreign' 'standard' 11 | insertpackage 'unstable' 'autoconf' 'all' '1' 'Depends: m4' 12 | 13 | setupaptarchive 14 | 15 | testsuccessequal 'Reading package lists... 16 | Building dependency tree... 17 | The following additional packages will be installed: 18 | m4 19 | The following NEW packages will be installed: 20 | autoconf m4 21 | 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. 22 | Inst m4 (1 unstable [amd64]) 23 | Inst autoconf (1 unstable [all]) 24 | Conf m4 (1 unstable [amd64]) 25 | Conf autoconf (1 unstable [all])' aptget install autoconf -s 26 | -------------------------------------------------------------------------------- /doc/srv-records-support.md: -------------------------------------------------------------------------------- 1 | DNS SRV record support in apt 2 | ============================= 3 | 4 | Apt supports a subset of the DNS SRV server records protocol as 5 | described in [RFC 2782](https://tools.ietf.org/html/rfc2782) for service discovery. 6 | 7 | Before connecting to the requested server APT will send a SRV 8 | record request of the form `_$protocol._tcp._$host`, e.g. 9 | `_http._tcp.ftp.debian.org` or `_http._tcp.security.debian.org`. 10 | 11 | If the server sends SRV records 12 | as a reply APT will use those to connect to the server(s) in 13 | this reply. It will honor the `priority` field in the reply. 14 | 15 | However it does not implement the `weight` algorithm as described 16 | in RFC 2782. It will use an equal weight for each server of the 17 | same priority. 18 | 19 | If connecting to a server fails APT will retry with the next one 20 | and remove the server from the list of valid servers for this 21 | session. 22 | 23 | -------------------------------------------------------------------------------- /test/integration/test-solver3-suggests-last: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | insertpackage 'installed' 'avahi-daemon' 'all' '1' 'Suggests: avahi-autoipd' 10 | insertpackage 'installed' 'dhcpd-base' 'all' '1' 'Provides: avahi-autoipd' 11 | insertpackage 'unstable' 'avahi-autoipd' 'all' 2 12 | insertpackage 'unstable' 'dhcpd-base' 'all' '2' 13 | 14 | setupaptarchive 15 | 16 | for command in "aptget upgrade" "aptget dist-upgrade" "apt upgrade" "apt dist-upgrade"; do 17 | testsuccessequal "Reading package lists... 18 | Building dependency tree... 19 | Calculating upgrade... 20 | The following packages will be upgraded: 21 | dhcpd-base 22 | 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 23 | Inst dhcpd-base [1] (2 unstable [all]) 24 | Conf dhcpd-base (2 unstable [all])" $command -s -q 25 | done 26 | 27 | -------------------------------------------------------------------------------- /test/libapt/gtest_runner.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "common.h" 9 | 10 | int main(int argc, char **argv) { 11 | ::testing::InitGoogleTest(&argc, argv); 12 | if (pkgInitSystem(*_config, _system) == false) 13 | return 42; 14 | int const result = RUN_ALL_TESTS(); 15 | if (_error->empty() == false) 16 | { 17 | std::cerr << "The test generated the following global messages:" << std::endl; 18 | _error->DumpErrors(std::cerr); 19 | // messages on the stack can't be right, error out 20 | // even if we have no idea where this message came from 21 | if (result == 0) 22 | { 23 | std::cerr << "All tests successful, but messages were generated, so still a failure!" << std::endl; 24 | return 29; 25 | } 26 | } 27 | return result; 28 | } 29 | -------------------------------------------------------------------------------- /test/integration/test-ubuntu-bug-1651923-requote-https-uri: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | configarchitecture "i386" 9 | 10 | mkdir "aptarchive/target with space" 11 | echo 'alright' > "aptarchive/target with space/working" 12 | changetohttpswebserver 13 | webserverconfig 'aptwebserver::redirect::replace::/targetwithoutspace/' '/target%20with%20space/' 14 | webserverconfig 'aptwebserver::redirect::replace::/targetwithoutspace2/' '/target with space/' 15 | 16 | testsuccess downloadfile "http://localhost:${APTHTTPPORT}/targetwithoutspace/working" httpfile1 17 | testsuccess downloadfile "http://localhost:${APTHTTPPORT}/targetwithoutspace2/working" httpfile2 18 | testsuccess downloadfile "https://localhost:${APTHTTPSPORT}/targetwithoutspace/working" httpsfile1 19 | testsuccess downloadfile "https://localhost:${APTHTTPSPORT}/targetwithoutspace2/working" httpsfile2 20 | -------------------------------------------------------------------------------- /test/integration/test-provides-arch-all: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # In apt 1.9.6, this test would have failed, outputting: 4 | # The following packages will be REMOVED: 5 | # libltdl-dev 6 | # 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. 7 | # Remv libltdl-dev [1] 8 | # 9 | # Because we started inserting groups without packages, and then could not 10 | # properly insert the provides. 11 | 12 | set -e 13 | 14 | TESTDIR="$(readlink -f "$(dirname "$0")")" 15 | . "$TESTDIR/framework" 16 | setupenvironment 17 | configarchitecture "i386" 18 | 19 | insertinstalledpackage 'automake' 'i386' '1' 'Provides: automake-1.16 20 | Source: automake-1.16 21 | Multi-Arch: foreign' 22 | insertinstalledpackage 'libltdl-dev' 'i386' '1' 'Depends: automake-1.16' 23 | 24 | setupaptarchive 25 | 26 | testsuccessequal 'Reading package lists... 27 | Building dependency tree... 28 | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install -f -s 29 | -------------------------------------------------------------------------------- /test/integration/test-bug-753297-upgradable: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'i386' 8 | 9 | cat > rootdir/etc/apt/preferences < 14 | 15 | #include 16 | 17 | class pkgCache; 18 | 19 | class APT_PUBLIC pkgArchiveCleaner 20 | { 21 | /** \brief dpointer placeholder (for later in case we need it) */ 22 | void * const d; 23 | 24 | protected: 25 | virtual void Erase(int const dirfd, char const * const File, 26 | std::string const &Pkg,std::string const &Ver, 27 | struct stat const &St) = 0; 28 | 29 | public: 30 | 31 | bool Go(std::string Dir,pkgCache &Cache); 32 | 33 | pkgArchiveCleaner(); 34 | virtual ~pkgArchiveCleaner(); 35 | }; 36 | 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /apt-pkg/upgrade.h: -------------------------------------------------------------------------------- 1 | // -*- mode: cpp; mode: fold -*- 2 | // Description /*{{{*/ 3 | /* ###################################################################### 4 | 5 | Upgrade - Upgrade/DistUpgrade related code 6 | 7 | ##################################################################### */ 8 | /*}}}*/ 9 | 10 | #ifndef PKGLIB_UPGRADE_H 11 | #define PKGLIB_UPGRADE_H 12 | 13 | #include 14 | #include 15 | 16 | class pkgDepCache; 17 | class OpProgress; 18 | 19 | namespace APT { 20 | namespace Upgrade { 21 | // FIXME: make this "enum class UpgradeMode {" once we enable c++11 22 | enum UpgradeMode { 23 | FORBID_REMOVE_PACKAGES = 1, 24 | FORBID_INSTALL_NEW_PACKAGES = 2, 25 | ALLOW_EVERYTHING = 0 26 | }; 27 | APT_PUBLIC bool Upgrade(pkgDepCache &Cache, int UpgradeMode, OpProgress * const Progress = NULL); 28 | } 29 | } 30 | 31 | APT_PUBLIC bool pkgMinimizeUpgrade(pkgDepCache &Cache); 32 | #endif 33 | -------------------------------------------------------------------------------- /debian/apt.bug-script: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cat <&3 14 | apt-config dump >&3 2>&1 15 | fi 16 | 17 | for config in /etc/apt/preferences /etc/apt/preferences.d/* /etc/apt/sources.list /etc/apt/sources.list.d/* ; do 18 | if [ -f "$config" ]; then 19 | yesno "May I include your $config configuration file? [Y/n] " yep 20 | if [ "$REPLY" = "yep" ]; then 21 | printf "\n-- %s --\n\n" "$config" >&3 22 | cat "$config" >&3 23 | else 24 | printf "\n-- (%s present, but not submitted) --\n\n" "$config" >&3 25 | fi 26 | else 27 | printf "\n-- (no %s present) --\n\n" "$config" >&3 28 | fi 29 | done 30 | -------------------------------------------------------------------------------- /test/integration/test-apt-progress-fd-error: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | configarchitecture 'native' 9 | 10 | mkdir -p usr/bin 11 | touch usr/bin/file-conflict 12 | 13 | buildsimplenativepackage 'foo1' 'native' '0.8.15' 'stable' '' 'pkg with file conflicts' '' '' 'usr/' 14 | buildsimplenativepackage 'foo2' 'native' '0.8.15' 'stable' '' 'pkg with file conflicts' '' '' 'usr/' 15 | insertinstalledpackage 'apport' 'native' '1' 16 | 17 | setupaptarchive 18 | 19 | exec 3> apt-progress.log 20 | testfailure aptget install foo1 foo2 -y -o APT::Status-Fd=3 21 | msgtest 'Ensure correct error message' 'file-conflict' 22 | testsuccess --nomsg grep "foo2_0.8.15_[^.]\+.deb:[0-9.]\+:trying to overwrite '/usr/bin/file-conflict', which is also in package foo1" apt-progress.log 23 | 24 | testsuccess test -s rootdir/var/crash/foo2.0.crash 25 | testsuccess grep '^Package: foo2 0.8.15$' rootdir/var/crash/foo2.0.crash 26 | -------------------------------------------------------------------------------- /test/integration/test-package-reinstallation: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture "i386" 8 | 9 | insertinstalledpackage 'libc-bin' 'i386' '2.13-8' 'Replaces: libc6' 10 | insertpackage 'unstable' 'libc-bin' 'i386' '2.13-8' 'Replaces: libc6' 11 | insertinstalledpackage 'libc6' 'i386' '2.13-8' 'Depends: libc-bin (= 2.13-8)' 12 | insertpackage 'unstable' 'libc6' 'i386' '2.13-8' 'Depends: libc-bin (= 2.13-8)' 13 | insertinstalledpackage 'apt' 'i386' '0.8.15' 'Depends: libc6' 14 | 15 | setupaptarchive 16 | 17 | testsuccessequal 'Reading package lists... 18 | Building dependency tree... 19 | 0 upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 0 not upgraded. 20 | Inst libc-bin [2.13-8] (2.13-8 unstable [i386]) 21 | Conf libc-bin (2.13-8 unstable [i386]) 22 | Inst libc6 [2.13-8] (2.13-8 unstable [i386]) 23 | Conf libc6 (2.13-8 unstable [i386])' aptget install --reinstall libc6 libc-bin -s 24 | -------------------------------------------------------------------------------- /test/integration/Packages-releasefile-verification: -------------------------------------------------------------------------------- 1 | Package: apt 2 | Version: 0.7.25.3 3 | Architecture: i386 4 | Maintainer: APT Development Team 5 | Installed-Size: 5244 6 | Replaces: libapt-pkg-dev (<< 0.3.7), libapt-pkg-doc (<< 0.3.7) 7 | Provides: libapt-pkg-libc6.9-6-4.8 8 | Suggests: aptitude | synaptic | wajig, dpkg-dev, apt-doc, bzip2, lzma, python-apt 9 | Filename: apt.deb 10 | Size: 3 11 | MD5sum: 583f72a833c7dfd63c03edba3776247a 12 | SHA256: 5009a047a11fbd680bb40d2f23cd3fcd626ac2d672c38e16f53bd622c3961534 13 | Description: Advanced front-end for dpkg 14 | This is Debian's next generation front-end for the dpkg package manager. 15 | It provides the apt-get utility and APT dselect method that provides a 16 | simpler, safer way to install and upgrade packages. 17 | . 18 | APT features complete installation ordering, multiple source capability 19 | and several other unique features, see the Users Guide in apt-doc. 20 | Description-md5: d41ee493aa9fcc6cbc9ce4eb7069959c 21 | -------------------------------------------------------------------------------- /test/integration/test-bug-796070-downgrade-realpkg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | configarchitecture 'i386' 9 | 10 | buildsimplenativepackage 'apt' 'all' '1.0.10.1' 'stable' 'Depends: libapt-pkg4.16 (>= 1.0.10.1)' 11 | buildsimplenativepackage 'libapt-pkg4.16' 'all' '1.0.10.1' 'stable' 'Breaks: apt (<< 0.9.4~), libapt-inst1.5 (<< 0.9.9~)' 12 | buildsimplenativepackage 'libapt-pkg5.0' 'all' '1.1~exp9' 'unstable' 'Breaks: apt (<< 1.1~exp4), libapt-inst1.5 (<< 0.9.9~)' 13 | buildsimplenativepackage 'apt' 'all' '1.1~exp9' 'unstable' 'Depends: libapt-pkg5.0' 14 | 15 | setupaptarchive 16 | 17 | # Check with the APT name, aka essential 18 | testsuccess aptget install apt -t stable -y 19 | testsuccess aptget dist-upgrade -y 20 | 21 | testsuccess aptget install apt/stable -y --allow-downgrades -o Debug::pkgPackageManager=1 #-o Debug::pkgDpkgPM=1 22 | testdpkginstalled apt libapt-pkg4.16 23 | testdpkgnotinstalled libapt-pkg5.0 24 | -------------------------------------------------------------------------------- /test/integration/test-provides-gone-with-upgrade: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture "i386" 8 | 9 | insertinstalledpackage 'apt' 'i386' '0.8.14' 'Provides: libapt-pkg4.10' 10 | insertpackage 'unstable' 'apt' 'i386' '0.8.15' 'Depends: libapt-pkg4.10' 11 | insertpackage 'unstable' 'libapt-pkg4.10' 'i386' '0.8.15' 'Breaks: apt (<< 0.8.15) 12 | Replaces: apt (<< 0.8.15)' 13 | 14 | setupaptarchive 15 | 16 | testsuccessequal 'Reading package lists... 17 | Building dependency tree... 18 | Calculating upgrade... 19 | The following NEW packages will be installed: 20 | libapt-pkg4.10 21 | The following packages will be upgraded: 22 | apt 23 | 1 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. 24 | Inst apt [0.8.14] (0.8.15 unstable [i386]) [] 25 | Inst libapt-pkg4.10 (0.8.15 unstable [i386]) 26 | Conf libapt-pkg4.10 (0.8.15 unstable [i386]) 27 | Conf apt (0.8.15 unstable [i386])' aptget dist-upgrade -s 28 | -------------------------------------------------------------------------------- /test/integration/test-bug-737130-multicompress-file-modes: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'i386' 8 | 9 | cat >aptarchive/ftparchive.conf < "${BUILDDIR}/debian/preinst" 17 | buildpackage "$BUILDDIR" 'unstable' 'main' 'native' 18 | rm -rf "$BUILDDIR" 19 | } 20 | 21 | createtestpkg 'one' 22 | createtestpkg 'two' 23 | 24 | setupaptarchive 25 | 26 | 27 | # Inherit from environment 28 | testsuccess aptget install testpkg-one -y -o DPkg::Path="" 29 | cp rootdir/tmp/testsuccess.output apt.log 30 | testsuccess grep "PATH=$PATH" apt.log 31 | 32 | # Set a custom value 33 | testsuccess aptget install testpkg-two -y -o DPkg::Path="foobar:$PATH" 34 | cp rootdir/tmp/testsuccess.output apt.log 35 | testsuccess grep "PATH=foobar:$PATH" apt.log 36 | -------------------------------------------------------------------------------- /test/integration/test-apt-update-reporting: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | for i in $(seq 100); do 10 | insertpackage 'unstable' "foo-$i" 'all' '1.0' 11 | insertsource 'unstable' "foo-$i" 'all' '1.0' 12 | done 13 | 14 | setupaptarchive --no-update 15 | changetowebserver 16 | 17 | aptget update -o Debug::Acquire::Progress=1 2>progress.log >ignore.out 18 | 19 | has_progress() { 20 | prev_percent=0.0 21 | while read line; do 22 | percent="$(echo "$line"|cut -b2-6)" 23 | # need to cut the decimal point and digits because sh can not do 24 | # float compare 25 | if [ "${percent%%.*}" -lt "${prev_percent%%.*}" ]; then 26 | cat progress.log 27 | return 1 28 | fi 29 | prev_percent="$percent" 30 | done < progress.log 31 | return 0 32 | } 33 | 34 | msgtest "Testing that progress does not go backward" 35 | testsuccess --nomsg has_progress 36 | -------------------------------------------------------------------------------- /test/integration/Packages-releasefile-verification-new: -------------------------------------------------------------------------------- 1 | Package: apt 2 | Priority: important 3 | Section: admin 4 | Installed-Size: 5672 5 | Maintainer: APT Development Team 6 | Architecture: i386 7 | Version: 0.8.0~pre1 8 | Replaces: manpages-pl (<< 20060617-3~) 9 | Provides: libapt-pkg4.10 10 | Suggests: aptitude | synaptic | wajig, dpkg-dev, apt-doc, bzip2, lzma, python-apt 11 | Conflicts: python-apt (<< 0.7.93.2~) 12 | Filename: apt.deb 13 | Size: 3 14 | MD5sum: 583f72a833c7dfd63c03edba3776247a 15 | SHA256: 5009a047a11fbd680bb40d2f23cd3fcd626ac2d672c38e16f53bd622c3961534 16 | Description: Advanced front-end for dpkg 17 | This is Debian's next generation front-end for the dpkg package manager. 18 | It provides the apt-get utility and APT dselect method that provides a 19 | simpler, safer way to install and upgrade packages. 20 | . 21 | APT features complete installation ordering, multiple source capability 22 | and several other unique features, see the Users Guide in apt-doc. 23 | Description-md5: d41ee493aa9fcc6cbc9ce4eb7069959c 24 | -------------------------------------------------------------------------------- /test/integration/test-bug-623443-fail-on-bad-proxies: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable' 10 | 11 | setupaptarchive --no-update 12 | changetowebserver 13 | 14 | testsuccess apt update 15 | rm -rf rootdir/var/lib/apt/lists 16 | 17 | export http_proxy=enrico:password@proxy-cache.localnet:3128 18 | testfailure apt update 19 | unset http_proxy 20 | testsuccess grep 'Unsupported proxy configured' rootdir/tmp/testfailure.output 21 | 22 | changetohttpswebserver 23 | 24 | testsuccess apt update 25 | rm -rf rootdir/var/lib/apt/lists 26 | 27 | export http_proxy=enrico:password@proxy-cache.localnet:3128 28 | testfailure apt update 29 | unset http_proxy 30 | testsuccess grep 'Unsupported proxy configured' rootdir/tmp/testfailure.output 31 | 32 | echo 'Acquire::http::Proxy "foo://example.org"; 33 | Acquire::https::Proxy "DIRECT";' > rootdir/etc/apt/apt.conf.d/proxy.conf 34 | testsuccess apt update 35 | -------------------------------------------------------------------------------- /apt-private/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Set the version of the library 2 | set(MAJOR 0.0) 3 | set(MINOR 0) 4 | 5 | # Definition of the C++ files used to build the library - note that this 6 | # is expanded at CMake time, so you have to rerun cmake if you add or remove 7 | # a file (you can just run cmake . in the build directory) 8 | file(GLOB_RECURSE library "*.cc") 9 | file(GLOB_RECURSE headers "*.h") 10 | 11 | # Create a library using the C++ files 12 | add_library(apt-private SHARED ${library}) 13 | 14 | # Link the library and set the SONAME 15 | target_link_libraries(apt-private PUBLIC apt-pkg) 16 | set_target_properties(apt-private PROPERTIES VERSION ${MAJOR}.${MINOR}) 17 | set_target_properties(apt-private PROPERTIES SOVERSION ${MAJOR}) 18 | set_target_properties(apt-private PROPERTIES CXX_VISIBILITY_PRESET hidden) 19 | add_version_script(apt-private) 20 | 21 | # Install the library and the headers 22 | install(TARGETS apt-private 23 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 24 | NAMELINK_SKIP) 25 | 26 | flatify(${PROJECT_BINARY_DIR}/include/apt-private/ "${headers}") 27 | -------------------------------------------------------------------------------- /test/integration/test-apt-get-mark-auto: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | insertpackage 'unstable' 'package' 'all' '3' 10 | 11 | setupaptarchive 12 | 13 | testsuccessequal "Reading package lists... 14 | Building dependency tree... 15 | The following NEW packages will be installed: 16 | package 17 | 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. 18 | Inst package (3 unstable [all]) 19 | Conf package (3 unstable [all])" aptget install package --mark-auto -s 20 | 21 | # Specifically if we mark the package as automatically installed but also have auto-remove on, 22 | # the package should still be installed... 23 | 24 | testsuccessequal "Reading package lists... 25 | Building dependency tree... 26 | The following NEW packages will be installed: 27 | package 28 | 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. 29 | Inst package (3 unstable [all]) 30 | Conf package (3 unstable [all])" aptget install package --mark-auto --auto-remove -s 31 | -------------------------------------------------------------------------------- /test/integration/test-ubuntu-bug-1990586: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | 9 | configarchitecture 'amd64' 10 | 11 | noprogress() { 12 | "$@" | sed /^Progress/d 13 | } 14 | 15 | # The important thing in this bug is that python3.10 and python3.10-defaults are phasing differently, 16 | # so both should be kept back rather than one causing tons of removals. 17 | # This should effectively be a no-op 18 | testsuccessequal "Percentage: 0 19 | Message: Start up solver… 20 | 21 | Percentage: 1 22 | Message: Read request… 23 | 24 | Percentage: 5 25 | Message: Read scenario… 26 | 27 | Percentage: 50 28 | Message: Apply request on scenario… 29 | 30 | Percentage: 60 31 | Message: Call problemresolver on current scenario… 32 | 33 | Percentage: 95 34 | Message: Write solution… 35 | 36 | Autoremove: 74428 37 | Package: systemd-hwe-hwdb:amd64 38 | Version: 249.11.1 39 | 40 | Percentage: 100 41 | Message: Done 42 | " noprogress runapt "${APTHELPERBINDIR}/solvers/apt" < $TESTDIR/edsp-ubuntu-bug-1990586 43 | -------------------------------------------------------------------------------- /vendor/ubuntu/apt-vendor.ent: -------------------------------------------------------------------------------- 1 | 2 | 3 | ubuntu-keyring"> 4 | 5 | 8 | 19 | -------------------------------------------------------------------------------- /test/integration/Packages-bug-598669-install-postfix-gets-exim-heavy: -------------------------------------------------------------------------------- 1 | Package: exim4-daemon-heavy 2 | Priority: optional 3 | Section: mail 4 | Installed-Size: 1060 5 | Maintainer: Exim4 Maintainers 6 | Architecture: i386 7 | Source: exim4 8 | Version: 4.72-1 9 | Replaces: mail-transport-agent 10 | Provides: mail-transport-agent 11 | Conflicts: mail-transport-agent 12 | Filename: pool/main/e/exim4/exim4-daemon-heavy_4.72-1_i386.deb 13 | Size: 508988 14 | MD5sum: 7adf3b0ef8f134e70d19ee216e6f4452 15 | Description: Exim MTA (v4) daemon with extended features, including exiscan-acl 16 | 17 | Package: postfix 18 | Priority: extra 19 | Section: mail 20 | Installed-Size: 3196 21 | Maintainer: LaMont Jones 22 | Architecture: i386 23 | Version: 2.7.1-1 24 | Replaces: mail-transport-agent 25 | Provides: mail-transport-agent 26 | Conflicts: mail-transport-agent 27 | Filename: pool/main/p/postfix/postfix_2.7.1-1_i386.deb 28 | Size: 1325662 29 | MD5sum: 1ef63b6a62b4be120a9cdc312b81a698 30 | Description: High-performance mail transport agent 31 | -------------------------------------------------------------------------------- /test/integration/test-proxy-connect: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable' 10 | 11 | setupaptarchive 12 | changetowebserver --request-absolute='uri' 13 | 14 | 15 | msgmsg 'Check that host header we send for CONNECT is for target, not proxy' 16 | echo "deb https://example.example/ example example" > rootdir/etc/apt/sources.list 17 | rm -f rootdir/etc/apt/sources.list.d/* 18 | echo "Acquire::http::Proxy \"http://localhost:${APTHTTPPORT}\";" > rootdir/etc/apt/apt.conf.d/99proxy 19 | 20 | aptget update >/dev/null 2>&1 21 | testsuccessequal "CONNECT example.example:443 HTTP/1.1\r 22 | Host: example.example:443\r 23 | -- 24 | CONNECT example.example:443 HTTP/1.1\r 25 | Host: example.example:443\r 26 | -- 27 | CONNECT example.example:443 HTTP/1.1\r 28 | Host: example.example:443\r 29 | -- 30 | CONNECT example.example:443 HTTP/1.1\r 31 | Host: example.example:443\r" grep -A1 "^CONNECT" aptarchive/webserver.log 32 | -------------------------------------------------------------------------------- /test/integration/status-bug-598669-install-postfix-gets-exim-heavy: -------------------------------------------------------------------------------- 1 | Package: exim4-daemon-light 2 | Status: install ok installed 3 | Priority: standard 4 | Section: mail 5 | Installed-Size: 952 6 | Maintainer: Exim4 Maintainers 7 | Architecture: i386 8 | Source: exim4 9 | Version: 4.72-1 10 | Replaces: mail-transport-agent 11 | Provides: mail-transport-agent 12 | Conflicts: mail-transport-agent 13 | Filename: pool/main/e/exim4/exim4-daemon-light_4.72-1_i386.deb 14 | Size: 459500 15 | MD5sum: f32ccafef44bed2efcd526cd6501307d 16 | Description: lightweight Exim MTA (v4) daemon 17 | 18 | Package: exim4 19 | Status: install ok installed 20 | Priority: standard 21 | Section: mail 22 | Installed-Size: 60 23 | Maintainer: Exim4 Maintainers 24 | Architecture: all 25 | Version: 4.72-1 26 | Depends: exim4-daemon-light | exim4-daemon-heavy 27 | Filename: pool/main/e/exim4/exim4_4.72-1_all.deb 28 | Size: 7738 29 | MD5sum: 2f473b82bbabac9718ff3e755eaf85c1 30 | Description: metapackage to ease Exim MTA (v4) installation 31 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | # Aliases 2 | 3 | 4 | # Use real mail addresses 5 | 6 | 7 | 8 | Michael Vogt 9 | 10 | 11 | 12 | 13 | 14 | # Very broken names 15 | Christian Perrier bubulle@debian.org <> 16 | Julian Andres Klode jak@debian.org <> 17 | Loïc Minier lool@dooz.org <> 18 | Martin Pitt martin@piware.de <> 19 | 20 | # Spell names properly 21 | Christian Perrier 22 | Joe Hansen 23 | Johannes Schauer Marin Rodrigues 24 | Johannes Schauer Marin Rodrigues 25 | Johannes Schauer Marin Rodrigues 26 | Michael Vogt 27 | Peter Krefting 28 | Trần Ngọc Quân 29 | -------------------------------------------------------------------------------- /test/integration/test-ubuntu-bug-859188-multiarch-reinstall: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 'i386' 'armel' 8 | 9 | buildsimplenativepackage 'libsame' 'amd64,i386,armel' '1.0' 'unstable' 'Multi-Arch: same' 10 | 11 | setupaptarchive 12 | 13 | testsuccess aptget install libsame libsame:i386 14 | 15 | REINSTALL='Reading package lists... 16 | Building dependency tree... 17 | Reading state information... 18 | 0 upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 0 not upgraded. 19 | Inst libsame [1.0] (1.0 unstable [amd64]) 20 | Inst libsame:i386 [1.0] (1.0 unstable [i386]) 21 | Conf libsame (1.0 unstable [amd64]) 22 | Conf libsame:i386 (1.0 unstable [i386])' 23 | 24 | testsuccessequal "$REINSTALL" aptget install --reinstall libsame -s 25 | testsuccessequal "$REINSTALL" aptget install --reinstall libsame:amd64 -s 26 | testsuccessequal "$REINSTALL" aptget install --reinstall libsame:i386 -s 27 | testsuccessequal "$REINSTALL" aptget install --reinstall libsame:amd64 libsame:i386 -s 28 | -------------------------------------------------------------------------------- /test/integration/test-apt-get-source-authenticated: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Regression test for debian bug #749795. Ensure that we fail with 4 | # an error if apt-get source foo will download a source that comes 5 | # from an unauthenticated repository 6 | # 7 | set -e 8 | 9 | TESTDIR="$(readlink -f "$(dirname "$0")")" 10 | . "$TESTDIR/framework" 11 | 12 | setupenvironment 13 | configarchitecture "i386" 14 | 15 | # a "normal" package with source and binary 16 | buildsimplenativepackage 'foo' 'all' '2.0' 17 | 18 | setupaptarchive --no-update 19 | 20 | APTARCHIVE="$(readlink -f ./aptarchive)" 21 | find "$APTARCHIVE/dists/unstable" -name '*Release*' -delete 22 | 23 | # update without authenticated InRelease file 24 | testwarning aptget update --allow-insecure-repositories 25 | 26 | # this all should fail 27 | testfailure aptget install -y foo 28 | cd downloaded 29 | testfailure aptget source foo 30 | testfailure test -e foo_2.0.dsc 31 | # allow overriding the warning 32 | testsuccess aptget source --allow-unauthenticated foo -o Debug::pkgAcquire::Worker=1 33 | testsuccess test -s foo_2.0.dsc -a -L foo_2.0.dsc 34 | -------------------------------------------------------------------------------- /test/interactive-helper/extract-control.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | using namespace std; 12 | 13 | static bool ExtractMember(const char *File,const char *Member) 14 | { 15 | FileFd Fd(File,FileFd::ReadOnly); 16 | debDebFile Deb(Fd); 17 | if(_error->PendingError() == true) 18 | return false; 19 | 20 | debDebFile::MemControlExtract Extract(Member); 21 | if (Extract.Read(Deb) == false) 22 | return false; 23 | 24 | if (Extract.Control == 0) 25 | return true; 26 | 27 | return write(STDOUT_FILENO,Extract.Control,Extract.Length) != -1; 28 | } 29 | 30 | int main(int argc, const char *argv[]) 31 | { 32 | if (argc < 2) 33 | { 34 | cerr << "Need two arguments, a .deb and the control member" << endl; 35 | return 100; 36 | } 37 | 38 | if (ExtractMember(argv[1],argv[2]) == false) 39 | { 40 | _error->DumpErrors(); 41 | return 100; 42 | } 43 | 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /test/integration/test-apt-cli-upgrade: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | configarchitecture "i386" 9 | 10 | insertpackage 'unstable' 'foo' 'all' '2.0' 'Depends: foo-new-dependency' 11 | insertpackage 'unstable' 'foo-new-dependency' 'all' '2.0' 12 | insertinstalledpackage 'foo' 'all' '1.0' 13 | 14 | setupaptarchive 15 | 16 | APTARCHIVE="$(readlink -f ./aptarchive)" 17 | 18 | # default is to allow new dependencies 19 | testsuccessequal "The following NEW packages will be installed: 20 | foo-new-dependency 21 | The following packages will be upgraded: 22 | foo 23 | 1 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. 24 | Inst foo-new-dependency (2.0 unstable [all]) 25 | Inst foo [1.0] (2.0 unstable [all]) 26 | Conf foo-new-dependency (2.0 unstable [all]) 27 | Conf foo (2.0 unstable [all])" apt upgrade -qq -s 28 | 29 | # ensure the 'old' way works as well 30 | testsuccessequal "The following packages have been kept back: 31 | foo 32 | 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded." apt upgrade -qq -s --no-new-pkgs 33 | -------------------------------------------------------------------------------- /test/interactive-helper/networkless-install-fixes/sources.test.list: -------------------------------------------------------------------------------- 1 | 2 | # archive.ubuntu.com 3 | deb http://archive.ubuntu.com/ubuntu/ hardy main restricted 4 | deb-src http://archive.ubuntu.com/ubuntu/ hardy main restricted 5 | 6 | deb http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted 7 | deb-src http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted 8 | 9 | deb http://archive.ubuntu.com/ubuntu/ hardy universe 10 | deb-src http://archive.ubuntu.com/ubuntu/ hardy universe 11 | 12 | deb http://archive.ubuntu.com/ubuntu/ hardy-updates universe 13 | deb-src http://archive.ubuntu.com/ubuntu/ hardy-updates universe 14 | 15 | # security.ubuntu.com 16 | deb http://security.ubuntu.com/ubuntu/ hardy-security main restricted 17 | deb-src http://security.ubuntu.com/ubuntu/ hardy-security main restricted 18 | 19 | deb http://security.ubuntu.com/ubuntu/ hardy-security universe 20 | deb-src http://security.ubuntu.com/ubuntu/ hardy-security universe 21 | 22 | 23 | # archive.canonical.com 24 | deb http://archive.canonical.com/ubuntu/ hardy-partner universe 25 | deb-src http://archive.canonical.com/ubuntu/ hardy-partner universe 26 | -------------------------------------------------------------------------------- /test/integration/test-bug-709560-set-candidate-release: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | insertpackage 'experimental' 'foo' 'all' '2.0' 'Depends: foo-dep (= 2.1)' 10 | insertpackage 'experimental' 'foo-dep' 'all' '2.1' 11 | 12 | 13 | ( 14 | cat < rootdir/etc/apt/preferences 20 | 21 | 22 | setupaptarchive 23 | 24 | testsuccessequal "Reading package lists... 25 | Building dependency tree... 26 | Selected version '2.0' (experimental [all]) for 'foo' 27 | Selected version '2.1' (experimental [all]) for 'foo-dep' because of 'foo' 28 | The following additional packages will be installed: 29 | foo-dep 30 | The following NEW packages will be installed: 31 | foo foo-dep 32 | 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. 33 | Inst foo-dep (2.1 experimental [all]) 34 | Inst foo (2.0 experimental [all]) 35 | Conf foo-dep (2.1 experimental [all]) 36 | Conf foo (2.0 experimental [all])" aptget install -q0 -s foo/experimental 37 | -------------------------------------------------------------------------------- /test/integration/test-bug-718329-support-data.tar-uncompressed: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | art() { 5 | ar t "$@" | grep -v control.tar 6 | } 7 | 8 | test_process_package_with_compression() { 9 | COMPRESSOR="$1" 10 | DATA_TAR="$2" 11 | 12 | msgmsg "Testing apt-ftparchive with compression type: $COMPRESSOR" 13 | 14 | buildsimplenativepackage 'pkg' 'all' '1.0' '' '' 'some descr' '' '' '' "$COMPRESSOR" 15 | testsuccessequal "debian-binary 16 | $DATA_TAR" art incoming/pkg_1.0_all.deb 17 | 18 | testequal "Package: pkg" echo "$(aptftparchive packages incoming/|grep ^Package)" 19 | 20 | testsuccessequal "usr/bin/pkg-all pkg 21 | usr/share/doc/pkg/FEATURES pkg 22 | usr/share/doc/pkg/changelog pkg 23 | usr/share/doc/pkg/copyright pkg" aptftparchive contents incoming/ 24 | 25 | rm -rf incoming/* 26 | } 27 | 28 | TESTDIR="$(readlink -f "$(dirname "$0")")" 29 | . "$TESTDIR/framework" 30 | 31 | setupenvironment 32 | test_process_package_with_compression "gzip" "data.tar.gz" 33 | test_process_package_with_compression "none" "data.tar" 34 | test_process_package_with_compression "xz" "data.tar.xz" 35 | -------------------------------------------------------------------------------- /test/integration/test-bug-605394-versioned-or-groups: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture "i386" 8 | setupaptarchive 9 | 10 | testfailureequal "Reading package lists... 11 | Building dependency tree... 12 | Calculating upgrade... 13 | The following packages will be upgraded: 14 | php5 php5-cgi 15 | 2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 16 | Need to get 0 B/5715 kB of archives. 17 | After this operation, 0 B of additional disk space will be used. 18 | E: Trivial Only specified but this is not a trivial operation." aptget dist-upgrade --trivial-only 19 | 20 | msgtest "Solution process doesn't involve" 'apache2-mpm-prefork' 21 | 22 | if aptget dist-upgrade --trivial-only -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 2>&1 | grep apache2-mpm-prefork > /dev/null; then 23 | msgfail 24 | else 25 | msgpass 26 | fi 27 | 28 | # the Packages file includes only MD5 29 | testfailure aptget dist-upgrade -y 30 | testsuccess grep 'Insufficient information available to perform this download securely' rootdir/tmp/testfailure.output 31 | -------------------------------------------------------------------------------- /test/interactive-helper/test_fileutl.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | static void callsystem(std::string const &call) 18 | { 19 | auto ret = system(call.c_str()); 20 | if (WIFEXITED(ret) == false || WEXITSTATUS(ret) != 0) 21 | _error->Error("Calling %s failed!", call.c_str()); 22 | } 23 | 24 | int main(int, char ** argv) 25 | { 26 | auto const pid = getpid(); 27 | std::string ls; 28 | strprintf(ls, "ls -l /proc/%d/fd", pid); 29 | callsystem(ls); 30 | FileFd t; 31 | t.Open(argv[1], FileFd::ReadOnly, FileFd::Extension); 32 | callsystem(ls); 33 | char buf[1024]; 34 | unsigned long long act; 35 | while (t.Read(buf, sizeof(buf), &act)) 36 | if (act == 0) 37 | break; 38 | callsystem(ls); 39 | t.Seek(5); 40 | callsystem(ls); 41 | t.Close(); 42 | callsystem(ls); 43 | auto const ret = _error->PendingError(); 44 | _error->DumpErrors(); 45 | return ret; 46 | } 47 | -------------------------------------------------------------------------------- /test/integration/status-bug-612557-garbage-upgrade: -------------------------------------------------------------------------------- 1 | Package: python-uno 2 | Status: install ok installed 3 | Priority: optional 4 | Section: python 5 | Installed-Size: 2032 6 | Maintainer: Debian OpenOffice Team 7 | Architecture: i386 8 | Source: openoffice.org 9 | Version: 1:3.2.1-11+squeeze2 10 | Description: Python-UNO bridge 11 | 12 | Package: openoffice.org-common 13 | Status: install ok installed 14 | Priority: optional 15 | Section: editors 16 | Installed-Size: 48356 17 | Maintainer: Debian OpenOffice Team 18 | Architecture: all 19 | Source: openoffice.org 20 | Version: 1:3.2.1-11+squeeze2 21 | Description: office productivity suite -- arch-independent files 22 | 23 | Package: openoffice.org-emailmerge 24 | Status: install ok installed 25 | Priority: optional 26 | Section: editors 27 | Installed-Size: 1652 28 | Maintainer: Debian OpenOffice Team 29 | Architecture: all 30 | Source: openoffice.org 31 | Version: 1:3.2.1-11+squeeze2 32 | Replaces: python-uno (<< 1:2.4.1-5) 33 | Pre-Depends: python-uno, openoffice.org-common 34 | Description: office productivity suite -- email mail merge 35 | -------------------------------------------------------------------------------- /test/integration/test-bug-992993-marked-cycles: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | insertinstalledpackage 'librust-nom-4-dev' 'all' '4.2.3-3' 'Provides: librust-nom-dev (= 4.2.3-3)' 10 | insertinstalledpackage 'librust-nom-dev' 'all' '5.0.1-4' 'Depends: librust-nom+default-dev (= 5.0.1-4)' 11 | insertinstalledpackage 'librust-nom+default-dev ' 'all' '5.0.1-4' 'Depends: librust-nom-dev (= 5.0.1-4)' 12 | insertinstalledpackage 'librust-nom-4+std-dev' 'all' '4.2.3-3' 'Provides: librust-nom+default-dev (= 4.2.3-3)' 13 | 14 | insertinstalledpackage 'foo' 'all' '1' 'Depends: librust-nom-4-dev, librust-nom-dev, librust-nom-4+std-dev' 15 | 16 | for AUTO in '' 'librust-nom-4-dev' 'librust*' 'foo' '.*'; do 17 | msgmsg 'Running test with these packages marked auto:' "$AUTO" 18 | testsuccess aptmark manual '.*' 19 | if [ -n "$AUTO" ]; then 20 | testsuccess aptmark auto "$AUTO" 21 | fi 22 | 23 | testsuccess aptget check 24 | testsuccess aptget autoremove -s 25 | 26 | testsuccess aptget upgrade 27 | testsuccess aptget full-upgrade 28 | 29 | testsuccess apt show foo 30 | done 31 | -------------------------------------------------------------------------------- /CMake/apti18n.h.in: -------------------------------------------------------------------------------- 1 | // -*- mode: cpp; mode: fold -*- 2 | /* Internationalization macros for apt. This header should be included last 3 | in each C file. */ 4 | 5 | #ifndef APT_I18N_H 6 | #define APT_I18N_H 7 | 8 | // Set by autoconf 9 | #cmakedefine USE_NLS 10 | 11 | #ifdef USE_NLS 12 | // apt will use the gettext implementation of the C library 13 | #include 14 | #include 15 | # ifdef APT_DOMAIN 16 | # define _(x) dgettext(APT_DOMAIN,x) 17 | # define P_(msg,plural,n) dngettext(APT_DOMAIN,msg,plural,n) 18 | # else 19 | # define _(x) gettext(x) 20 | # define P_(msg,plural,n) ngettext(msg,plural,n) 21 | # endif 22 | # define N_(x) x 23 | #else 24 | // apt will not use any gettext 25 | extern "C" inline char* setlocale(int, const char*) throw() { return nullptr; } 26 | extern "C" inline char* textdomain(const char*) throw() { return nullptr; } 27 | extern "C" inline char* bindtextdomain(const char*, const char*) throw() { return nullptr; } 28 | extern "C" inline char* dgettext(const char*, const char* msg) throw() { return const_cast(msg); } 29 | # define _(x) x 30 | # define P_(msg,plural,n) (n == 1 ? msg : plural) 31 | # define N_(x) x 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /test/integration/status-bug-605394-versioned-or-groups: -------------------------------------------------------------------------------- 1 | Package: apache2-mpm-worker 2 | Status: install ok installed 3 | Priority: optional 4 | Section: httpd 5 | Installed-Size: 68 6 | Maintainer: Debian Apache Maintainers 7 | Architecture: i386 8 | Source: apache2 9 | Version: 2.2.16-4 10 | Provides: apache2-mpm 11 | Conflicts: apache2-mpm 12 | Description: Apache HTTP Server - high speed threaded model 13 | 14 | Package: php5-cgi 15 | Status: install ok installed 16 | Priority: optional 17 | Section: php 18 | Installed-Size: 14672 19 | Maintainer: Debian PHP Maintainers 20 | Architecture: i386 21 | Source: php5 22 | Version: 5.3.3-3 23 | Description: server-side, HTML-embedded scripting language (CGI binary) 24 | 25 | Package: php5 26 | Status: install ok installed 27 | Priority: optional 28 | Section: php 29 | Installed-Size: 20 30 | Maintainer: Debian PHP Maintainers 31 | Architecture: all 32 | Version: 5.3.3-3 33 | Depends: libapache2-mod-php5 (>= 5.3.3-3) | libapache2-mod-php5filter (>= 5.3.3-3) | php5-cgi (>= 5.3.3-3) 34 | Description: server-side, HTML-embedded scripting language (metapackage) 35 | -------------------------------------------------------------------------------- /test/integration/test-ubuntu-bug-1078697-missing-source-hashes: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture "i386" 8 | confighashes 'MD5' 'SHA1' 'SHA256' 'SHA512' 9 | 10 | msgtest 'Test apt-ftparchive source with missing hashes in .dsc' 11 | 12 | touch aptarchive/foo_1.0.tar.gz 13 | cat > aptarchive/foo_1.0.dsc << EOF 14 | Format: 3.0 (native) 15 | Source: foo 16 | Binary: foo 17 | Architecture: all 18 | Version: 1.0 19 | Package-List: 20 | foo deb admin extra 21 | Files: 22 | d41d8cd98f00b204e9800998ecf8427e 0 foo_1.0.tar.gz 23 | EOF 24 | 25 | # check for the SHA hashes 26 | testsuccess aptftparchive sources aptarchive/ 27 | cp rootdir/tmp/testsuccess.output aptarchive/Sources 28 | testsuccess grep Checksums-Sha512 aptarchive/Sources 29 | 30 | for hash in sha512sum sha256sum sha1sum; do 31 | for f in foo_1.0.tar.gz foo_1.0.dsc; do 32 | SUM=$($hash aptarchive/$f | cut -d' ' -f1) 33 | NEEDLE="$SUM $(stat -c%s aptarchive/$f) $f" 34 | testsuccess test -n "$SUM" 35 | msgtest "Test $hash hash matches for $f" 36 | testsuccess --nomsg grep "$NEEDLE" aptarchive/Sources 37 | done 38 | done 39 | -------------------------------------------------------------------------------- /ftparchive/override.h: -------------------------------------------------------------------------------- 1 | // -*- mode: cpp; mode: fold -*- 2 | // Description /*{{{*/ 3 | /* ###################################################################### 4 | 5 | Override 6 | 7 | Store the override file. 8 | 9 | ##################################################################### */ 10 | /*}}}*/ 11 | #ifndef OVERRIDE_H 12 | #define OVERRIDE_H 13 | 14 | #include 15 | #include 16 | 17 | using std::string; 18 | using std::map; 19 | 20 | class Override 21 | { 22 | public: 23 | 24 | struct Item 25 | { 26 | string Priority; 27 | string OldMaint; 28 | string NewMaint; 29 | 30 | map FieldOverride; 31 | string SwapMaint(std::string_view Orig,bool &Failed); 32 | ~Item() {}; 33 | }; 34 | 35 | map> Mapping; 36 | 37 | inline Item *GetItem(std::string_view Package) 38 | { 39 | return GetItem(Package, ""); 40 | } 41 | Item *GetItem(std::string_view Package, std::string_view Architecture); 42 | 43 | bool ReadOverride(string const &File,bool const &Source = false); 44 | bool ReadExtraOverride(string const &File,bool const &Source = false); 45 | }; 46 | 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /test/integration/test-bug-multiarch-upgrade: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 'i386' 8 | 9 | insertinstalledpackage 'libcups2' 'amd64' '1' 'Multi-Arch: same' 10 | insertinstalledpackage 'libcups2' 'i386' '1' 'Multi-Arch: same' 11 | 12 | insertpackage 'unstable' 'libcups2' 'amd64' '0' 'Multi-Arch: same' 13 | insertpackage 'unstable' 'libcups2' 'amd64' '2' 'Multi-Arch: same' 14 | insertpackage 'unstable' 'libcups2' 'i386' '0' 'Multi-Arch: same' 15 | insertpackage 'unstable' 'libcups2' 'i386' '2' 'Multi-Arch: same' 16 | 17 | setupaptarchive 18 | 19 | testsuccessequal 'Reading package lists... 20 | Building dependency tree... 21 | The following additional packages will be installed: 22 | libcups2 23 | The following packages will be upgraded: 24 | libcups2 libcups2:i386 25 | 2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 26 | Inst libcups2 [1] (2 unstable [amd64]) [libcups2:amd64 on libcups2:i386] [libcups2:i386 on libcups2:amd64] [libcups2:i386 ] 27 | Inst libcups2:i386 [1] (2 unstable [i386]) 28 | Conf libcups2 (2 unstable [amd64]) 29 | Conf libcups2:i386 (2 unstable [i386])' aptget install -s libcups2:i386 30 | -------------------------------------------------------------------------------- /test/integration/test-bug-507998-dist-upgrade-recommends: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | insertinstalledpackage 'tshark' 'amd64' '1.0.4-1' 'Depends: wireshark-common' 10 | insertinstalledpackage 'wireshark-common' 'amd64' '1.0.4-1' 'Recommends: wireshark (>= 1.0.4-1) | tshark (>= 1.0.4-1)' 11 | insertpackage 'unstable' 'tshark' 'amd64' '1.2.1-2' 'Depends: wireshark-common (= 1.2.1-2)' 12 | insertpackage 'unstable' 'wireshark-common' 'amd64' '1.2.1-2' 'Recommends: wireshark (>= 1.2.1-2) | tshark (>= 1.2.1-2)' 13 | insertpackage 'unstable' 'wireshark' 'amd64' '1.2.1-2' 'Depends: wireshark-common (= 1.2.1-2)' 14 | 15 | setupaptarchive 16 | 17 | testsuccessequal 'Reading package lists... 18 | Building dependency tree... 19 | Calculating upgrade... 20 | The following packages will be upgraded: 21 | tshark wireshark-common 22 | 2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 23 | Inst wireshark-common [1.0.4-1] (1.2.1-2 unstable [amd64]) 24 | Inst tshark [1.0.4-1] (1.2.1-2 unstable [amd64]) 25 | Conf wireshark-common (1.2.1-2 unstable [amd64]) 26 | Conf tshark (1.2.1-2 unstable [amd64])' aptget dist-upgrade -s 27 | -------------------------------------------------------------------------------- /test/integration/test-dont-forget-conflicts-via-unknown-architectures: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'arm64' 8 | configdpkgnoopchroot 9 | allowremovemanual 10 | 11 | buildsimplenativepackage 'pkga' 'arm64' '1' 'stable' 12 | buildsimplenativepackage 'pkgb' 'arm64' '1' 'stable' 13 | 14 | cd aptarchive 15 | aptftparchive packages ../incoming > Packages 16 | cd .. 17 | generatereleasefiles 18 | signreleasefiles 19 | setupflataptarchive 20 | testsuccess apt update 21 | 22 | testsuccess apt install pkga pkgb -y 23 | testdpkginstalled 'pkga' 'pkgb' 24 | 25 | rm -rf aptarchive incoming 26 | 27 | buildsimplenativepackage 'pkga' 'arm64,amd64' '2' 'unstable' 'Provides: pkgb 28 | Breaks: pkgb (<< 1+) 29 | Replaces: pkgb (<< 1+)' 30 | 31 | mkdir aptarchive 32 | cd aptarchive 33 | aptftparchive packages ../incoming > Packages 34 | cd .. 35 | generatereleasefiles 36 | signreleasefiles 37 | setupflataptarchive 38 | testsuccess apt update 39 | 40 | #apt upgrade pkga -o Debug::pkgDpkgPm=1 -y -o Dpkg::use-pty=0 41 | rm -f rootdir/var/cache/apt/*.bin 42 | testsuccess apt install pkga -y 43 | testdpkginstalled 'pkga' 44 | testdpkgnotinstalled 'pkgb' 45 | -------------------------------------------------------------------------------- /vendor/debian/apt-vendor.ent: -------------------------------------------------------------------------------- 1 | 2 | 3 | debian-archive-keyring"> 4 | 5 | 8 | 19 | -------------------------------------------------------------------------------- /test/integration/test-apt-helper-cat-file: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | 8 | TESTTOOL="${APTTESTHELPERSBINDIR}/test_fileutl" 9 | msgtest 'Check if we have build the test tool' "$TESTTOOL" 10 | if [ -x "$TESTTOOL" ]; then 11 | msgpass 12 | else 13 | msgskip 'not available' 14 | exit 0 15 | fi 16 | 17 | cat >rootdir/etc/apt/apt.conf.d/rev-as-compressor <./test.txt <> "$FILE" 29 | done 30 | verify 31 | 32 | msgmsg 'Payload in-between detached signatures' 33 | find aptarchive -name 'Release.gpg' | while read FILE; do 34 | cat "${FILE}.bak" >> "$FILE" 35 | done 36 | verify 37 | 38 | msgmsg 'Payload before detached signature' 39 | find aptarchive -name 'Release.gpg' | while read FILE; do 40 | echo "evil payload" > "$FILE" 41 | cat "${FILE}.bak" >> "$FILE" 42 | done 43 | verify 44 | -------------------------------------------------------------------------------- /test/integration/test-bug-673536-pre-depends-breaks-loop: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'native' 8 | 9 | buildsimplenativepackage 'advanced' 'native' '1' 'stable' 10 | buildsimplenativepackage 'advanced' 'native' '2' 'unstable' 'Pre-Depends: basic' 11 | buildsimplenativepackage 'basic' 'native' '2' 'unstable' 'Pre-Depends: common' 12 | 13 | buildsimplenativepackage 'common' 'native' '2~conflict' 'unstable-conflict' 'Conflicts: advanced (<= 1)' 14 | buildsimplenativepackage 'common' 'native' '2~break' 'unstable-break' 'Breaks: advanced (<= 1)' 15 | 16 | setupaptarchive 17 | 18 | # we check with 'real' packages here as the simulation reports a 'Conf broken' 19 | # which is technical correct for the simulation, but testing errormsg is ugly 20 | 21 | testloopbreak() { 22 | rm -f rootdir/var/lib/dpkg/status rootdir/var/lib/apt/extended_states 23 | 24 | testsuccess aptget install advanced=1 -y -t "$1" 25 | testdpkginstalled advanced 26 | testdpkgnotinstalled basic common 27 | 28 | testsuccess aptget dist-upgrade -y -t "$1" 29 | testdpkginstalled advanced basic common 30 | } 31 | 32 | testloopbreak 'unstable-break' 33 | testloopbreak 'unstable-conflict' 34 | -------------------------------------------------------------------------------- /test/integration/test-resolve-by-keep-new-recommends: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture "i386" 8 | 9 | insertinstalledpackage 'foo' 'i386' '1.0' 10 | insertpackage 'unstable' 'foo' 'i386' '2.0' 'Recommends: bar' 11 | 12 | setupaptarchive 13 | 14 | UPGRADE_KEEP="Reading package lists... 15 | Building dependency tree... 16 | Calculating upgrade... 17 | The following packages have been kept back: 18 | foo 19 | 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded." 20 | testsuccessequal "$UPGRADE_KEEP" aptget upgrade -s 21 | 22 | UPGRADE_KEEP="Reading package lists... 23 | Building dependency tree... 24 | Calculating upgrade... 25 | The following packages have been kept back: 26 | foo 27 | 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded." 28 | testsuccessequal "$UPGRADE_KEEP" apt upgrade -s 29 | 30 | UPGRADE_KEEP="Reading package lists... 31 | Building dependency tree... 32 | Calculating upgrade... 33 | The following packages will be upgraded: 34 | foo 35 | 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 36 | Inst foo [1.0] (2.0 unstable [i386]) 37 | Conf foo (2.0 unstable [i386])" 38 | testsuccessequal "$UPGRADE_KEEP" aptget dist-upgrade -s 39 | 40 | -------------------------------------------------------------------------------- /apt-private/private-download.h: -------------------------------------------------------------------------------- 1 | #ifndef APT_PRIVATE_DOWNLOAD_H 2 | #define APT_PRIVATE_DOWNLOAD_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | // Check if all files in the fetcher are authenticated 13 | bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser); 14 | 15 | // show a authentication warning prompt and return true if the system 16 | // should continue 17 | bool AuthPrompt(std::vector const &UntrustedList, bool const PromptUser); 18 | 19 | APT_PUBLIC bool AcquireRun(pkgAcquire &Fetcher, int const PulseInterval, bool * const Failure, bool * const TransientNetworkFailure); 20 | 21 | bool CheckFreeSpaceBeforeDownload(std::string const &Dir, unsigned long long FetchBytes); 22 | 23 | class APT_PUBLIC aptAcquireWithTextStatus : public pkgAcquire 24 | { 25 | AcqTextStatus Stat; 26 | public: 27 | aptAcquireWithTextStatus(); 28 | }; 29 | 30 | class CommandLine; 31 | 32 | APT_PUBLIC bool DoDownload(CommandLine &CmdL); 33 | APT_PUBLIC bool DoChangelog(CommandLine &CmdL); 34 | 35 | APT_PUBLIC bool DoClean(CommandLine &CmdL); 36 | APT_PUBLIC bool DoDistClean(CommandLine &CmdL); 37 | APT_PUBLIC bool DoAutoClean(CommandLine &CmdL); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /test/integration/status-bug-601961-install-info: -------------------------------------------------------------------------------- 1 | Package: dpkg 2 | Status: install ok installed 3 | Essential: yes 4 | Priority: required 5 | Section: admin 6 | Installed-Size: 6432 7 | Maintainer: Dpkg Developers 8 | Architecture: i386 9 | Version: 1.15.8.5 10 | Description: Debian package management system 11 | 12 | Package: findutils 13 | Status: install ok installed 14 | Essential: yes 15 | Priority: required 16 | Section: utils 17 | Installed-Size: 1704 18 | Maintainer: Andreas Metzler 19 | Architecture: i386 20 | Version: 4.4.2-1+b1 21 | Depends: dpkg (>= 1.15.4) | install-info, essentialpkg 22 | Description: utilities for finding files--find, xargs 23 | 24 | Package: install-info 25 | Status: install ok installed 26 | Priority: important 27 | Section: doc 28 | Installed-Size: 256 29 | Maintainer: Debian TeX maintainers 30 | Architecture: i386 31 | Version: 4.13a.dfsg.1-6 32 | Description: Manage installed documentation in info format 33 | 34 | Package: essentialpkg 35 | Status: install ok installed 36 | Priority: important 37 | Section: other 38 | Installed-Size: 256 39 | Maintainer: Joe Sixpack 40 | Architecture: i386 41 | Version: 4.13a.dfsg.1-6 42 | Description: ultra hypercool important package 43 | -------------------------------------------------------------------------------- /test/integration/test-apt-translation-has-no-packages: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Due to corruption (local or network) a user might end up with a 4 | # Translation-$lang file on disk that is actually a Packages file. In this 5 | # case apt used to generate invalid package versions out of the 6 | # Translation-$lang file (i.e. apt-cache policy foo) would show a version 7 | # coming out of a Translation file. Downloading this versions fails as 8 | # there is no acquire method available for the package 9 | # 10 | set -e 11 | 12 | TESTDIR="$(readlink -f "$(dirname "$0")")" 13 | . "$TESTDIR/framework" 14 | 15 | setupenvironment 16 | configarchitecture "amd64" 17 | 18 | buildsimplenativepackage 'foo' 'all' '1.0' 19 | setupaptarchive 20 | 21 | APTARCHIVE="$(readlink -f ./aptarchive)" 22 | 23 | # corrupt the Translation-en file to look like a regular Packages file 24 | rm rootdir/var/cache/apt/*.bin 25 | cp "$APTARCHIVE/dists/unstable/main/binary-amd64/Packages" \ 26 | rootdir/var/lib/apt/lists/*Translation-en 27 | 28 | # ensure that there is no Version for the package foo generated out of 29 | # the corrupted Translation-en file 30 | testsuccessequal "foo: 31 | Installed: (none) 32 | Candidate: 1.0 33 | Version table: 34 | 1.0 500 35 | 500 file:$APTARCHIVE unstable/main all Packages" aptcache policy foo 36 | -------------------------------------------------------------------------------- /test/integration/test-bug-990555-https-proxy-for-http: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | buildsimplenativepackage 'unrelated' 'all' '1' 'unstable' 10 | 11 | setupaptarchive --no-update 12 | changetowebserver --request-absolute='uri' 13 | changetohttpswebserver --no-rewrite 14 | 15 | msgtest 'Check that non-absolute paths are' 'not accepted' 16 | testfailure --nomsg aptget update --allow-insecure-repositories 17 | 18 | echo "Acquire::http::Proxy \"https://localhost:${APTHTTPSPORT}\";" > rootdir/etc/apt/apt.conf.d/99proxy 19 | 20 | msgtest 'Check that requests to https proxies' 'work from http' 21 | testsuccess --nomsg aptget update 22 | 23 | testsuccessequal 'Reading package lists... 24 | Building dependency tree... 25 | The following NEW packages will be installed: 26 | unrelated 27 | 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. 28 | Inst unrelated (1 unstable [all]) 29 | Conf unrelated (1 unstable [all])' apt install unrelated -s 30 | 31 | testsuccess apt download unrelated --print-uris 32 | testfailure grep 'https:' rootdir/tmp/testsuccess.output 33 | 34 | cd downloaded 35 | testsuccess apt download unrelated 36 | testsuccess test -s 'unrelated_1_all.deb' 37 | cd .. 38 | -------------------------------------------------------------------------------- /test/integration/test-cve-2018-0501-mirror-alternatives: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | TESTDIR="$(readlink -f "$(dirname "$0")")" 4 | . "$TESTDIR/framework" 5 | 6 | setupenvironment 7 | configarchitecture "i386" 8 | 9 | buildsimplenativepackage 'foo' 'all' '1' 'stable' 10 | setupaptarchive --no-update 11 | changetohttpswebserver 12 | 13 | # User has mirror method configured in apt >= 1.6~alpha6 & 14 | # Eve has enough MITM control over the network to 15 | # a) have the mirror file include at least two mirrors and 16 | # b) can send her bad InRelease files for both mirrors 17 | sed -i -e 's# https:# mirror+https:#' -e 's#/ stable#/mirror.txt stable#' rootdir/etc/apt/sources.list.d/*-stable-* 18 | echo "http://localhost:${APTHTTPPORT} 19 | https://localhost:${APTHTTPSPORT}" > aptarchive/mirror.txt 20 | 21 | # real Eve would do something worse… 22 | sed -i "/^Date: / a\ 23 | Evil: yes" $(find ./aptarchive -name 'Release' -o -name 'InRelease') 24 | 25 | # progress display shows that the InRelease file was bad, 26 | # but it is used anyhow as the bad file causes a fallback to 27 | # a request to the second mirror which completes successful 28 | # causing apt to believe the verify completed successfully… 29 | testfailure apt update 30 | testfailure grep '^Evil:' rootdir/var/lib/apt/lists/*Release 31 | testfailure apt show foo 32 | -------------------------------------------------------------------------------- /test/integration/test-apt-update-hashsum-mismatch: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'i386' 8 | configcompression 'gz' 9 | 10 | insertpackage 'testing' 'foo' 'all' '1' 11 | insertpackage 'testing' 'foo2' 'all' '1' 12 | insertsource 'testing' 'foo' 'all' '1' 13 | insertsource 'testing' 'foo2' 'all' '1' 14 | 15 | setupaptarchive --no-update 16 | changetowebserver 17 | 18 | find aptarchive \( -name 'Packages' -o -name 'Sources' -o -name 'Translation-en' \) -delete 19 | 20 | testsuccess aptget update 21 | testsuccess aptcache show foo 22 | testsuccess aptget install foo -s 23 | 24 | for get in $(sed -n 's#^GET /\([^ ]\+\.gz\) HTTP.\+$#\1#p' aptarchive/webserver.log.client*.log); do 25 | msgmsg 'Test hashsum mismatch with file' "$get" 26 | breakfiles "aptarchive/${get}" 27 | rm -rf rootdir/var/lib/apt/lists 28 | 29 | testfailure aptget update 30 | cp rootdir/tmp/testfailure.output rootdir/tmp/update.output 31 | testsuccess grep -E "$(basename "$get" '.gz').*Hash Sum mismatch" rootdir/tmp/update.output 32 | testfailure aptcache show foo 33 | testfailure aptget install foo -s 34 | 35 | testfailure aptcache show bar 36 | testfailure aptget install bar -s 37 | 38 | unbreakfiles "aptarchive/${get}" 39 | done 40 | -------------------------------------------------------------------------------- /test/integration/test-ubuntu-bug-784473-InRelease-one-message-only: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'i386' 8 | 9 | insertpackage 'unstable' 'apt' 'i386' '0.8.11' 10 | 11 | export APT_DONT_SIGN='Release.gpg' 12 | setupaptarchive --no-update 13 | 14 | find aptarchive/ -name 'InRelease' -exec cp {} {}.old \; 15 | 16 | for RELEASE in $(find aptarchive/ -name 'InRelease'); do 17 | (echo 'Origin: Marvin 18 | Label: Marvin 19 | Suite: experimental 20 | Codename: experimental 21 | MD5Sum: 22 | 65fd410587b6978de2277f2912523f09 9360 Packages 23 | d27b294ed172a1fa9dd5a53949914c5d 4076 Packages.bz2 24 | 2182897e0a2a0c09e760beaae117a015 2023 Packages.diff/Index 25 | 1b895931853981ad8204d2439821b999 4144 Packages.gz'; echo; cat ${RELEASE}.old;) > ${RELEASE} 26 | done 27 | 28 | testfailure aptget update 29 | testsuccess grep '^E:.*Clearsigned file .*NOSPLIT.*' rootdir/tmp/testfailure.output 30 | 31 | testsuccessequal "Package files: 32 | Pinned packages:" aptcache policy 33 | 34 | insertinstalledpackage 'foo' 'all' '1' 35 | 36 | ROOTDIR="$(readlink -f .)" 37 | testsuccessequal "Package files: 38 | 100 ${ROOTDIR}/rootdir/var/lib/dpkg/status 39 | release a=now 40 | Pinned packages:" aptcache policy 41 | -------------------------------------------------------------------------------- /test/integration/test-github-111-invalid-armember: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture "amd64" 8 | setupaptarchive 9 | 10 | # this used to crash, but it should treat it as an invalid member header 11 | touch ' ' 12 | testsuccess ar -q test.deb ' ' 13 | testsuccessequal "E: Invalid archive member header" ${APTTESTHELPERSBINDIR}/testdeb test.deb 14 | 15 | 16 | rm test.deb 17 | touch 'x' 18 | testsuccess ar -q test.deb 'x' 19 | testsuccessequal "E: This is not a valid DEB archive, missing 'debian-binary' member" ${APTTESTHELPERSBINDIR}/testdeb test.deb 20 | 21 | 22 | # [ other fields] - name is not nul terminated here, it ends in . 23 | msgmsg "Unterminated ar member name" 24 | printf '!\0120123456789ABCDE.A123456789A.01234.01234.0123456.012345678.0.' > test.deb 25 | testsuccessequal "E: Invalid archive member header" ${APTTESTHELPERSBINDIR}/testdeb test.deb 26 | 27 | 28 | ${APTTESTHELPERSBINDIR}/createdeb-cve-2020-27350 github-111 control.tar 29 | gzip control.tar 30 | cp control.tar.gz data.tar.gz 31 | touch debian-binary 32 | rm test.deb 33 | testsuccess ar -q test.deb debian-binary control.tar.gz data.tar.gz 34 | testsuccessequal "W: Unknown TAR header type 88" ${APTTESTHELPERSBINDIR}/testdeb test.deb 35 | -------------------------------------------------------------------------------- /test/integration/test-ubuntu-bug-2003851-retry-after: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | configarchitecture 'amd64' 9 | 10 | insertpackage 'jammy,jammy-updates' 'testpkg' 'all' '1' 11 | 12 | setupaptarchive --no-update 13 | changetowebserver 14 | 15 | webserverconfig 'aptwebserver::failrequest' '503' 16 | webserverconfig 'aptwebserver::failrequest::dists/jammy/InRelease' '4' 17 | testwarningequal "Delaying http://localhost:${APTHTTPPORT} jammy InRelease by 1 seconds 18 | Ign:1 http://localhost:${APTHTTPPORT} jammy InRelease 19 | 503 Service Unavailable 20 | Get:2 http://localhost:${APTHTTPPORT} jammy-updates InRelease [1398 B] 21 | Err:1 http://localhost:${APTHTTPPORT} jammy InRelease 22 | 503 Service Unavailable 23 | Get:3 http://localhost:${APTHTTPPORT} jammy-updates/main all Packages [257 B] 24 | Get:4 http://localhost:${APTHTTPPORT} jammy-updates/main Translation-en [235 B] 25 | Reading package lists... 26 | Building dependency tree... 27 | All packages are up to date. 28 | W: Failed to fetch http://localhost:${APTHTTPPORT}/dists/jammy/InRelease 503 Service Unavailable 29 | W: Some index files failed to download. They have been ignored, or old ones used instead." apt update -o acquire::retries=1 -o debug::acquire::retries=1 30 | -------------------------------------------------------------------------------- /test/interactive-helper/testdeb.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | class NullStream : public pkgDirStream 14 | { 15 | public: 16 | bool DoItem(Item &/*Itm*/, int &/*Fd*/) override {return true;}; 17 | }; 18 | 19 | static bool Test(const char *File) 20 | { 21 | FileFd Fd(File,FileFd::ReadOnly); 22 | debDebFile Deb(Fd); 23 | 24 | if (_error->PendingError() == true) 25 | return false; 26 | 27 | // Get the archive member and positition the file 28 | const ARArchive::Member *Member = Deb.GotoMember("data.tar.gz"); 29 | if (Member == 0) 30 | return false; 31 | 32 | // Extract it. 33 | ExtractTar Tar(Deb.GetFile(),Member->Size, "gzip"); 34 | NullStream Dir; 35 | if (Tar.Go(Dir) == false) 36 | return false; 37 | 38 | return true; 39 | } 40 | 41 | int main(int argc, const char *argv[]) 42 | { 43 | if (argc != 2) { 44 | std::cout << "One parameter expected - given " << argc << std::endl; 45 | return 100; 46 | } 47 | 48 | Test(argv[1]); 49 | _error->DumpErrors(); 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /test/integration/test-apt-cache-showsrc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | configarchitecture "i386" 9 | 10 | # we have a foo source package 11 | insertsource 'unstable' 'foo' 'all' '1.0' '' 'foo-binary' 12 | 13 | # and a similar one that builds a foo binary package 14 | insertsource 'unstable' 'unrelated' 'all' '1.0' '' 'foo' 15 | 16 | # just here to workaround the need for a authenticated package 17 | insertpackage 'unstable' 'workaround' 'all' '1.0' 18 | 19 | setupaptarchive 20 | 21 | # by default apt-cache showsrc will look into "binary" and "source" names 22 | # and show all matches 23 | aptcache showsrc foo > output.txt 24 | testsuccess grep "Package: foo" output.txt 25 | testsuccess grep "Package: unrelated" output.txt 26 | 27 | # by default apt-cache showsrc will look into "binary" and "source" names 28 | # and show all matches 29 | aptcache showsrc --only-source foo > output.txt 30 | testsuccess grep "Package: foo" output.txt 31 | testfailure grep "Package: unrelated" output.txt 32 | 33 | # by default apt-cache showsrc will look into "binary" and "source" names 34 | # and show all matches 35 | aptcache showsrc src:foo > output.txt 36 | testsuccess grep "Package: foo" output.txt 37 | testfailure grep "Package: unrelated" output.txt 38 | -------------------------------------------------------------------------------- /po/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(Translations) 2 | 3 | set(languages_excluded 4 | he ## disabled by translator request #313283 5 | ) 6 | 7 | if (TARGET apt-pkg) 8 | apt_add_translation_domain( 9 | DOMAIN libapt-pkg${APT_PKG_MAJOR} 10 | TARGETS apt-pkg 11 | EXCLUDE_LANGUAGES ${languages_excluded} 12 | ) 13 | endif() 14 | 15 | if (TARGET apt-private) 16 | apt_add_translation_domain( 17 | DOMAIN apt 18 | TARGETS apt apt-cache apt-get apt-config apt-cdrom apt-helper apt-mark 19 | apt-private 20 | # Methods 21 | connectlib file copy store gpgv cdrom http rred mirror 22 | SCRIPTS ../dselect/install ../dselect/update 23 | EXCLUDE_LANGUAGES ${languages_excluded} 24 | ) 25 | endif() 26 | 27 | apt_add_translation_domain( 28 | DOMAIN apt-utils 29 | TARGETS apt-sortpkgs 30 | apt-extracttemplates 31 | apt-internal-solver 32 | apt-dump-solver 33 | apt-internal-planner 34 | apt-ftparchive 35 | EXCLUDE_LANGUAGES ${languages_excluded} 36 | ) 37 | 38 | apt_add_update_po( 39 | TEMPLATE 40 | apt-all 41 | DOMAINS 42 | libapt-pkg${APT_PKG_MAJOR} 43 | apt 44 | apt-utils 45 | EXCLUDE_LANGUAGES 46 | ${languages_excluded} 47 | ) 48 | 49 | apt_add_po_statistics("${languages_excluded}") 50 | -------------------------------------------------------------------------------- /apt-pkg/deb/debversion.h: -------------------------------------------------------------------------------- 1 | // -*- mode: cpp; mode: fold -*- 2 | // Description /*{{{*/ 3 | /* ###################################################################### 4 | 5 | Debian Version - Versioning system for Debian 6 | 7 | This implements the standard Debian versioning system. 8 | 9 | ##################################################################### */ 10 | /*}}}*/ 11 | #ifndef PKGLIB_DEBVERSION_H 12 | #define PKGLIB_DEBVERSION_H 13 | 14 | #include 15 | 16 | #include 17 | 18 | class APT_PUBLIC debVersioningSystem : public pkgVersioningSystem 19 | { 20 | public: 21 | 22 | static int CmpFragment(const char *A, const char *AEnd, const char *B, 23 | const char *BEnd) APT_PURE; 24 | 25 | // Compare versions.. 26 | int DoCmpVersion(const char *A, const char *Aend, 27 | const char *B, const char *Bend) override APT_PURE; 28 | bool CheckDep(const char *PkgVer, int Op, const char *DepVer) override APT_PURE; 29 | int DoCmpReleaseVer(const char *A, const char *Aend, 30 | const char *B, const char *Bend) override APT_PURE 31 | { 32 | return DoCmpVersion(A,Aend,B,Bend); 33 | } 34 | std::string UpstreamVersion(const char *A) override; 35 | 36 | debVersioningSystem(); 37 | }; 38 | 39 | extern APT_PUBLIC debVersioningSystem debVS; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /apt-pkg/prettyprinters.h: -------------------------------------------------------------------------------- 1 | #ifndef APT_PRETTYPRINTERS_H 2 | #define APT_PRETTYPRINTERS_H 3 | #include 4 | #include 5 | 6 | class pkgDepCache; 7 | 8 | namespace APT { 9 | 10 | /** helper to format PkgIterator for easier printing in debug messages. 11 | * 12 | * The actual text generated is subject to change without prior notice 13 | * and should NOT be used as part of a general user interface. 14 | */ 15 | struct PrettyPkg 16 | { 17 | pkgDepCache * const DepCache; 18 | pkgCache::PkgIterator const Pkg; 19 | PrettyPkg(pkgDepCache * const depcache, pkgCache::PkgIterator const &pkg) APT_NONNULL(2) : DepCache(depcache), Pkg(pkg) {} 20 | }; 21 | /** helper to format DepIterator for easier printing in debug messages. 22 | * 23 | * The actual text generated is subject to change without prior notice 24 | * and should NOT be used as part of a general user interface. 25 | */ 26 | struct PrettyDep 27 | { 28 | pkgDepCache * const DepCache; 29 | pkgCache::DepIterator const Dep; 30 | PrettyDep(pkgDepCache * const depcache, pkgCache::DepIterator const &dep) APT_NONNULL(2) : DepCache(depcache), Dep(dep) {} 31 | }; 32 | 33 | } 34 | APT_PUBLIC std::ostream& operator<<(std::ostream& os, const APT::PrettyPkg& pp); 35 | APT_PUBLIC std::ostream& operator<<(std::ostream& os, const APT::PrettyDep& pd); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /cmdline/apt-extracttemplates.h: -------------------------------------------------------------------------------- 1 | // -*- mode: cpp; mode: fold -*- 2 | // Description /*{{{*/ 3 | /* ###################################################################### 4 | 5 | apt-extracttemplate - tool to extract template and config data 6 | 7 | ##################################################################### */ 8 | /*}}}*/ 9 | #ifndef _APTEXTRACTTEMPLATE_H_ 10 | #define _APTEXTRACTTEMPLATE_H_ 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | class pkgCache; 18 | 19 | class DebFile : public pkgDirStream 20 | { 21 | FileFd File; 22 | char *Control; 23 | unsigned long ControlLen; 24 | 25 | public: 26 | explicit DebFile(const char *FileName); 27 | ~DebFile() override; 28 | bool DoItem(Item &I, int &fd) override; 29 | bool Process(pkgDirStream::Item &I, const unsigned char *data, 30 | unsigned long long size, unsigned long long pos) override; 31 | 32 | bool Go(); 33 | bool ParseInfo(); 34 | 35 | static std::string GetInstalledVer(const std::string &package); 36 | 37 | std::string Package; 38 | std::string Version; 39 | std::string DepVer, PreDepVer; 40 | unsigned int DepOp, PreDepOp; 41 | 42 | char *Config; 43 | char *Template; 44 | 45 | static pkgCache *Cache; 46 | enum { None, IsControl, IsConfig, IsTemplate } Which; 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /test/libapt/teestream_test.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "../interactive-helper/teestream.h" 4 | #include 5 | #include 6 | #include 7 | 8 | #include "common.h" 9 | 10 | TEST(TeeStreamTest,TwoStringSinks) 11 | { 12 | std::ostringstream one, two; 13 | basic_teeostream tee(one, two); 14 | tee << "This is the " << 1 << '.' << " Test, we expect: " << std::boolalpha << true << "\n"; 15 | std::string okay("This is the 1. Test, we expect: true\n"); 16 | EXPECT_EQ(okay, one.str()); 17 | EXPECT_EQ(okay, two.str()); 18 | EXPECT_EQ(one.str(), two.str()); 19 | } 20 | 21 | TEST(TeeStreamTest,DevNullSink1) 22 | { 23 | std::ostringstream one; 24 | std::fstream two("/dev/null"); 25 | basic_teeostream tee(one, two); 26 | tee << "This is the " << 2 << '.' << " Test, we expect: " << std::boolalpha << false << "\n"; 27 | std::string okay("This is the 2. Test, we expect: false\n"); 28 | EXPECT_EQ(okay, one.str()); 29 | } 30 | 31 | TEST(TeeStreamTest,DevNullSink2) 32 | { 33 | std::ostringstream one; 34 | std::fstream two("/dev/null"); 35 | basic_teeostream tee(two, one); 36 | tee << "This is the " << 3 << '.' << " Test, we expect: " << std::boolalpha << false << "\n"; 37 | std::string okay("This is the 3. Test, we expect: false\n"); 38 | EXPECT_EQ(okay, one.str()); 39 | } 40 | -------------------------------------------------------------------------------- /test/integration/test-bug-689582-100-char-long-path-names: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | mkdir aptarchive/testpkg 10 | cd aptarchive/testpkg 11 | 12 | for i in $(seq 98 102); do 13 | touch "$(printf "%0${i}d" "$i")" 14 | done 15 | tar zcf data.tar.gz 00* 16 | 17 | echo 'Package: testpkg 18 | Version: 1-1 19 | Architecture: all 20 | Maintainer: Joe Sixpack 21 | Description: Package for test 22 | Section: debug 23 | Priority: extra' > control 24 | tar zcf control.tar.gz control 25 | 26 | echo '2.0' > debian-binary 27 | ar cr ../testpkg.deb debian-binary control.tar.gz data.tar.gz 28 | 29 | cd - > /dev/null 30 | 31 | testsuccessequal '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000102 testpkg 32 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101 testpkg 33 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100 testpkg 34 | 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000099 testpkg 35 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000098 testpkg' aptftparchive contents aptarchive/ 36 | -------------------------------------------------------------------------------- /test/integration/test-solver3-alternatives: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | insertpackage 'unstable' 'unsat' 'all' '3' 'Depends: a | b' 10 | insertpackage 'unstable' 'a' 'all' '3' 'Depends: aa|ab' 11 | insertpackage 'unstable' 'b' 'all' '3' 'Depends: ba|bb' 12 | insertpackage 'unstable' 'aa' 'all' '3' 'Depends: aax' 13 | insertpackage 'unstable' 'ab' 'all' '3' 'Depends: abx' 14 | insertpackage 'unstable' 'ba' 'all' '3' 'Depends: bay' 15 | insertpackage 'unstable' 'bb' 'all' '3' 'Depends: bby' 16 | setupaptarchive 17 | 18 | testfailuremsg "E: Unable to satisfy dependencies. Reached two conflicting decisions: 19 | 1. bb:amd64 is selected for install because: 20 | 1. unsat:amd64=3 is selected for install 21 | 2. unsat:amd64 Depends a | b 22 | [selected b:amd64 for install] 23 | 3. b:amd64 Depends ba | bb 24 | [selected b:amd64] 25 | For context, additional choices that could not be installed: 26 | * In unsat:amd64 Depends a | b: 27 | - a:amd64 is not selected for install 28 | * In b:amd64 Depends ba | bb: 29 | - ba:amd64 is not selected for install 30 | 2. bb:amd64 Depends bby 31 | but none of the choices are installable: 32 | [no choices]" apt install unsat --solver 3.0 33 | -------------------------------------------------------------------------------- /test/integration/test-bug-872963-apt-ftparchive-disable-hashes: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | 9 | touch aptarchive/apt_1.5~rc1.tar.xz 10 | cat >> aptarchive/apt_1.5~rc1.dsc << EOF 11 | Format: 3.0 (native) 12 | Source: apt 13 | Binary: apt 14 | Architecture: any all 15 | Version: 1.5~rc1 16 | Build-Depends: foo 17 | Package-List: 18 | apt deb admin important arch=any 19 | Checksums-Sha1: 20 | 332b354b0c7cbd936a4a95f3ce149aa03677cabf 2095076 apt_1.5~rc1.tar.xz 21 | Checksums-Sha256: 22 | 14d09b2c1e13f9a70aac3322987ff26f36c53010639763573c9aa4987e52e47a 2095076 apt_1.5~rc1.tar.xz 23 | Checksums-Sha512: 24 | 4f570c10c3fd549b2e27db4481fbc1ebebed52bd06a8ba7c0716b3917a8452bb3d3cd4fbb02561e02af09b1973a65a4cc69a42c21e858b1d5c3caa970aea4fd4 2095076 apt_1.5~rc1.tar.xz 25 | Files: 26 | 7ea24e77b6203e08ca4158831df26825 2095076 apt_1.5~rc1.tar.xz 27 | EOF 28 | 29 | 30 | rm rootdir/etc/apt/apt.conf.d/* 31 | 32 | for HASH in MD5 SHA1 SHA256 SHA512; do 33 | testsuccess aptftparchive -qq sources -o APT::FTPArchive::$HASH=false "aptarchive/" 34 | cp rootdir/tmp/testsuccess.output aptarchive/Sources 35 | if [ "$HASH" = "MD5" ]; then 36 | testfailure grep "Files:" aptarchive/Sources 37 | else 38 | testfailure grep -i "$HASH:" aptarchive/Sources 39 | fi 40 | done 41 | -------------------------------------------------------------------------------- /apt-private/private-history.h: -------------------------------------------------------------------------------- 1 | #ifndef APT_PRIVATE_HISTORY_H 2 | #define APT_PRIVATE_HISTORY_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | APT_PUBLIC bool DoHistoryInfo(CommandLine &Cmd); 10 | APT_PUBLIC bool DoHistoryList(CommandLine &Cmd); 11 | APT_PUBLIC bool DoHistoryRedo(CommandLine &Cmd); 12 | APT_PUBLIC bool DoHistoryRollback(CommandLine &Cmd); 13 | APT_PUBLIC bool DoHistoryUndo(CommandLine &Cmd); 14 | 15 | namespace APT::Internal 16 | { 17 | using namespace History; 18 | /** 19 | * Flatten the changes contained within a history entry. 20 | * 21 | * This function extracts and returns a flat list of all changes 22 | * from the given entry, preserving their order if applicable. 23 | * 24 | * @param entry A history entry containing a map of changes. 25 | * @return A vector containing all individual changes from the entry. 26 | */ 27 | std::vector FlattenChanges(const Entry &entry); 28 | 29 | /** 30 | * Invert a change. 31 | * 32 | * This function inverts a change's effective action and version 33 | * such that a change followed by its inverse has no effective change. 34 | * 35 | * @param change A transactional change. 36 | * @return The given change's inverse. 37 | */ 38 | Change InvertChange(const Change &change); 39 | 40 | } // namespace APT::Internal 41 | #endif 42 | -------------------------------------------------------------------------------- /apt-private/private-cmndline.h: -------------------------------------------------------------------------------- 1 | #ifndef APT_PRIVATE_CMNDLINE_H 2 | #define APT_PRIVATE_CMNDLINE_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | class Configuration; 11 | class pkgSystem; 12 | 13 | enum class APT_CMD { 14 | APT, 15 | APT_GET, 16 | APT_CACHE, 17 | APT_CDROM, 18 | APT_CONFIG, 19 | APT_EXTRACTTEMPLATES, 20 | APT_FTPARCHIVE, 21 | APT_HELPER, 22 | APT_INTERNAL_SOLVER, 23 | APT_MARK, 24 | APT_SORTPKG, 25 | APT_DUMP_SOLVER, 26 | APT_INTERNAL_PLANNER, 27 | RRED, 28 | }; 29 | struct aptDispatchWithHelp 30 | { 31 | const char *Match; 32 | bool (*Handler)(CommandLine &); 33 | const char *Help; 34 | }; 35 | 36 | APT_PUBLIC std::vector ParseCommandLine(CommandLine &CmdL, APT_CMD const Binary, 37 | Configuration * const * const Cnf, pkgSystem ** const Sys, int const argc, const char * argv[], 38 | bool (*ShowHelp)(CommandLine &), std::vector (*GetCommands)(void)); 39 | APT_PUBLIC unsigned short DispatchCommandLine(CommandLine &CmdL, std::vector const &Cmds); 40 | 41 | APT_PUBLIC std::vector getCommandArgs(APT_CMD const Program, char const * const Cmd); 42 | 43 | APT_PUBLIC bool cliVersionIsCompatible(std::string_view level, std::string_view pattern); 44 | #endif 45 | -------------------------------------------------------------------------------- /test/integration/skip-apt-dropprivs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | configarchitecture 'amd64' 9 | 10 | aptdropprivs() { runapt "${APTTESTHELPERSBINDIR}/aptdropprivs" "$@"; } 11 | 12 | testsuccess aptdropprivs -- /bin/true 13 | testsuccess aptdropprivs --user "$USER" -- /bin/true 14 | testsuccess aptdropprivs --user 'nobody' -- /bin/true 15 | testsuccess aptdropprivs --user '_apt' -- /bin/true 16 | 17 | IDBIN='/usr/bin/id' 18 | testsuccessequal "$("$IDBIN")" aptdropprivs --user "$USER" -- "$IDBIN" 19 | 20 | SUDOBIN='/usr/bin/sudo' 21 | testequal "sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?" aptdropprivs --user 'nobody' -- "$SUDOBIN" "$IDBIN" 22 | 23 | if [ "$(id -u)" = '0' ]; then 24 | testsuccessequal '_apt' aptdropprivs --user '_apt' -- "$IDBIN" '-un' 25 | testsuccess aptdropprivs --user '_apt' -- '/bin/sh' '-c' 'export' 26 | cp rootdir/tmp/testsuccess.output apt.env 27 | testsuccessequal "export HOME='/nonexistent'" grep '^export HOME' apt.env 28 | testsuccessequal "export USER='_apt' 29 | export USERNAME='_apt'" grep '^export USER' apt.env 30 | testsuccessequal "export LOGNAME='_apt'" grep '^export LOGNAME' apt.env 31 | testsuccessequal "export SHELL='/bin/sh'" grep '^export SHELL=' apt.env 32 | fi 33 | -------------------------------------------------------------------------------- /test/integration/test-bug-719263-print-uris-removes-authentication: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | configarchitecture 'amd64' 9 | 10 | insertinstalledpackage 'unrelated' 'all' '1' 11 | buildsimplenativepackage 'unrelated' 'all' '2' 'unstable' 12 | 13 | setupaptarchive 14 | 15 | testnoact() { 16 | cp -a rootdir/var/lib/dpkg/status rootdir/var/lib/dpkg/status-backup-noact 17 | touch rootdir/var/lib/apt/extended_states 18 | testsuccessequal 'Reading package lists... 19 | Building dependency tree... 20 | Reading state information... 21 | The following packages will be upgraded: 22 | unrelated 23 | 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 24 | Inst unrelated [1] (2 unstable [all]) 25 | Conf unrelated (2 unstable [all])' aptget install unrelated -s 26 | testsuccess aptget install unrelated -y 27 | testdpkginstalled unrelated 28 | rm -rf rootdir/var/cache/apt/*.bin 29 | cp -a rootdir/var/lib/dpkg/status-backup-noact rootdir/var/lib/dpkg/status 30 | } 31 | 32 | testnoact 33 | testsuccess aptget update --print-uris 34 | testnoact 35 | 36 | # same thing, just not with InRelease this time 37 | rm -rf rootdir/var/lib/apt/lists 38 | testsuccess aptget update -o Acquire::TryInRelease=0 39 | 40 | testnoact 41 | testsuccess aptget update --print-uris -o Acquire::TryInRelease=0 42 | testnoact 43 | -------------------------------------------------------------------------------- /test/integration/test-apt-update-simple: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | insertpackage 'unstable' 'foo' 'all' '1' 10 | insertpackage 'unstable' 'bar' 'amd64' '1' 11 | insertpackage 'unstable' 'bar' 'i386' '1' 12 | insertsource 'unstable' 'foo' 'all' '1' 13 | 14 | sed -e 's#^Description-en:#Description-de:#' \ 15 | aptarchive/dists/unstable/main/i18n/Translation-en > aptarchive/dists/unstable/main/i18n/Translation-de 16 | 17 | setupaptarchive --no-update 18 | changetowebserver 19 | 20 | # the framework modifies some configs to ensure testability, 21 | # at the expense of creating an environment which doesn't always 22 | # reflect apts "normal" behavior on a "normal" system 23 | echo 'Acquire::IndexTargets::Randomized "true"; 24 | Acquire::Languages { "environment"; "en"; "de"; }; 25 | ' > rootdir/etc/apt/apt.conf.d/restore-simplicity 26 | 27 | testempty aptget indextargets 28 | testsuccess aptget update 29 | testequal 'main/source/Sources 30 | main/binary-amd64/Packages 31 | main/binary-all/Packages 32 | main/i18n/Translation-en 33 | main/i18n/Translation-de' aptget indextargets --format '$(METAKEY)' 34 | 35 | # Check that -o Acquire::Queue-Mode=access does not crash 36 | find rootdir/var/lib/apt/lists/ -type f -delete 37 | testsuccess valgrind aptget update -o Acquire::Queue-Mode=access 38 | -------------------------------------------------------------------------------- /test/integration/test-bug-691453-apt-cache-search-multi-pattern: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'native' 8 | 9 | insertpackage 'unstable' 'foobar' 'native' '1' '' '' 'funky tool' 10 | insertpackage 'unstable' 'coolstuff' 'native' '1' '' '' 'funky tool just like foo and bar' 11 | insertpackage 'unstable' 'foo' 'native' '1' '' '' 'tool best used with bar' 12 | insertpackage 'unstable' 'bar' 'native' '1' '' '' 'tool best used with foo' 13 | insertpackage 'unstable' 'baz' 'native' '1' 'Provides: bar' '' 'alternative tool best used with foo' 14 | 15 | setupaptarchive 16 | 17 | # in this special case the following queries should be equal 18 | FOOBAR='foobar - funky tool 19 | coolstuff - funky tool just like foo and bar 20 | foo - tool best used with bar 21 | bar - tool best used with foo 22 | baz - alternative tool best used with foo' 23 | 24 | testsuccessequal "$FOOBAR" aptcache search foo 25 | testsuccessequal "$FOOBAR" aptcache search bar 26 | testsuccessequal "$FOOBAR" aptcache search foo bar 27 | 28 | testsuccessequal 'foobar - funky tool 29 | foo - tool best used with bar' aptcache search -n foo 30 | testsuccessequal 'foobar - funky tool 31 | bar - tool best used with foo 32 | baz - alternative tool best used with foo' aptcache search -n bar 33 | testsuccessequal 'foobar - funky tool' aptcache search -n foo bar 34 | -------------------------------------------------------------------------------- /test/integration/test-apt-get-source-multisources: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | configarchitecture 'armhf' 9 | 10 | insertsource 'unstable' 'adduser' 'all' '3.113+nmu3' 11 | insertsource 'stable' 'python-fll' 'all' '0.9.11' 12 | 13 | insertpackage 'unstable' 'adduser' 'all' '3.113+nmu3' 14 | insertpackage 'stable' 'python-fll' 'all' '0.9.11' 15 | 16 | setupaptarchive 17 | 18 | APTARCHIVE=$(readlink -f ./aptarchive) 19 | 20 | HEADER='Reading package lists...' 21 | testsuccessequal "$HEADER 22 | Need to get 0 B/43 B of source archives. 23 | 'file:${APTARCHIVE}/adduser_3.113%2bnmu3.dsc' adduser_3.113+nmu3.dsc 22 SHA256:19cc1abe85063976bf71c033f62f3e6bf6621647fe44a6ee31ed687e3fa5cbb7 24 | 'file:${APTARCHIVE}/python-fll_0.9.11.dsc' python-fll_0.9.11.dsc 21 SHA256:51429e835ded66abf6bbc157865af29920435e74aea2836ba1f46443feae9285" aptget source -qdy --print-uris --dsc-only adduser=3.113 python-fll=0.9.11 25 | 26 | testsuccessequal "$HEADER 27 | Need to get 0 B/43 B of source archives. 28 | 'file:${APTARCHIVE}/python-fll_0.9.11.dsc' python-fll_0.9.11.dsc 21 SHA256:51429e835ded66abf6bbc157865af29920435e74aea2836ba1f46443feae9285 29 | 'file:${APTARCHIVE}/adduser_3.113%2bnmu3.dsc' adduser_3.113+nmu3.dsc 22 SHA256:19cc1abe85063976bf71c033f62f3e6bf6621647fe44a6ee31ed687e3fa5cbb7" aptget source -qdy --print-uris --dsc-only python-fll=0.9.11 adduser=3.113 30 | -------------------------------------------------------------------------------- /test/integration/test-apt-edit-sources: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | configarchitecture 'native' 9 | 10 | echo 'Dir::Bin::Editor "cat";' > rootdir/etc/apt/apt.conf.d/editor.conf 11 | 12 | echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list.d/rocks.list 13 | testsuccessequal "$(cat rootdir/etc/apt/sources.list.d/rocks.list)" apt edit-sources rocks.list 14 | 15 | cat >editor.sh < rootdir/etc/apt/apt.conf.d/editor.conf 22 | testsuccess apt edit-sources blub.list 23 | testfailure test -e 'rootdir/etc/apt/sources.list.d/blub.list' 24 | 25 | cat >editor.sh < "\$1" 29 | EOF 30 | testsuccess apt edit-sources blub.list 31 | testfilestats 'rootdir/etc/apt/sources.list.d/blub.list' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" 32 | 33 | echo 'Dir::Bin::Editor "cat";' > rootdir/etc/apt/apt.conf.d/editor.conf 34 | echo 'blub' > rootdir/etc/apt/sources.list.d/blub.list 35 | testfailure apt edit-sources blub.list --assume-no 36 | 37 | echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list.d/blub.list 38 | touch -m -d 'now + 1 hour' rootdir/etc/apt/sources.list.d/blub.list 39 | testwarning apt edit-sources blub.list --assume-no 40 | -------------------------------------------------------------------------------- /apt-pkg/version.cc: -------------------------------------------------------------------------------- 1 | // -*- mode: cpp; mode: fold -*- 2 | // Description /*{{{*/ 3 | /* ###################################################################### 4 | 5 | Version - Versioning system.. 6 | 7 | ##################################################################### */ 8 | /*}}}*/ 9 | // Include Files /*{{{*/ 10 | #include 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | /*}}}*/ 17 | 18 | static pkgVersioningSystem *VSList[10]; 19 | pkgVersioningSystem **pkgVersioningSystem::GlobalList = VSList; 20 | unsigned long pkgVersioningSystem::GlobalListLen = 0; 21 | 22 | // pkgVS::pkgVersioningSystem - Constructor /*{{{*/ 23 | // --------------------------------------------------------------------- 24 | /* Link to the global list of versioning systems supported */ 25 | pkgVersioningSystem::pkgVersioningSystem() : Label(NULL) 26 | { 27 | VSList[GlobalListLen] = this; 28 | ++GlobalListLen; 29 | } 30 | /*}}}*/ 31 | // pkgVS::GetVS - Find a VS by name /*{{{*/ 32 | // --------------------------------------------------------------------- 33 | /* */ 34 | pkgVersioningSystem *pkgVersioningSystem::GetVS(const char *Label) 35 | { 36 | for (unsigned I = 0; I != GlobalListLen; I++) 37 | if (strcmp(VSList[I]->Label,Label) == 0) 38 | return VSList[I]; 39 | return 0; 40 | } 41 | /*}}}*/ 42 | 43 | 44 | pkgVersioningSystem::~pkgVersioningSystem() {} 45 | -------------------------------------------------------------------------------- /debian/tests/run-tests: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | SOURCE_DIR="$(pwd)" 5 | if [ -z "$AUTOPKGTEST_TMP" ]; then 6 | BUILD_DIR='' 7 | cleanup() { 8 | if [ -n "$BUILD_DIR" ]; then cd /; rm -rf -- "$BUILD_DIR"; fi 9 | BUILD_DIR='' 10 | } 11 | trap 'cleanup' 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 12 | BUILD_DIR="$(mktemp -d)" 13 | else 14 | BUILD_DIR="$AUTOPKGTEST_TMP" 15 | fi 16 | 17 | if [ ! -e "${BUILD_DIR}/CMakeCache.txt" ]; then 18 | cmake -S "$SOURCE_DIR" -B "$BUILD_DIR" -DUSE_SYSTEM_APTPKG=ON -DWITH_DOC=OFF -DUSE_NLS=OFF 19 | fi 20 | 21 | make -C "${BUILD_DIR}/test/interactive-helper" 22 | 23 | # run tests against the installed apt, use "env -i" to ensure 24 | # the host env does not pollute our environment 25 | env -i \ 26 | APT_INTEGRATION_TESTS_SOURCE_DIR="${SOURCE_DIR}" \ 27 | APT_INTEGRATION_TESTS_BUILD_DIR="${BUILD_DIR}" \ 28 | APT_INTEGRATION_TESTS_METHODS_DIR=/usr/lib/apt/methods \ 29 | APT_INTEGRATION_TESTS_LIBEXEC_DIR=/usr/lib/apt/ \ 30 | APT_INTEGRATION_TESTS_INTERNAL_SOLVER=/usr/lib/apt/solvers/apt \ 31 | APT_INTEGRATION_TESTS_DUMP_SOLVER=/usr/lib/apt/solvers/dump \ 32 | APT_INTEGRATION_TESTS_INTERNAL_PLANNER=/usr/lib/apt/planners/apt \ 33 | APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR=/usr/bin \ 34 | APT_INTEGRATION_TESTS_CMDLINE_BIN_DIR=/usr/bin \ 35 | APT_INTEGRATION_TESTS_LIBRARY_PATH=/dev/null/does/not/exist \ 36 | APT_INTEGRATION_TESTS_ARTIFACTS_DIR="${AUTOPKGTEST_ARTIFACTS}" \ 37 | "${SOURCE_DIR}/test/integration/run-tests" -q 38 | -------------------------------------------------------------------------------- /test/integration/test-cve-2020-27350: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture "amd64" 8 | 9 | ${APTTESTHELPERSBINDIR}/createdeb-cve-2020-27350 crash crash.deb 10 | testequal "E: Invalid archive member header" runapt ${APTTESTHELPERSBINDIR}/testdeb ./crash.deb 11 | 12 | ${APTTESTHELPERSBINDIR}/createdeb-cve-2020-27350 loop loop.deb 13 | testequal "E: Invalid archive member header" runapt ${APTTESTHELPERSBINDIR}/testdeb ./loop.deb 14 | 15 | ${APTTESTHELPERSBINDIR}/createdeb-cve-2020-27350 long-name long-name.deb 16 | testequal "E: Long name to large: 67108865 bytes > 1048576 bytes" runapt ${APTTESTHELPERSBINDIR}/extract-control long-name.deb control 17 | 18 | ${APTTESTHELPERSBINDIR}/createdeb-cve-2020-27350 long-link long-link.deb 19 | testequal "E: Long name to large: 67108865 bytes > 1048576 bytes" runapt ${APTTESTHELPERSBINDIR}/extract-control long-link.deb control 20 | 21 | ${APTTESTHELPERSBINDIR}/createdeb-cve-2020-27350 long-control long-control.deb 22 | testequal "E: Control file too large: 67108865 > 67108864 bytes" runapt ${APTTESTHELPERSBINDIR}/extract-control long-control.deb control 23 | 24 | ${APTTESTHELPERSBINDIR}/createdeb-cve-2020-27350 too-long-control too-long-control.deb 25 | testequal "E: Tar member too large: $((128 * 1024 * 1024 * 1024 + 1)) > $((128 * 1024 * 1024 * 1024)) bytes" runapt ${APTTESTHELPERSBINDIR}/extract-control too-long-control.deb control 26 | -------------------------------------------------------------------------------- /test/integration/test-ubuntu-bug-1921626-unsized-packages: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | configarchitecture "i386" 9 | confighashes 'SHA512' 10 | 11 | mkdir tree 12 | head -c $((5*1024)) /dev/urandom > tree/data-file 13 | 14 | buildsimplenativepackage 'a' 'all' '1.0' 'stable' 15 | buildsimplenativepackage 'b' 'all' '1.0' 'stable' '' '' '' '' "$PWD/tree" 16 | buildsimplenativepackage 'c' 'all' '1.0' 'stable' 17 | 18 | setupaptarchive --no-update 19 | changetowebserver 20 | 21 | testsuccess apt update 22 | 23 | for file in rootdir/var/lib/apt/lists/*Packages; do 24 | awk '!(/^Size/ && ++cnt==2)' $file > $file.new 25 | mv $file.new $file 26 | done 27 | 28 | 29 | size_a=$(wc -c aptarchive/pool/a_1.0_all.deb | awk '{print $1}') 30 | size_b=$(wc -c aptarchive/pool/b_1.0_all.deb | awk '{print $1}') 31 | size_c=$(wc -c aptarchive/pool/c_1.0_all.deb | awk '{print $1}') 32 | 33 | cd downloaded 34 | testsuccessequal "Get:1 http://localhost:${APTHTTPPORT} stable/main all a all 1.0 [$size_a B] 35 | Get:2 http://localhost:${APTHTTPPORT} stable/main all b all 1.0 [$size_b B] 36 | Get:3 http://localhost:${APTHTTPPORT} stable/main all c all 1.0 [$size_c B]" apt download a b c -o Acquire::AllowUnsizedPackages=true 37 | rm *.deb 38 | 39 | testfailureequal "E: Repository is broken: http://localhost:${APTHTTPPORT} stable/main all b all 1.0 has no Size information" apt download a b c 40 | cd .. 41 | -------------------------------------------------------------------------------- /test/integration/test-apt-progress-fd-deb822: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | 7 | setupenvironment 8 | configarchitecture 'amd64' 'i386' 9 | 10 | buildsimplenativepackage 'testing' 'amd64' '0.1' 'stable' 11 | buildsimplenativepackage 'testing' 'all' '0.8.15' 'stable' 12 | buildsimplenativepackage 'testing2' 'amd64,i386' '0.8.15' 'stable' 13 | setupaptarchive 14 | 15 | # install native 16 | exec 3> apt-progress.log 17 | testsuccess aptget install testing=0.1 -y -o APT::Status-deb822-Fd=3 18 | 19 | testfileequal './apt-progress.log' 'Status: progress 20 | Percent: 0.0000 21 | Message: Running dpkg 22 | 23 | Status: progress 24 | Package: testing:amd64 25 | Percent: 0.0000 26 | Message: Preparing testing (amd64) 27 | 28 | Status: progress 29 | Package: testing:amd64 30 | Percent: 20.0000 31 | Message: Unpacking testing (amd64) 32 | 33 | Status: progress 34 | Package: testing:amd64 35 | Percent: 40.0000 36 | Message: Installing testing (amd64) 37 | 38 | Status: progress 39 | Percent: 40.0000 40 | Message: Running dpkg 41 | 42 | Status: progress 43 | Package: testing:amd64 44 | Percent: 40.0000 45 | Message: Preparing to configure testing (amd64) 46 | 47 | Status: progress 48 | Package: testing:amd64 49 | Percent: 60.0000 50 | Message: Configuring testing (amd64) 51 | 52 | Status: progress 53 | Package: testing:amd64 54 | Percent: 80.0000 55 | Message: Installed testing (amd64) 56 | ' 57 | 58 | rm -f apt-progress*.log 59 | -------------------------------------------------------------------------------- /test/interactive-helper/libnoprofile.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #undef _FORTIFY_SOURCE 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | int vprintf(const char *format, va_list ap) { 11 | if (strncmp(format, "profiling:", strlen("profiling:")) == 0) 12 | return 0; 13 | 14 | static int (*func_fprintf)(const char *format, va_list ap) = NULL; 15 | if (func_fprintf == NULL) 16 | func_fprintf = (int (*)(const char *format, va_list ap))dlsym(RTLD_NEXT, "vprintf"); 17 | 18 | return func_fprintf(format, ap); 19 | } 20 | int printf(const char *format, ...) { 21 | va_list ap; 22 | va_start(ap, format); 23 | int res = vprintf(format, ap); 24 | va_end(ap); 25 | return res; 26 | } 27 | 28 | int vfprintf(FILE *stream, const char *format, va_list ap) { 29 | if (strncmp(format, "profiling:", strlen("profiling:")) == 0) 30 | return 0; 31 | 32 | static int (*func_vfprintf)(FILE * stream, const char *format, va_list ap) = NULL; 33 | if (func_vfprintf == NULL) 34 | func_vfprintf = (int (*)(FILE * stream, const char *format, va_list ap))dlsym(RTLD_NEXT, "vfprintf"); 35 | 36 | return func_vfprintf(stream, format, ap); 37 | } 38 | 39 | int fprintf(FILE *stream, const char *format, ...) { 40 | va_list ap; 41 | va_start(ap, format); 42 | int res = vfprintf(stream, format, ap); 43 | va_end(ap); 44 | return res; 45 | } 46 | -------------------------------------------------------------------------------- /test/integration/test-bug-870675-hang-on-unsupported-method: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | changetowebserver 10 | 11 | echo 'foo' > aptarchive/foobar 12 | echo 'bar' > aptarchive/foobar2 13 | 14 | testsuccess apthelper download-file "http://localhost:${APTHTTPPORT}/foobar" ./downloaded/foobar 'SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15' 15 | rm -f ./downloaded/foobar 16 | testsuccess apthelper download-file "http://localhost:${APTHTTPPORT}/foobar" ./downloaded/foobar 'SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15' \ 17 | "http://localhost:${APTHTTPPORT}/foobar2" ./downloaded/foobar2 'SHA1:e242ed3bffccdf271b7fbaf34ed72d089537b42f' 18 | rm -f ./downloaded/foobar ./downloaded/foobar2 19 | 20 | testfailure apthelper download-file "foo://localhost:${APTHTTPPORT}/foobar" ./downloaded/foobar 'SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15' 21 | testsuccess grep 'The method driver .*/foo could not be found' rootdir/tmp/testfailure.output 22 | rm -f ./downloaded/foobar 23 | testfailure apthelper download-file "foo://localhost:${APTHTTPPORT}/foobar" ./downloaded/foobar 'SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15' \ 24 | "foo://localhost:${APTHTTPPORT}/foobar2" ./downloaded/foobar2 'SHA1:e242ed3bffccdf271b7fbaf34ed72d089537b42f' 25 | testsuccess grep 'The method driver .*/foo could not be found' rootdir/tmp/testfailure.output 26 | rm -f ./downloaded/foobar ./downloaded/foobar2 27 | -------------------------------------------------------------------------------- /test/integration/status-github-23-too-long-dependency-line: -------------------------------------------------------------------------------- 1 | Package: network-manager-strongswan 2 | Status: install ok installed 3 | Priority: extra 4 | Section: net 5 | Installed-Size: 256 6 | Maintainer: Jean-Christophe Manciot 7 | Architecture: amd64 8 | Version: 1.3.1-14 9 | Provides: network-manager-strongswan 10 | Depends: libart-2.0-2, libatk1.0-0, libavahi-client3, libavahi-common3, libavahi-glib1, libbonobo2-0, libbonoboui2-0, libc6, libcairo2, libcanberra0, libdatrie1, libdbus-1-3, libdbus-glib-1-2, libexpat1, libffi6, libfontconfig1, libfreetype6, libgail18, libgconf-2-4, libgcrypt20, libgdk-pixbuf2.0-0, libglib2.0-0, libglib2.0-0-dbg, libglib2.0-0-refdbg, libgmp10, libgnome-2-0, libgnomecanvas2-0, libgnome-keyring0, libgnomeui-0, libgnomevfs2-0, libgnutls30, libgpg-error0, libgraphite2-3, libgtk2.0-0, libharfbuzz0b, libhogweed4, libice6, libidn11, libltdl7, liblzma5, libnettle6, libnm-glib-vpn1, libnm-util2, libogg0, liborbit-2-0, libp11-kit0, libpango-1.0-0, libpangocairo-1.0-0, libpangoft2-1.0-0, libpcre3, libpixman-1-0, libpng12-0, libpopt0, libselinux1, libsm6, libsystemd0, libtasn1-6, libtdb1, libthai0, libuuid1, libvorbis0a, libvorbisfile3, libx11-6, libxau6, libxcb1, libxcb-render0, libxcb-shm0, libxcomposite1, libxcursor1, libxdamage1, libxdmcp6, libxext6, libxfixes3, libxi6, libxinerama1, libxml2, libxrandr2, libxrender1, zlib1g 11 | Description: This package provides an IKEv2 IPSec VPN plugin for strongswan 12 | Description-md5: 31abf1e375284c7ee36f25bf936125f1 13 | -------------------------------------------------------------------------------- /test/integration/test-different-methods-for-same-source: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | insertpackage 'stable' 'foo' 'all' '1' 10 | insertsource 'stable' 'foo' 'all' '1' 11 | setupaptarchive --no-update 12 | 13 | changetowebserver 14 | webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "http://localhost:${APTHTTPPORT}/" 15 | 16 | echo 'Dir::Bin::Methods::http-ng "http";' > rootdir/etc/apt/apt.conf.d/99add-http-ng-method 17 | sed -i -e 's# http:# http-ng:#' $(find rootdir/etc/apt/sources.list.d -name '*-deb-src.list') 18 | 19 | testsuccess apt update -o Debug::Acquire::http-ng=1 20 | cp rootdir/tmp/testsuccess.output update.log 21 | # all requests are folded into the first Release file 22 | testsuccess grep ' http-ng://' update.log 23 | testfailure grep ' http://' update.log 24 | # see if method-specific debug was enabled 25 | testsuccess grep '^Answer for: http-ng:' update.log 26 | 27 | rm -rf rootdir/var/lib/apt/lists 28 | sed -i -e "s#:${APTHTTPPORT}/#:${APTHTTPPORT}/redirectme#" rootdir/etc/apt/sources.list.d/* 29 | testsuccess apt update -o Debug::Acquire::http-ng=1 30 | cp rootdir/tmp/testsuccess.output update.log 31 | # all requests are folded into the first Release file 32 | testsuccess grep ' http-ng://' update.log 33 | testfailure grep '^[^L].* http://' update.log 34 | # see if method-specific debug was enabled 35 | testsuccess grep '^Answer for: http-ng:' update.log 36 | -------------------------------------------------------------------------------- /test/integration/Packages-bug-593360-modifiers-in-names: -------------------------------------------------------------------------------- 1 | Package: g++ 2 | Priority: optional 3 | Section: devel 4 | Installed-Size: 40 5 | Maintainer: Debian GCC Maintainers 6 | Architecture: i386 7 | Source: gcc-defaults (1.96) 8 | Version: 4:4.4.5-1 9 | Filename: pool/main/g/gcc-defaults/g++_4.4.5-1_i386.deb 10 | Size: 1372 11 | MD5sum: 37e129a4b130e8b96a9b9d5b26a3fffa 12 | SHA1: d98768d1547389a563e60433268143f42578c3e6 13 | SHA256: 18d933972392d233127bdd766cfcaaaa2e35f57de47c7af678d599be9613d562 14 | Description: The GNU C++ compiler 15 | 16 | Package: apt 17 | Priority: important 18 | Section: admin 19 | Installed-Size: 5984 20 | Maintainer: APT Development Team 21 | Architecture: all 22 | Version: 0.8.8 23 | Filename: pool/main/a/apt/apt_0.8.8_i386.deb 24 | Size: 2140632 25 | MD5sum: 4283aa3bb751253faf1b2204e0229e4f 26 | SHA1: 59d432f56901faa86e814a436b8da010ee1c7b8a 27 | SHA256: 072dcf4359dce9698aeaa54366eb20513f860c2bb6d44a95973c0b2ad413bfab 28 | Description: Advanced front-end for dpkg 29 | 30 | Package: apt+ 31 | Priority: important 32 | Section: admin 33 | Installed-Size: 5984 34 | Maintainer: APT Development Team 35 | Architecture: all 36 | Version: 0.8.8 37 | Filename: pool/main/a/apt/apt_0.8.8_i386.deb 38 | Size: 2140632 39 | MD5sum: 4283aa3bb751253faf1b2204e0229e4f 40 | SHA1: 59d432f56901faa86e814a436b8da010ee1c7b8a 41 | SHA256: 072dcf4359dce9698aeaa54366eb20513f860c2bb6d44a95973c0b2ad413bfab 42 | Description: Advanced front-end for dpkg 43 | -------------------------------------------------------------------------------- /methods/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Create the executable targets 2 | include_directories($<$:${SECCOMP_INCLUDE_DIR}>) 3 | link_libraries(apt-pkg $<$:${SECCOMP_LIBRARIES}>) 4 | 5 | add_library(connectlib OBJECT connect.cc rfc2553emu.cc) 6 | 7 | add_executable(file file.cc) 8 | add_executable(copy copy.cc) 9 | add_executable(store store.cc) 10 | add_executable(gpgv gpgv.cc) 11 | if (SQV_EXECUTABLE) 12 | add_executable(sqv sqv.cc) 13 | install(TARGETS sqv 14 | RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/apt/methods) 15 | endif() 16 | add_executable(cdrom cdrom.cc) 17 | add_executable(http http.cc basehttp.cc $) 18 | add_executable(mirror mirror.cc) 19 | add_executable(rred rred.cc) 20 | 21 | target_compile_definitions(connectlib PRIVATE ${OPENSSL_DEFINITIONS}) 22 | target_include_directories(connectlib PRIVATE ${OPENSSL_INCLUDE_DIR}) 23 | target_include_directories(http PRIVATE $<$:${SYSTEMD_INCLUDE_DIRS}>) 24 | 25 | # Additional libraries to link against for networked stuff 26 | target_link_libraries(http OpenSSL::SSL $<$:${SYSTEMD_LIBRARIES}>) 27 | 28 | target_link_libraries(rred apt-private) 29 | 30 | # Install the library 31 | install(TARGETS file copy store cdrom gpgv http rred mirror 32 | RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/apt/methods) 33 | 34 | add_links(${CMAKE_INSTALL_LIBEXECDIR}/apt/methods mirror mirror+http mirror+https mirror+file mirror+copy) 35 | 36 | 37 | add_links(${CMAKE_INSTALL_LIBEXECDIR}/apt/methods http https) 38 | -------------------------------------------------------------------------------- /test/integration/test-apt-get-autoremove-real-virtual-provider: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | TESTDIR="$(readlink -f "$(dirname "$0")")" 5 | . "$TESTDIR/framework" 6 | setupenvironment 7 | configarchitecture 'amd64' 8 | 9 | insertinstalledpackage 'needs' 'all' '1' 10 | insertinstalledpackage 'needs-provider1' 'all' '1' 'Provides: needs (= 1)' 11 | insertinstalledpackage 'needs-provider2' 'all' '1' 'Provides: needs (= 2)' 12 | insertinstalledpackage 'needs-provider3' 'all' '1' 'Provides: needs (= 3)' 13 | insertinstalledpackage 'needs-provider4' 'all' '1' 'Provides: needs (= 4)' 14 | 15 | insertinstalledpackage 'foo' 'all' '1' 'Depends: needs (= 1), needs (= 2), needs (= 3)' 16 | 17 | testsuccess aptmark auto 'needs*' 18 | testsuccessequal 'needs 19 | needs-provider1 20 | needs-provider2 21 | needs-provider3 22 | needs-provider4' aptmark showauto 23 | 24 | testsuccess aptget check -s 25 | 26 | testsuccessequal 'Reading package lists... 27 | Building dependency tree... 28 | Reading state information... 29 | Solving dependencies... 30 | The following packages will be REMOVED: 31 | needs-provider1 needs-provider4 32 | 0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded. 33 | Remv needs-provider1 [1] 34 | Remv needs-provider4 [1]' aptget autoremove -s --solver 3.1 35 | 36 | testsuccessequal 'Reading package lists... 37 | Building dependency tree... 38 | Reading state information... 39 | The following packages will be REMOVED: 40 | needs-provider4 41 | 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. 42 | Remv needs-provider4 [1]' aptget autoremove -s 43 | -------------------------------------------------------------------------------- /apt-pkg/contrib/extracttar.h: -------------------------------------------------------------------------------- 1 | // -*- mode: cpp; mode: fold -*- 2 | // Description /*{{{*/ 3 | /* ###################################################################### 4 | 5 | Extract a Tar - Tar Extractor 6 | 7 | The tar extractor takes an ordinary gzip compressed tar stream from 8 | the given file and explodes it, passing the individual items to the 9 | given Directory Stream for processing. 10 | 11 | ##################################################################### */ 12 | /*}}}*/ 13 | #ifndef PKGLIB_EXTRACTTAR_H 14 | #define PKGLIB_EXTRACTTAR_H 15 | 16 | #include 17 | #include 18 | 19 | #include 20 | 21 | 22 | class pkgDirStream; 23 | 24 | class APT_PUBLIC ExtractTar 25 | { 26 | protected: 27 | 28 | struct TarHeader; 29 | 30 | // The varios types items can be 31 | enum ItemType {NormalFile0 = '\0',NormalFile = '0',HardLink = '1', 32 | SymbolicLink = '2',CharacterDevice = '3', 33 | BlockDevice = '4',Directory = '5',FIFO = '6', 34 | GNU_LongLink = 'K',GNU_LongName = 'L'}; 35 | 36 | FileFd &File; 37 | unsigned long long MaxInSize; 38 | int GZPid; 39 | FileFd InFd; 40 | bool Eof; 41 | std::string DecompressProg; 42 | 43 | // Fork and reap gzip 44 | bool StartGzip(); 45 | bool Done(); 46 | 47 | public: 48 | 49 | bool Go(pkgDirStream &Stream); 50 | 51 | ExtractTar(FileFd &Fd,unsigned long long Max,std::string DecompressionProgram); 52 | virtual ~ExtractTar(); 53 | }; 54 | 55 | #endif 56 | --------------------------------------------------------------------------------