summaryrefslogtreecommitdiff
path: root/apt-pkg/cdrom.cc
Commit message (Collapse)AuthorAgeFilesLines
* Retire and deprecate _strtabexpandDavid Kalnischkies2021-02-031-19/+12
| | | | | | | | If the Configuration code calling this was any indication, it is hard to use – and even that monster still caused heap-buffer-overflow errors, so instead of trying to fix it, lets just use methods which are far easier to use. The question why this is done at all remains, but is left for another day as an exercise for the reader.
* cdrom: Remove old udev dlopen stuffJulian Andres Klode2020-02-261-6/+0
|
* Use quoted tagnames in config dumpsDavid Kalnischkies2018-11-291-1/+1
| | | | | | | | | | | | | | Tagnames in configuration can include spaces (and other nasties) e.g. in repository-specific configuration options due to Origin/Label potentially containing a space. The configuration file format supports parsing quoted as well as encoded spaces, but the output generated by apt-config and other places which might be feedback into apt via parsing (e.g. before calling apt-key in our gpgv method) do not quote and hence produce invalid configuration files. Changing the default to be an encoded tagname ensures that the output of dump can be used as a config file, but other users might not expect this so that is technically a backward-breaking change.
* Fix typo reported by codespell in code commentsDavid Kalnischkies2018-11-251-1/+1
| | | | | | | | No user visible change expect for some years old changelog entries, so we don't really need to add a new one for this… Reported-By: codespell Gbp-Dch: Ignore
* simplify translating "lists directory missing" msgDavid Kalnischkies2018-01-041-1/+1
| | | | | | | | The appended "partial" should not be translated, but some translations got this wrong and now that there is also "auxfiles" we can just fix that problem by hiding these untranslatables from the translators. Gbp-Dch: Ignore
* avoid some useless casts reported by -Wuseless-castDavid Kalnischkies2017-12-131-1/+1
| | | | | | | | | The casts are useless, but the reports show some where we can actually improve the code by replacing them with better alternatives like converting whatever int type into a string instead of casting to a specific one which might in the future be too small. Reported-By: gcc -Wuseless-cast
* Directly link against libudev on Linux systemsJulian Andres Klode2017-09-091-37/+10
| | | | | | | | | | | | | | | | | | | We previously dlopen()ed it, but it seems painful to do that without any real gain, except for possibly not having libudev in the address space and not having code #ifdefed for Linux. The latter means that we are a bit more likely to break stuff for non-Linux systems now if we play with udev, but at least we don't end up with it silently breaking because of a libudev ABI break. The existing function pointers in the struct were renamed and kept for compat purposes. Fixes Debian/apt#48 Also adjust prepare-release to strip [linux-any] from build-depends for travis.
* Reformat and sort all includes with clang-formatJulian Andres Klode2017-07-121-14/+13
| | | | | | | | | | | | | This makes it easier to see which headers includes what. The changes were done by running git grep -l '#\s*include' \ | grep -E '.(cc|h)$' \ | xargs sed -i -E 's/(^\s*)#(\s*)include/\1#\2 include/' To modify all include lines by adding a space, and then running ./git-clang-format.sh.
* fix various typos reported by spellintianDavid Kalnischkies2017-01-191-1/+1
| | | | | | | | Most of them in (old) code comments. The two instances of user visible string changes the po files of the manpages are fixed up as well. Gbp-Dch: Ignore Reported-By: spellintian
* Fix several typosVeres Lajos2016-03-071-2/+2
| | | | | | | | | | | | | This effectively merges branch 'typofixes-vlajos-20150807' of github.com:vlajos/apt with the following commit: commit 13cacb3e2e2352ba701e769fc889e3344fabbf7e Author: Veres Lajos <vlajos@gmail.com> Date: Sun Aug 9 00:12:53 2015 +0100 typofix - https://github.com/vlajos/misspell_fixer It has been rebased for a better commit message.
* outsmart gcc -O3 over-optimization in pkgCdrom::FindPackagesDavid Kalnischkies2015-11-271-3/+3
| | | | | | | | Seems like a simpler workaround than forcing a lower optimization level just for this for all of apt. See also: https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1473674
* wrap every unlink call to check for != /dev/nullDavid Kalnischkies2015-11-041-3/+3
| | | | | | | | | | | | | | | | Unlinking /dev/null is bad, we shouldn't do that. Also, we should print at least a warning if we tried to unlink a file but didn't manage to pull it of (ignoring the case were the file is /dev/null or doesn't exist in the first place). This got triggered by a relatively unlikely to cause problem in pkgAcquire::Worker::PrepareFiles which would while temporary uncompressed files (which are set to keep compressed) figure out that to files are the same and prepare for sharing by deleting them. Bad move. That also shows why not printing a warning is a bad idea as this hide the error for in non-root test runs. Git-Dch: Ignore
* support arch:all data e.g. in separate Packages fileDavid Kalnischkies2015-11-041-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on a discussion with Niels Thykier who asked for Contents-all this implements apt trying for all architecture dependent files to get a file for the architecture all, which is treated internally now as an official architecture which is always around (like native). This way arch:all data can be shared instead of duplicated for each architecture requiring the user to download the same information again and again. There is one problem however: In Debian there is already a binary-all/ Packages file, but the binary-any files still include arch:all packages, so that downloading this file now would be a waste of time, bandwidth and diskspace. We therefore need a way to decide if it makes sense to download the all file for Packages in Debian or not. The obvious answer would be a special flag in the Release file indicating this, which would need to default to 'no' and every reasonable repository would override it to 'yes' in a few years time, but the flag would be there "forever". Looking closer at a Release file we see the field "Architectures", which doesn't include 'all' at the moment. With the idea outlined above that 'all' is a "proper" architecture now, we interpret this field as being authoritative in declaring which architectures are supported by this repository. If it says 'all', apt will try to get all, if not it will be skipped. This gives us another interesting feature: If I configure a source to download armel and mips, but it declares it supports only armel apt will now print a notice saying as much. Previously this was a very cryptic failure. If on the other hand the repository supports mips, too, but for some reason doesn't ship mips packages at the moment, this 'missing' file is silently ignored (= that is the same as the repository including an empty file). The Architectures field isn't mandatory through, so if it isn't there, we assume that every architecture is supported by this repository, which skips the arch:all if not listed in the release file.
* Really fix all iwyu issuesMichael Vogt2015-08-171-0/+1
| | | | Git-Dch: ignore
* Fix all the wrong removals of includes that iwyu got wrongMichael Vogt2015-08-171-0/+2
| | | | Git-Dch: ignore
* Cleanup includes after running iwyuMichael Vogt2015-08-171-2/+0
|
* make all d-pointer * const pointersDavid Kalnischkies2015-08-101-3/+3
| | | | | | | | | | | | | | Doing this disables the implicit copy assignment operator (among others) which would cause hovac if used on the classes as it would just copy the pointer, not the data the d-pointer points to. For most of the classes we don't need a copy assignment operator anyway and in many classes it was broken before as many contain a pointer of some sort. Only for our Cacheset Container interfaces we define an explicit copy assignment operator which could later be implemented to copy the data from one d-pointer to the other if we need it. Git-Dch: Ignore
* add d-pointer, virtual destructors and de-inline de/constructorsDavid Kalnischkies2015-06-161-0/+6
| | | | | | | | To have a chance to keep the ABI for a while we need all three to team up. One of them missing and we might loose, so ensuring that they are available is a very tedious but needed task once in a while. Git-Dch: Ignore
* ensure lists/ files have correct permissions after apt-cdrom addDavid Kalnischkies2015-04-191-9/+4
| | | | | | | | Its a bit unpredictable which permissons and owners we will encounter on a CD-ROM (or a USB stick, as apt-cdrom is responsible for those too), so we have to ensure in this codepath as well that everything is nicely setup without waiting for a 'apt-get update' to fix up the (potential) mess.
* fix some new compiler warnings reported by gcc-5David Kalnischkies2015-03-161-5/+5
| | | | Git-Dch: Ignore
* create our cache and lib directory always with mode 755David Kalnischkies2014-11-181-2/+5
| | | | | | | | | | | | | We autocreate for a while now the last two directories in /var/lib/apt/lists (similar for /var/cache/apt/archives) which is very nice for systems having any of those on tmpfs or other non-persistent storage. This also means though that this creation is effected by the default umask, so for people with aggressive umasks like 027 the directories will be created with 750, which means all non-root users are left out, which is usually exactly what we want then this umask is set, but the cache and lib directories contain public knowledge. There isn't any need to protect them from viewers and they render apt completely useless if not readable.
* fix: Member variable 'X' is not initialized in the constructor.David Kalnischkies2014-09-271-3/+7
| | | | | Reported-By: cppcheck Git-Dch: Ignore
* properly undo CD-ROM mount in all error casesJohn Ogness2014-04-261-25/+41
| | | | | | | | In bug #740673 various issues in the CD-ROM handling code were identified, while most the issues ended up being fixed in another way, the unmounting of the CD-ROM in error cases was not tackled so far. (The patch was modified by the commiter to apply)
* msgstr with elipses need three dotsDavid Kalnischkies2014-03-131-3/+3
| | | | | fixes some messages and their translation so that all of them have three dots for messages with an elipse. Many translations already had this.
* apt-cdrom ident shouldn't be interactiveDavid Kalnischkies2014-03-131-12/+15
| | | | | | | | | Commit 62dcbf84 changed the code of ident to look more like the code for add on my suggestion. This made ident interactive as it starts with a unmount, press enter, mount cycle. The first two are skipped now. This fixes d-i/apt-setup which is using it to get ID as well as label. Closes: 740673
* cleanup headers and especially #includes everywhereDavid Kalnischkies2014-03-131-16/+18
| | | | | | | | Beside being a bit cleaner it hopefully also resolves oddball problems I have with high levels of parallel jobs. Git-Dch: Ignore Reported-By: iwyu (include-what-you-use)
* warning: unused parameter ‘foo’ [-Wunused-parameter]David Kalnischkies2014-03-131-1/+1
| | | | | Reported-By: gcc -Wunused-parameter Git-Dch: Ignore
* warning: useless cast to type A [-Wuseless-cast]David Kalnischkies2014-03-131-4/+4
| | | | | Git-Dch: Ignore Reported-By: gcc -Wuseless-cast
* warning: extra ‘;’ [-Wpedantic]David Kalnischkies2014-03-131-3/+3
| | | | | Git-Dch: Ignore Reported-By: gcc -Wpedantic
* remove duplication in pkgCdrom::Add and ::IdentDavid Kalnischkies2014-02-121-90/+41
| | | | Git-Dch: Ignore
* apt-cdrom should succeed if any drive succeedsJohn Ogness2014-02-121-2/+24
| | | | | | | | | | | | | | | If there are multiple CD-ROM drives, `apt-cdrom add` will abort with an error if any of the drives do not contain a Debian CD which is against the documentation we have saying "a CD-ROM" and also scripts do not expect it this way. This patch modifies apt-cdrom to return success if any of the drives succeeded. If failures occur, apt-cdrom will still continue trying all the drives and report the last failure (if none of them succeeded). The 'ident' command was also changed to match the new 'add' behavior. Closes: 728153
* ensure state-dir exists before coyping cdrom filesDavid Kalnischkies2013-06-091-0/+8
| | | | | | We do the same in the acquire system which handles the 'normal' downloads, so do it here as well even though its unlikely anyone will ever notice (beside testcases of course …)
* * apt-pkg/cdrom.cc:David Kalnischkies2012-09-031-0/+25
| | | | | | | - copy only configured translation files from a CD-ROM and not all available translation files preventing new installs with d-i from being initialized with all translations (Closes: #678227) - handle Components in the reduction for the source.list as multi-arch CDs otherwise create duplicated source entries (e.g. "wheezy main main")
* * apt-pkg/cdrom.cc:David Kalnischkies2012-09-021-3/+6
| | | | - handle Components in the reduction for the source.list as multi-arch cds otherwise create duplicated source entries (e.g. "wheezy main main")
* * apt-pkg/cdrom.cc:David Kalnischkies2012-08-051-2/+2
| | | | - do not link() but rename() the cdroms.list to cdroms.list~ as a backup to ensure that apt-cdrom can be run multiple times (Closes: #676302)
* * apt-pkg/cdrom.cc:David Kalnischkies2012-06-091-1/+1
| | | | | - fix regression from 0.9.3 which dumped the main configuration _config instead of the cdrom settings (Cnf) as identified and tested by Milan Kupcevic, thanks! (Closes: #674100)
* * apt-pkg/cdrom.cc:David Kalnischkies2012-04-221-19/+2
| | | - use Dump() to generate the configuration output
* * apt-pkg/acquire-worker.cc:David Kalnischkies2012-03-201-2/+4
| | | | | | | | | | | - check return of write() as gcc recommends * apt-pkg/acquire.cc: - check return of write() as gcc recommends * apt-pkg/cdrom.cc: - check return of chdir() and link() as gcc recommends * apt-pkg/clean.cc: - check return of chdir() as gcc recommends * apt-pkg/contrib/netrc.cc: - check return of asprintf() as gcc recommends
* add a testcase for FindPackages() to better validate that cdrom should work.David Kalnischkies2011-12-111-8/+15
| | | | | | Unfortunately it's hard to do an automated integration test with cd, so we test this method in isolation which tries to find Indexes and dropping of duplications with DropRepeats()
* * apt-pkg/cdrom.cc:David Kalnischkies2011-12-111-2/+2
| | | - support InRelease files on cdrom
* use fileutl exists-functions instead of doing the stat'ing by handDavid Kalnischkies2011-12-111-6/+5
|
* strip the extension of the translation file before storing it in the listDavid Kalnischkies2011-12-111-0/+1
| | | | (regression from compression rewrite; found by Steve McIntyre, thanks!)
* use getCompressors() instead of getCompressorTypes() and use it everywhereDavid Kalnischkies2011-11-241-60/+65
| | | | to replace hardcoding of compressiontypes and compressors
* factored out the decompressor code in IndexCopy::CopyPackages() andSteve McIntyre2011-11-231-1/+1
| | | | TranslationsCopy::CopyTranslations() into a single common function
* * apt-pkg/cdrom.cc:Michael Vogt2011-11-221-29/+54
| | | - use aptconfiguration to get the supported compression types
* apt-pkg/cdrom.cc: Accept .bz2, .xz files in addition to .gz files (Closes: ↵Julian Andres Klode2011-11-211-4/+11
| | | | #649451)
* use forward declaration in headers if possible instead of includesDavid Kalnischkies2011-09-191-0/+2
|
* merge with debian/experimentalDavid Kalnischkies2011-09-131-22/+14
|\
| * merged from the debian-sid branchMichael Vogt2011-08-151-13/+13
| |\
| | * cppcheck complains about some possible speed improvements which could beDavid Kalnischkies2011-08-111-13/+13
| | | | | | | | | | | | | | | | | | done on the mirco-optimazation level, so lets fix them: (performance) Possible inefficient checking for emptiness. (performance) Prefer prefix ++/-- operators for non-primitive types.