summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2010-03-05dpkg: Use posix_fadvise on non-Linux to speed up .list files loadingStefan Fritsch1-0/+22
When FIEMAP is not available try to use posix_fadvise() to request the preloading of the .list files. A search with dpkg-query went from 28 to 17 seconds, giving around 40% improvement. Closes: #557560 Signed-off-by: Guillem Jover <guillem@debian.org>
2010-03-05dpkg: Use FIEMAP to sort .list files before scanningMorten Hustveit2-4/+90
When running dpkg from a cold cache on a system where <admindir>/info/ lies on a hard disk, a lot of time is spent waiting for seeks between (typically) thousands of files. This patch changes the behavior of ensure_allinstfiles_available(), so that it accesses the packages in the order of their .list files' physical locations on the hard disk, greatly reducing drive head movements. The performance improvement is around 70% on my system: reinstalling a simple package takes 8 seconds instead of 27 seconds. The caches were dropped before each run, and 10 runs were done with consistent results. The performance is identical to the previous patch using FIBMAP, althought this one has the advantage of not needing root privileges. Signed-off-by: Guillem Jover <guillem@debian.org>
2010-03-05dpkg: Switch SE Linux support to explicitly set path contextsGuillem Jover1-60/+41
The current code sets the default context and does not clean it on conffile extraction or in case of unpack error, which causes the wrong context to be applied to files under <admindir>. Switch the code to explicitly set the path context for newly extracted and created files so that we don't need to care about unpack error recovery or conffile extraction to restore the default context. Refactor the code into a new function and remove an unneeded setting of the context just before the rename from <node>.dpkg-new to <node>. Closes: #498438
2010-03-05Use while () instead for () when using package iteratorsGuillem Jover2-4/+5
The code looks more balanced this way.
2010-03-05Release the package iterators when doneGuillem Jover1-0/+2
This is a cause of memory leaks, but in these cases the program is about to exit anyway, so we do it for correctness.
2010-03-05libdpkg: Add new trig_override_hooks to avoid exposing trighGuillem Jover1-1/+1
Make trigh static and create an overrider function for it.
2010-03-05libdpkg: Add new trigdef_update_printf to avoid exposing trig_new_deferredGuillem Jover1-5/+4
Make trig_new_deferred static and create a printer function for it.
2010-03-05libdpkg: Add new trigdef_set_methods to avoid exposing trigdefGuillem Jover1-1/+2
Make trigdef static and create a setter function for it.
2010-03-05libdpkg: Rename database lock functions to use modstatdb_ prefixGuillem Jover1-2/+2
Remove now redudant database suffix from the function names.
2010-02-25Securely remove newly installed files when rolling-back a failed unpackGuillem Jover1-1/+2
When an error occurs during unpack the code is not securely removing the newly installed files that might be still laying around, which gives attackers a small window were they could hard link a file with set id bits. This situation is pretty contrived as the attacked would need to control the failing of the package during unpack.
2010-02-25Remove --license and --licence options from toolsGuillem Jover4-32/+5
The options are pretty useless and non-standard. The user can surely cat a file from the installed package. In addition this option has not worked ever on non-Debian systems as it's relying on the GPL-2 file from the base-files Debian package. So remove it, and we get some code reduction as a nice side-effect.
2010-02-25Use mkdtemp and path_make_temp_template instead of tempnam and tmpnamGuillem Jover1-9/+15
Those two functions are deprecated, produce warnings at link time, and should not be used as they are cause of possible race conditions. As a side effect we don't need to ensure the path is not existing as mkdtemp has done that for us, which slightly simplifies the code.
2010-02-25dpkg: Switch code to use “struct pkg_queue” instead of “struct pkgqueue”Guillem Jover3-57/+14
The semantics of the pkq-queue module are more clear, so it makes the code slightly easier to handle.
2010-02-25build: Move <admindir>/alternatives directory creation to scripts/Guillem Jover1-1/+0
Put it close to the other alternatives file and directory handling.
2010-02-25dpkg: Set interesting environment variables on conffile shell spawnGuillem Jover1-2/+10
Set DPKG_SHELL_REASON, DPKG_CONFFILE_OLD and DPKG_CONFFILE_NEW environment variables when spawning a shell for conffile examination, so that the user can easily use them for scripting, or as easy mnemonics. Suggested-by: Daniel Martin <Daniel.Martin@jhu.edu> Closes: #60329
2010-02-25dpkg: Always spawn a new shell on conffile promptGuillem Jover1-31/+19
Stop supporting self backgrounding, remove DPKG_NO_TSTP environment variable support, as we always spawn a shell now. This will allow setting useful environment variables for the user to use with other tools. And is less confusing, as the action to go back to dpkg does not depend on how dpkg was run. Closes: #38334
2010-02-25libdpkg: Unify and namespace pkg-format functions and typesGuillem Jover1-4/+4
Renames: struct lstitem → struct pkg_format_node itemtype_t → enum pkg_format_type alloclstitem() → pkg_format_node_new() parseformat() → pkg_format_parse() freeformat() → pkg_format_free() show1package() → pkg_format_show()
2010-02-25libdpkg: Move package formatting support to a new pkg-format moduleGuillem Jover1-0/+1
Move declarations from dpkg-db.h to a new pkg-format.h, and rename showpkg.c to pkg-format.c.
2010-02-22Enhance dpkg's error message about programs missing from the PATHRaphaël Hertzog1-3/+4
Triggered by https://bugs.maemo.org/show_bug.cgi?id=4103
2010-02-19Fix dpkg-query and dpkg-trigger to actually print a version on --versionGuillem Jover2-2/+4
2010-02-19dpkg: Fix unaligned bullet point on a commentGuillem Jover1-1/+1
This was making it confusing related to the parent bullets.
2010-02-19dpkg: Reduce scope of status variable to avoid shadowing another oneGuillem Jover1-1/+3
2010-02-19dpkg: Include main.h to get the limiteddescription prototypeGuillem Jover1-0/+2
2010-02-19dpkg: Make pkg_files_add_file() staticGuillem Jover1-1/+1
2010-02-19dpkg: Do not print unambiguous epoch on dpkg file overwrite errorGuillem Jover1-2/+2
2010-02-19Mark several functions with DPKG_ATTR_NORETGuillem Jover4-8/+8
2010-01-28Use new command module instead of ad-hoc codeGuillem Jover3-125/+88
2010-01-28dpkg: Use a literal string for the archive file patternGuillem Jover1-1/+1
Remove now unused macro.
2010-01-28dpkg: Remove scriptname argument from do_script()Guillem Jover1-8/+5
2010-01-28dpkg: Move exec error string from do_script argument to ohshite callGuillem Jover1-6/+6
2010-01-28libdpkg: Add and use new DPKG_ATTR_SENTINELGuillem Jover1-3/+4
2010-01-28libdpkg: Rename varbuffree to varbuf_destroyGuillem Jover10-27/+27
The convention is for functions named free to deallocate the contents and the given pointer, while this one only deallocates the contents, so we rename it to make this distinction clear.
2010-01-28libdpkg: Rename pkg_array_free to pkg_array_destroyGuillem Jover2-3/+3
The convention is for functions named _free to deallocate the contents and the given pointer, while this one only deallocates the contents, so we rename it to make this distinction clear.
2010-01-28Do not include unneeded <signal.h>Guillem Jover4-4/+0
2010-01-01libdpkg: Rename struct TarFunctions and membersGuillem Jover1-7/+7
Use lower case names, and name members closer to the Unix functions doing the same actions.
2010-01-01Use pid_t instead of intGuillem Jover1-2/+2
2010-01-01dpkg: Give meaningful names to variables taking environment valuesGuillem Jover1-18/+21
2009-12-31libdpkg: Rename m_fork to subproc_forkGuillem Jover4-9/+10
Also namespace cleanup function to subproc_fork_cleanup.
2009-12-31Use a for instead of a while loop in checkpath path splittingGuillem Jover1-5/+1
2009-12-31libcompat: Define lchown as chown if the former is not availableGuillem Jover1-12/+0
Instead of duplicating the code with chown calls when lchown is not available, just map it with a macros.
2009-12-31Use stat instead of access to check for file existenceGuillem Jover1-1/+3
2009-12-31Remove unneeded static modifier from function variablesGuillem Jover3-4/+4
The cleanup functions do not need a static variable when it's a pointer and we pass its value to it.
2009-12-31Remove linkage against unused librariesGuillem Jover1-2/+0
Do not link against selinux on dpkg-deb, and do not link against the compression libraries on dpkg.
2009-12-22Make show1package() take a struct pkginfoperfileGuillem Jover1-2/+2
Instead of hardcoding the usage of the pkginfo installed member, pass it as an argument of a pointer to a struct pkginfoperfile, so that we can choose what to show.
2009-12-22Move color member from struct pkginfo to struct perpackagestateGuillem Jover3-4/+12
The only user of this field is in the dependency cycle detection, only found under src/. So move it there where it belongs.
2009-12-10dpkg-query: Do not allow more than two arguments for --control-pathGuillem Jover1-2/+4
The last increment to argv was not being used, but instead the increment, make it useful by checking if there's any additional argument after the second, and bail out in that case. This was spotted by a run with the clang static analyzer.
2009-12-10dpkg: Check safe_read return codeGuillem Jover1-2/+5
The safe_read function protects against interruptions and partial reads, but not against other types of errors, for which we need to check the return value. This was spotted by a run with the clang static analyzer.
2009-12-10dpkg: Remove duplicate oldargs variableGuillem Jover1-3/+2
Initialize newargs to NULL now that oldargs is not there for the initial value. This was spotted by a run with the clang static analyzer.
2009-12-10Do not increment variables when the value is not going to be usedGuillem Jover1-1/+1
This was spotted by a run with the clang static analyzer.
2009-12-10Do not assign to variables when they subsequently get overwrittenGuillem Jover2-2/+2
This was spotted by a run with the clang static analyzer.