summaryrefslogtreecommitdiff
path: root/src/filesdb.c
AgeCommit message (Collapse)AuthorFilesLines
2018-08-30libdpkg: Move db-fsys code from src to lib/dpkgGuillem Jover1-410/+0
This will prepare the ground for external programs to start using libdpkg to access the dpkg fsys database via a proper API, instead of messing with the on-disk layout in so many improper ways.
2018-08-30dpkg: Move struct perpackagestate handling into its own fileGuillem Jover1-14/+0
This is not really part of the fsys db handling, and we are not making use of it anymore in it, so let's move it somewhere else more appropriate.
2018-08-30libdpkg: Move files list information from dpkg clientdata to pkginfoGuillem Jover1-30/+17
This will make it possible to move the fsys database parsing and dumping code out from dpkg into libdpkg. This is general package information, even if some clients might not be interested in its contents, such as frontends that just manage metadata and drive dpkg itself.
2018-05-04libdpkg: Move control database code into db-ctrl modulesGuillem Jover1-1/+1
This continues the work to generalize and make these interfaces available to other users beside dpkg itself.
2018-05-03libdpkg: Move filesystem nodename hash implementation into a new moduleGuillem Jover1-209/+0
2018-05-03dpkg: Add new fsys_hash_entries() function to abstract nfiles accessGuillem Jover1-2/+9
This will be needed when moving the fsys hash implementation into libdpkg.
2018-03-26Use internerr() or BUG() instead of assert()Guillem Jover1-3/+7
The problem with assert() is that it does not print the contents of the variables. It also can be disabled on NDEBUG. But we always want these consistency checks no matter what, and they are not performance sensitive anyway. Enable -Wno-nonnull-compare so that we can keep doing run-time non-NULL checks in functions, instead of just compile-time checks.
2016-10-30dpkg: Add new files_db_reset() functionGuillem Jover1-0/+9
2016-02-26dpkg: Use a node instead the head pointer to traverse the namenode listGuillem Jover1-4/+4
2015-12-25dpkg: Fix physical file offset comparisonYuri Gribov1-1/+3
The comparison function pkg_sorter_by_listfile_phys_offs passed to qsort does not satisfy qsort symmetry requirements, for some inputs pkg_sorter_by_listfile_phys_offs(a, b) != - pkg_sorter_by_listfile_phys_offs(b, a) This may cause various qsort misbehaviors e.g. failing to properly sort the input array (on some platforms qsort could even abort although that seems to not be the case for glibc-based systems). Closes: #808912 Signed-off-by: Guillem Jover <guillem@debian.org> Stable-Candidate: 1.16.x 1.17.x
2015-10-18Update Ian Jackson's email addressGuillem Jover1-1/+1
2015-04-10Consistently use proper quotation marks all over the placeGuillem Jover1-3/+3
That is "" or '', and not the unbalanced `' pair.
2014-11-22dpkg: Restore multiple processing checks for packages and archivesGuillem Jover1-0/+1
The notices about duplicate entries not being processed got suppressed when the requeueing insertion protection got enabled. Add a new variable to track when packages or archives have been processed more than once. Regression introduced in commit ce27f5dc0c3dc6ed7656d09784ea461407765d7d.
2014-10-23dpkg: Add a requeueing insertion protection for process_queue()Guillem Jover1-0/+1
We should not requeue packages already in the queue. Just protect it in a similar way in how the deferred triggers queue is protected. In the future these can be unified.
2014-10-06dpkg: Double the filesdb hash table size to the closest 2^18 primeGuillem Jover1-2/+2
Times have changed, and it's common to have at least these many files. This reduces the amount of collisions. Eventually we should switch to dynamically growing hash tables.
2014-10-06dpkg: Switch the filesdb module to use the FNV hash functionGuillem Jover1-10/+5
Use it instead of what seems to be a custom hash function. This seems to reduce dispersion somewhat. As a side effect this fixes an integer overflow. Addresses: #760741 Warned-by: ASan Reported-by: Bálint Réczey <balint@balintreczey.hu>
2014-08-09dpkg: Use filenamenodeflags enum instead of wrongly using fnnflagsGuillem Jover1-1/+1
2014-06-02libdpkg: Uppercase and namespace pkgstatus enum valuesGuillem Jover1-3/+3
2014-05-28dpkg: Uppercase and namespace color cycle enum valuesGuillem Jover1-1/+1
The current names are way too generic, and prone to collide with actual color variables or similar.
2014-05-28dpkg: Uppercase and namespace filesdb_load_status enum and valuesGuillem Jover1-11/+11
2014-05-28dpkg: Uppercase, namespace and reword istobe enum type and valuesGuillem Jover1-1/+2
2013-12-07Use https:// URLs instead of http:// when possibleGuillem Jover1-1/+1
2013-11-23dpkg: Do not lose track of packages owning a fileGuillem Jover1-1/+2
Properly reset the pkg_prev pointer for each file iteration, by moving the variable declaration inside the loop. Regression introduced in commit a2ee7d0bb4d56afb82438f09a50251acfa690643. Reported-by: Raphaël Hertzog <hertzog@debian.org>
2013-10-26dpkg: Use a simple list to track packages owning a fileGuillem Jover1-72/+29
Using a list of package arrays waste at least 10 pointers per path that is not shared by multiple packages, which adds up to significant amount with lots of installed paths and 64-bit pointers. Also the new waste we get from each pkg_list node for each shared file is really minor, as the common thing is for num. paths >>> num. packages.
2013-09-19dpkg: Use an enum for the saidread variableGuillem Jover1-7/+13
2013-04-19Remove Emacs and vim modelinesGuillem Jover1-3/+0
These just clutter the code base, as adding modelines for each possible editor out there does not scale, and they are currently not exhaustive anyway.
2013-04-14Avoid assignments in C conditionalsGuillem Jover1-1/+2
2013-03-18dpkg: Initialize all filenamenode membersGuillem Jover1-0/+1
2012-06-30Avoid full stop and double newline at the end of errors and warningsJonathan Nieder1-2/+2
Error messages like "couldn't parse control information from foo.deb" are not full sentences, so don't punctuate them like one. The main purpose of this patch is stylistic consistency, but perhaps it can also make copy-and-paste from messages like dpkg-query: no path found matching pattern /usr/bin/agrep. a little easier. Most actual full sentences should remain untouched. A few full sentences are error messages at heart, so this patch converts those to lower-case sentence fragment form, too. [guillem@debian.org: - Add missed strings. - Minor tweaks to strings. ] Closes: #624000 Requested-by: Jari Aalto <jari.aalto@cante.net> Signed-off-by: Guillem Jover <guillem@debian.org>
2012-06-06dpkg-divert: Do not warn on missing db .list file for never installed packagesGuillem Jover1-1/+2
When the package has never been installed before, and the unpack has not yet finished, the package will be present on the database but the files list file will not, which would produce a bogus warning. Check if the package has ever been configured, before printing the warning. Closes: #673518
2012-04-03Print errors while reading file list files on a new lineGuillem Jover1-1/+0
Closes: #552517
2012-04-03Move pkg_infodb_get_dir() and pkg_infodb_get_file() to infodb-format.cGuillem Jover1-41/+0
These functions have never belonged in the filesdb module, but were put there temporarily for convenience.
2012-04-03Rename pkgadmin*() to pkg_infodb_get_*()Guillem Jover1-8/+9
2012-04-03Change pkgadmindir() to initialize infodir itselfGuillem Jover1-9/+4
This will guarantee there's never a time a call site can get NULL from the function, and detangles it from the in-core filesdb initialization.
2012-04-01Use cmp() == 0 instead of !cmp()Guillem Jover1-1/+2
2012-03-31Rename file iterator variables to iterGuillem Jover1-23/+31
2012-03-31Rename iterfiles*() functions to files_db_iter_*()Guillem Jover1-3/+9
2012-03-30dpkg: Pass filenamenode to pkg_files_add_file() instead of string and flagsGuillem Jover1-4/+8
2012-03-30Fix coding-styleGuillem Jover1-6/+6
2012-03-19dpkg: Update on-disk database to use a multiarch compliant layoutGuillem Jover1-0/+4
The usage of the new layout is conditional to a prior database upgrade that should write a version number greater than 0 in <admindir>/info/format. The file is parsed when needed from pkg_infodb_get_format(). Based-on-patch-by: Raphaël Hertzog <hertzog@debian.org> Patch-sponsored-by: Linaro Limited Signed-off-by: Guillem Jover <guillem@debian.org>
2012-03-16dpkg: Compute and track hashes for newly unpacked fileGuillem Jover1-0/+2
This will be used for checksum generation at unpack time, and for shared file verification.
2012-02-03dpkg: Use pnaw_nonambig instead of pnaw_foreign on .list file open errorGuillem Jover1-1/+1
Regression introduced in commit 0b8652b226a7601dfd71471797d15168a7337242. Spotted-by: Raphaël Hertzog <hertzog@debian.org>
2012-02-01Change debug, progress and error output to use package specifiersGuillem Jover1-8/+10
Replace pkg->set->name with varbuf_add_pkgbin_name(), pkgbin_name() or pkg_name(). This only changes informative output, so no behaviour change should result from this. Based-on-patch-by: Raphaël Hertzog <hertzog@debian.org> Patch-sponsored-by: Linaro Limited Signed-off-by: Guillem Jover <guillem@debian.org>
2012-01-02Use the new atomic file API instead of ad-hoc codeGuillem Jover1-29/+10
[hertzog@debian.org: - Switch dselect method option file. ]
2011-12-05dpkg: Error out if a database .list file is not a regular fileRaphaël Hertzog1-0/+4
LP: #369898 Signed-off-by: Guillem Jover <guillem@debian.org>
2011-12-05dpkg: Initialize all clientdata members in ensure_package_clientdata()Raphaël Hertzog1-0/+1
Although all users of replacingfilesandsaid are previously calling clear_istobes() to make sure it's initialized, doing so when allocating clientdata is safer from an API point of view. Signed-off-by: Guillem Jover <guillem@debian.org>
2011-11-14Replace all pkg_db_count() calls with pkg_db_count_pkg()Raphaël Hertzog1-1/+1
Sponsored-by: Linaro Limited Signed-off-by: Guillem Jover <guillem@debian.org>
2011-10-30Switch pkgadminfile() to get an explicit pkgbin as argumentGuillem Jover1-7/+7
The code does not do anything yet with this new argument, but it will allow it to access the multiarch information, once the on-disk layout is changed.
2011-10-27Switch from pkginfo->name to pkginfo->set->nameGuillem Jover1-14/+23
Remove now unused struct pkginfo name member.
2011-10-13dpkg: Use statfs() to retrieve the infodb filesystem block sizeGuillem Jover1-5/+7
This fixes two related issues when the FIGETBSZ ioctl fails, it avoids a file descriptor leak because we can get the block size before the loop, and avoids a segfault when sorting the package array due to the cliendata possibly being NULL on some of the package entries because we can bail out before performing the actual sorting. We use the Linux specific statfs(2), because it does way less work than statvfs(3) and the surrounding code is already non-portable due to its dependency on FIEMAP. LP: #872734