summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2011-01-16Propagate --admindir to programs run from maintainer scriptsGuillem Jover5-13/+16
Always set DPKG_ADMINDIR from dpkg so that all subprocesses inherit the variable and there's no possible security risk from a user process setting the variable to write onto a user controlled area. As usual, the order in which the admindir value is overridden is the following: built-in default, environment variable and command line option. Closes: #97076 Suggested-by: Brendan O'Dea <bod@debian.org>
2011-01-16Use string literals instead of macros for environment variable namesGuillem Jover4-7/+7
The environment variable names are part of the exposed API, and as such would need a transition plan in case of name change. Inline the macro values to ease code reading.
2011-01-16dpkg: Change wanttoinstall() return type from int to boolGuillem Jover2-13/+13
2011-01-16dpkg: Fix wanttoinstall() to use the new version from pkg->availableGuillem Jover3-9/+7
The code was mixing usages of the argument ver, with printing from pkg->available.version, which is rather confusing. Just use the available and installed pkg members instead. This also will guarantee we'll never get a NULL version.
2011-01-16dpkg: Always say why in wanttoinstall()Guillem Jover3-30/+21
There's just one caller and it always requests to say why we are installing. So remove this unneeded logic.
2011-01-16Rename struct pkginfoperfile to struct pkgbinGuillem Jover5-6/+6
2011-01-16dpkg: Refactor package authentication into deb_verify()Guillem Jover1-24/+35
2011-01-16dpkg: Refactor reassembling a split package into deb_reassemble()Guillem Jover1-33/+48
2011-01-16Use m_asprintf() instead varbuf_printf() for one-off stringsGuillem Jover1-30/+28
When the string is only created once, used several times and then freed, there's no much point in using a varbuf instead of the simpler m_asprintf(). The former needs more state and makes using the string slightly more cumbersome. Using m_asprintf() should be slightly faster too, but not significantly enough to justify this change by itself.
2011-01-16Use m_asprintf() instead of building the strings piece by pieceGuillem Jover1-24/+14
This is way more compact, the strings are for temporary values, and the minimal possible performance difference does not matter here.
2011-01-16Use m_asprintf() instead of m_malloc() and string operationsGuillem Jover3-15/+7
This avoid the need to know the resulting string length beforehand, and makes sure it's always going to get the right size. It also makes the code way clearer.
2011-01-16libdpkg: Rename varbufprintf() to varbuf_printf()Guillem Jover3-54/+51
Make the varbuf API a bit more consistent.
2011-01-16libdpkg: Rename varbufaddbuf() to varbuf_add_buf()Guillem Jover3-3/+3
Make the varbuf API a bit more consistent.
2011-01-16libdpkg: Rename varbufaddstr() to varbuf_add_str()Guillem Jover14-80/+80
Make the varbuf API a bit more consistent.
2011-01-16libdpkg: Rename varbufaddc() to varbuf_add_char()Guillem Jover17-82/+87
Make the varbuf API a bit more consistent.
2011-01-16libdpkg: Rename varbufreset() to varbuf_reset()Guillem Jover16-36/+36
Make the varbuf API a bit more consistent.
2011-01-16libdpkg: Rename varbufinit() to varbuf_init()Guillem Jover1-1/+1
Make the varbuf API a bit more consistent.
2011-01-16Remove --enable-sync-sync codepathJonathan Nieder1-8/+0
Using sync() on unpack causes _all_ filesystems to be sync'd, which is not so great when one of those is a thumb drive, mounted over a network, or otherwise slow. Remove the sync-instead-of-fsync codepath due to those side-effects and to simplify maintenance. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Guillem Jover <guillem@debian.org>
2011-01-16dpkg: Fix -GEO options on multiple versions of the same packageGuillem Jover1-3/+3
The options were not taking effect as they were only being applied to installed packages, while the first stage usually implies unpacking and then configuring in a later stage. Which implies having those packages going from installed to unpacked, and then skipping any of the checks requested by the user on subsequently processed packages. Closes: #31141
2011-01-08Centralize warn counting in warningv()Guillem Jover2-3/+3
Add an accessor function to be able to replace the old warn counters in the rest of the code.
2011-01-08Use fdio instead of ad-hoc code to handle interrupted I/OGuillem Jover1-23/+6
2011-01-08Use fd_read() instead of fd_buf_copy()Guillem Jover2-5/+6
The latter is doing unneeded work. Switch to use a simpler but equally functional variant.
2011-01-08build: Refactor common linker objects into LDADDGuillem Jover1-23/+5
2011-01-08dpkg: Do not check for presence of update-rc.dGuillem Jover1-1/+0
It's not really needed for dpkg correct operation.
2011-01-08Clarify and simplify strings to help translatorsGuillem Jover1-6/+5
Closes: #604914 Suggested-by: Andrei Popescu <andreimpopescu@gmail.com> Signed-off-by: Guillem Jover <guillem@debian.org>
2011-01-08Make short strings unique by using gettext context supportGuillem Jover1-1/+2
Reported-by: Andrei Popescu <andreimpopescu@gmail.com>
2011-01-08Rename directory variables to just dirGuillem Jover1-7/+7
The shorter form is unambiguous and takes less screen size.
2011-01-08dpkg-query: Refactor --list header printing into list_format_print_header()Guillem Jover1-33/+42
2011-01-08dpkg-query: Refactor --list format creation into new list_format_init()Guillem Jover1-48/+72
2010-12-20Merge branch 'sid' (through tag '1.15.8.7')Guillem Jover2-2/+51
Conflicts: debian/changelog dselect/po/es.po po/es.po po/pt.po scripts/po/es.po src/archives.c
2010-12-10dpkg-query: Fix stanza delimiting on -L, -s and -p outputGuillem Jover1-1/+1
The code was only printing a delimiting new line on the second to last stanza. Invert the logic and do it always except on the last one. Closes: #606315
2010-12-10dpkg: On non-Linux use fadvise(FADV_DONTNEED) to initiate writebackGuillem Jover1-0/+2
Use the posix_fadvise(POSIX_FADV_DONTNEED) hint to notify the kernel dpkg does not need the unpacked files any longer and as such it can start writeback asynchronously. Although POSIX does not explicitly say so, and this is merely a hint, this is the only sensible thing to do for the kernel. On Linux at least it also evicts the pages if they are not currently under writeback, locked or dirty, which might be undesired if a maintainer script has to use the data, but unlikely as the writeback will still be ongoing if it started at all. In addition it could be argued the Linux implementation is not optimal as the standard talks about the application not needing the data any longer, not the system. So it seems the NetBSD implementation which just marks the pages as not active would be more correct.
2010-12-10dpkg: On Linux finish writeback before fsyncGuillem Jover1-0/+36
The second sync_file_range() call, with the operation SYNC_FILE_RANGE_WAIT_BEFORE, will block until the previously initiated writeback has completed. We finish the writeback for all files before calling fsync. This basically ensures that the delayed allocation has been resolved; that is, the data blocks have been allocated and written, and the inode updated (in memory), but not necessarily pushed out to disk. So that later fsync can become no-ops, minimizing the number of (costly) jbd2 commits. Suggested-by: Ted Ts'o <tytso@mit.edu> Based-on-patch-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Guillem Jover <guillem@debian.org>
2010-12-10dpkg: On Linux initiate writeback of unpacked files ASAPGuillem Jover1-0/+11
To avoid performance degradation on filesystems with "allocate on flush" semantics (like xfs, ubifs, hfs+, and ext4 without nodelalloc), start writing back each file once it has finished being extracted. This doesn't actually wait for the write to finish; it just starts the writeback. The sync_file_range() call has been available since Linux 2.6.17. On non-Linux systems we can skip it. Closes: #605009 Suggested-by: Ted Ts'o <tytso@mit.edu> Based-on-patch-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Guillem Jover <guillem@debian.org>
2010-12-10dpkg: Defer symlink renames to avoid ending up with broken symlinksGuillem Jover1-1/+1
The broken symlinks are particularly pernicious as they imply a shared library SONAME path might point to nowhere and thus applications will fail to get dynamically linked. Deferring symlinks is safe as they are always at the end of the tar archive, and they are processed last on deferred renames as they are appended at the end of the new list files. Closes: #605536
2010-11-25Merge branch 'sid' (through tag '1.15.8.6')Guillem Jover3-4/+10
Conflicts: debian/changelog m4/dpkg-funcs.m4 man/dpkg.1
2010-11-25Add new --force-unsafe-io to disable safe I/O operations on unpackGuillem Jover3-2/+8
This allows to not perform file system syncs before file renames to guarantee its atomicity, which is known to cause substantial performance degradation on some file systems, unfortunately the ones that require the safe I/O on the first place due to their unreliable behaviour causing zero-length files on abrupt system crashes (sudden reboot, bus locks, pulling the plug, etc). Using this option might improve performance at the cost of losing data, and should thus be used with care, but that's ultimately something for the user of the affected file systems to decide. Closes: #584254
2010-11-25build: Disable usage of synchronous sync(2) by defaultGuillem Jover1-2/+2
It causes undesired I/O on unrelated file systems. It also makes the code behave differently on Linux systems. Allow the possibility to enable it again for the benefit of downstreams, which might want to use it regardless of its problems. Although this code path will most probably be removed in the near future. Closes: #588339, #595927, #600075
2010-11-19dpkg: Add new --status-logger optionGuillem Jover1-1/+35
This option works in a similar way to --status-fd, the main difference is that we invoke the provided command and pass the status information to its standard input instead. Suggested-by: Raphaël Hertzog <hertzog@debian.org>
2010-11-19dpkg: Use command_shell() instead of ad-hoc code to execute shellsGuillem Jover1-18/+3
2010-11-19Refactor setpipe() into statusfd_add() to stop exposing status_pipesGuillem Jover1-9/+2
2010-11-19Use new enum for dependency found statusGuillem Jover1-30/+40
Instead of cryptic literal integers use named enums.
2010-11-19Use new enum for dependency check result valuesGuillem Jover2-23/+37
Instead of cryptic literal integers use named enums.
2010-11-19Use new enum for trigdef_update_start() return valuesGuillem Jover1-5/+5
Instead of cryptic literal integers use named enums.
2010-11-19libdpkg: Rename path_rtrim_slash_slashdot to path_trim_slash_slashdotGuillem Jover2-2/+2
2010-11-19Cleanup white spacesGuillem Jover21-138/+122
Remove trailing spaces. Remove blank lines not separating different code blocks. Remove blank lines at the end of the file.
2010-11-19Cleanup and improve source code commentsGuillem Jover16-529/+624
Global review, which includes the following changes to try to increase consistency, update and improve the source code comments: - Spelling fixes. - Use American English forms. - Uppercase NULL, NUL and ASCII. - Use “Note: ” instead of the slightly cryptic “NB: ” form. - Write comments as proper sentences, including capitalizations and ending dots. - Move comments before the code, function or variable they refer to. - Move general function comments outside the body. - Convert function and variable description comments to doxygen. - Use one space before dot, exclamation and question marks. - Use ‘’ or “” instead of `' style quoting. - Remove author names from comments, already visible from “git blame”. - Mark strings for translators with “TRANSLATORS: ”. - Remove useless or outdated comments. - Fix comment indentation. - Standardize comment format: /* Short text comment. */ /* Long text, * comment. */ /* * Section text. */
2010-11-19libdpkg: Always print parse warnings on stderrGuillem Jover2-3/+3
Remove now unused warnto from parsedb_stat struct.
2010-11-19Use new namevalue_find_by_name function instead of ad-hoc codeGuillem Jover1-2/+4
2010-11-19libdpkg: Rename package blank functions to pkg_blank and pkg_perfile_blankGuillem Jover3-3/+3