Improve error messages output by buffer_copy()
Those error messages are often seen by users and they are very difficult
to understand both because they are poorly written and because they
are badly translated. The translations are difficult to get right because
they are a combination of 2 separate strings.
To improve the situation, the messages coming from buffer_copy()
are shorter and do not mention the action ("buffer copy"), instead
we rely on the callers (fd_fd_copy(), fd_null_copy(), fd_vbuf_copy(),
fd_md5()) to provide more explanation on what they are trying to do.
It's important for callers to embed the eventual filenames in the error
message to make it actually useful.
A large number of strings have thus been updated. I also added
comments for the translators so that they are aware of how the strings
are combined.
Those error messages are often seen by users and they are very difficult
to understand both because they are poorly written and because they
are badly translated. The translations are difficult to get right because
they are a combination of 2 separate strings.
To improve the situation, the messages coming from buffer_copy()
are shorter and do not mention the action ("buffer copy"), instead
we rely on the callers (fd_fd_copy(), fd_null_copy(), fd_vbuf_copy(),
fd_md5()) to provide more explanation on what they are trying to do.
It's important for callers to embed the eventual filenames in the error
message to make it actually useful.
A large number of strings have thus been updated. I also added
comments for the translators so that they are aware of how the strings
are combined.
dpkg-query(1): improve description of --search
Merge branch 'sid' (through tag '1.16.0.1')
Conflicts:
debian/changelog
Conflicts:
debian/changelog
Release 1.16.0.1
dpkg: Rename set_selinux_path_context() to tarobject_set_se_context()
This puts it in line with the rest of tarobject filesystem metadata
setters.
This puts it in line with the rest of tarobject filesystem metadata
setters.
dpkg: don't ohshite if lutimes() fails with ENOSYS
Glibc implements lutimes() on top of utimensat() which is only provided
by Linux >= 2.6.22. With older kernels it returns ENOSYS.
This regression was introduced by commit
b3eb59cf43c286bb6c906c00ef1cdc0ec21f474d which implemented support for
setting timestamps of symlinks.
Reported-by: Michael Prokop <mika@debian.org>
Glibc implements lutimes() on top of utimensat() which is only provided
by Linux >= 2.6.22. With older kernels it returns ENOSYS.
This regression was introduced by commit
b3eb59cf43c286bb6c906c00ef1cdc0ec21f474d which implemented support for
setting timestamps of symlinks.
Reported-by: Michael Prokop <mika@debian.org>
dpkg: fix regression when using -R option
The regression was introduced in commit
280ac914cc52ee5de079c0833bb1df5005c1e7ab. The variable used for the loop
got incremented twice for each iteration, the net result is that the list
of filenames contains random data on half of the entries.
Reported-by: Craig Sanders <cas@taz.net.au>
The regression was introduced in commit
280ac914cc52ee5de079c0833bb1df5005c1e7ab. The variable used for the loop
got incremented twice for each iteration, the net result is that the list
of filenames contains random data on half of the entries.
Reported-by: Craig Sanders <cas@taz.net.au>
Update German scripts translation
Update to 515t
Update to 515t
Dpkg::Version: update version_check to forbid versions starting with non digits
Adapted the code to rely on the parsing done by the constructor to split
the version number properly instead of redoing similar regexes in
version_check().
Updated the test suite accordingly.
Adapted the code to rely on the parsing done by the constructor to split
the version number properly instead of redoing similar regexes in
version_check().
Updated the test suite accordingly.
libdpkg: add non-regression test for version number starting with non-digit
And update the non-regression test for invalid characters to put
the invalid character as the second character and not the first (which
would be caught by the more strict non-digit check).
And update the non-regression test for invalid characters to put
the invalid character as the second character and not the first (which
would be caught by the more strict non-digit check).
Dpkg::Source::Package: Add ‘.gitmodules’ to the default ignore lists
Closes: #620490
Closes: #620490
Install deb-src-control(5) man pages in dpkg-dev
Closes: #620520
Closes: #620520
Dpkg::Deps: some typo and consistency fixes in the POD documentation
Dpkg::Deps: Implement new "reset" method
Bump module version to 1.01 due to this.
Bump module version to 1.01 due to this.
Add new changelog entry for 1.16.1
Release 1.16.0
Correct and clarify changelog entries
Regenerate .pot files and merge .po files with them
dpkg-divert: Unlink the source file when moving across filesystems
Otherwise we might leave cruft behind.
Regression introduced in commit 02b12d75f1eff7c184fafb5a663a0421e9a645ea.
Otherwise we might leave cruft behind.
Regression introduced in commit 02b12d75f1eff7c184fafb5a663a0421e9a645ea.
dpkg-divert: Inline rename_mv() into file_rename()
dpkg-divert: Move atomic rename logic from rename_mv() to file_copy()
This makes file_copy() safe to use by itself, and will allow to pull it
out and use it in other places in the future.
This makes file_copy() safe to use by itself, and will allow to pull it
out and use it in other places in the future.
dpkg-divert: Change file_copy() and rename_mv() to ohshite() on error
This has several consequences, the code will not trigger leak detectors
like cppcheck due to ohshite() being marked non-returning, and the error
messages are going to be more descriptive.
Closes: #620380
This has several consequences, the code will not trigger leak detectors
like cppcheck due to ohshite() being marked non-returning, and the error
messages are going to be more descriptive.
Closes: #620380
Revert "dpkg-divert: fix minor file descriptor leak found by cppcheck"
This reverts commit bdcee319a90eee494af70e6725fed8b4e8f16584.
This reverts commit bdcee319a90eee494af70e6725fed8b4e8f16584.
dpkg-genchanges: Do not warn when adding files w/o matching architecture
Fix undefined value useage when adding files w/o a matching architecture,
because they are not present in debian/control, this is most commonly the
case due to dpkg-distaddfile.
Fix undefined value useage when adding files w/o a matching architecture,
because they are not present in debian/control, this is most commonly the
case due to dpkg-distaddfile.
libdpkg: Make buffer_init() and buffer_done() take only one argument
These functions only handle the output buffer_data and thus the
read_data argument will never get used.
These functions only handle the output buffer_data and thus the
read_data argument will never get used.
dpkg: Set the modification time for unpacked symlinks if possible
Use lutimes() conditionally as it might not be widely available.
Use lutimes() conditionally as it might not be widely available.
dpkg: Move lchown() call from tarobject() to tarobject_set_perms()
This unifies a bit more the tarobject permission handling into a single
place.
This unifies a bit more the tarobject permission handling into a single
place.
libdpkg: Move mtime from file_stat back to tar_info
There's never a reason to override the mtime, no point in carrying and
copying it around in file_stat for now.
There's never a reason to override the mtime, no point in carrying and
copying it around in file_stat for now.
dpkg: Use utimes(2) instead of obsolete utime(2)
POSIX.1-2008 marked utime(2) as obsolete. Ideally we'd switch to use
utimensat(2), which would simplify quite a bit the code, but it's not
yet widely available, and using it would imply having to support
fallback code at compilation and run-time. This can be done later on
once we up the POSIX baseline.
POSIX.1-2008 marked utime(2) as obsolete. Ideally we'd switch to use
utimensat(2), which would simplify quite a bit the code, but it's not
yet widely available, and using it would imply having to support
fallback code at compilation and run-time. This can be done later on
once we up the POSIX baseline.
dpkg: Move conditionals to tarobject_set_*() functions
This will allow to handle the different cases transparently. Pass a
tar_entry to each of the functions.
This will allow to handle the different cases transparently. Pass a
tar_entry to each of the functions.
dpkg: Rename newtarobject_allmodes() to tarobject_set_perms()
dpkg: Rename newtarobject_utime() to tarobject_set_mtime()
dpkg: Factor out newtarobject_allmodes() call
dpkg: Move newtarobject_utime() call out of newtarobject_allmodes()
Always call newtarobject_utime() for all tar object types, except
symlinks.
Always call newtarobject_utime() for all tar object types, except
symlinks.
dpkg: Fix typo in comment ‘cheched’ → ‘checked’
libdpkg: Update MD5 implementation with the one from OpenBSD
Add <config.h> and <compat.h> includes. Change <md5.h> include to
"md5.h". Change BYTE_ORDER check to WORDS_BIGENDIAN. Remove __bounded__
gcc attributes on function declarations. Remove file helper
declarations.
Add <config.h> and <compat.h> includes. Change <md5.h> include to
"md5.h". Change BYTE_ORDER check to WORDS_BIGENDIAN. Remove __bounded__
gcc attributes on function declarations. Remove file helper
declarations.
Rename struct cmdinfo member arg_func to action and call it directly
This avoids a temporary variable, given that now the function is
strongly prototyped.
This avoids a temporary variable, given that now the function is
strongly prototyped.
Use new action_func typedef instead of ad-hoc function casts
Make all command line action functions return int
This will allow using type-safe function pointers instead of casting
them around. Replace all exit(3) calls with return statements. Remove
DPKG_ATTR_NORET from function declarations, all functions are expected
to return now.
This will allow using type-safe function pointers instead of casting
them around. Replace all exit(3) calls with return statements. Remove
DPKG_ATTR_NORET from function declarations, all functions are expected
to return now.
dpkg: Pass default return value to reportbroken_retexitstatus()
This will allow to pass arbitrary values from the command actions when
there's not been any reported error.
This will allow to pass arbitrary values from the command actions when
there's not been any reported error.
dpkg-source: temporarily drop Package-List field generation
That way we can discuss it further until there's consensus on its design
and upload 1.16.0 immediately.
That way we can discuss it further until there's consensus on its design
and upload 1.16.0 immediately.
dpkg-divert: fix minor file descriptor leak found by cppcheck
Reported-by: Niels Thykier <niels@thykier.net>
Reported-by: Niels Thykier <niels@thykier.net>
dpkg-source: extend the Package-List field based on the feedback received
Integrate the architecture field with spaces replaced by commas. It will
be used by the wanna-build team to see if the source package builds
Architecture: all packages. The reprepro maintainer also had a similar
use case for this information.
Put the type of the package in a dedicated field rather than a prefix of
the package name. Suggested by Bastian Blank.
See feedback at
http://lists.debian.org/debian-policy/2011/03/threads.html#00155
Integrate the architecture field with spaces replaced by commas. It will
be used by the wanna-build team to see if the source package builds
Architecture: all packages. The reprepro maintainer also had a similar
use case for this information.
Put the type of the package in a dedicated field rather than a prefix of
the package name. Suggested by Bastian Blank.
See feedback at
http://lists.debian.org/debian-policy/2011/03/threads.html#00155
Dpkg::Source::Patch: don't choke on empty patches
Commit 255e73e11d1365fbb1e8d78287fad751a8ebc6e5 introduced a regression
with empty patches by assuming that a patch analysis would always give
back at least one filename.
Reported-by: Niels Thykier <niels@thykier.net>
Commit 255e73e11d1365fbb1e8d78287fad751a8ebc6e5 introduced a regression
with empty patches by assuming that a patch analysis would always give
back at least one filename.
Reported-by: Niels Thykier <niels@thykier.net>
Dpkg::Changelog::Debian::Entry: ignore whitespaces after options in header
dpkg-source: strip spaces around newlines in Uploaders
dpkg(1): remove a duplicate word in the german translation
Concerns the explanation of --get-selections.
Concerns the explanation of --get-selections.
Fix two typos in changelog
dpkg-source: add new Package-List field to .dsc files
This field has been requested by ftpmasters so that they can install
overrides for all binary packages as soon as they have approved
the source package. It contains a the list of packages that the source
can build along with their sections and priorities.
It looks like this:
Package-List:
src:foo admin optional
foo admin optional
foo-common admin optional
udeb:foo-udeb debian-installer extra
This field has been requested by ftpmasters so that they can install
overrides for all binary packages as soon as they have approved
the source package. It contains a the list of packages that the source
can build along with their sections and priorities.
It looks like this:
Package-List:
src:foo admin optional
foo admin optional
foo-common admin optional
udeb:foo-udeb debian-installer extra
Dpkg::Control::Fields: define the place of the Built-Using field
Commit a8cb927edb7dbd67c7a6084685998818b811caec forgot to add the
Built-Using field in %FIELD_ORDER.
Commit a8cb927edb7dbd67c7a6084685998818b811caec forgot to add the
Built-Using field in %FIELD_ORDER.
Update German translation of manual pages
Update to 2010t.
Update to 2010t.
dpkg-gencontrol: add support for Built-Using field
And teach dpkg-deb to not complain about it.
Signed-off-by: Raphaël Hertzog <hertzog@debian.org>
And teach dpkg-deb to not complain about it.
Signed-off-by: Raphaël Hertzog <hertzog@debian.org>
dpkg: use the correct mtime when installing a file with statoverrides
Regression introduced by commit ceb07b08dad4d5eead630064f45c7e7ded00a341.
Reported-by: Marc A. Donges
Regression introduced by commit ceb07b08dad4d5eead630064f45c7e7ded00a341.
Reported-by: Marc A. Donges
Fix minor error in German dpkg translation
dpkg-divert: fix return value of rename_mv
This is a regression introduced by the C rewrite of dpkg-divert
(commit 02b12d75f1eff7c184fafb5a663a0421e9a645ea) that made it unable to
rename files when that rename implies a copy on another file system.
The code has provision to do a copy when a simple rename is not enough
but the associated function erroneously returned a failure value when
that operation was performed.
Reported-by: Durk Strooisma
This is a regression introduced by the C rewrite of dpkg-divert
(commit 02b12d75f1eff7c184fafb5a663a0421e9a645ea) that made it unable to
rename files when that rename implies a copy on another file system.
The code has provision to do a copy when a simple rename is not enough
but the associated function erroneously returned a failure value when
that operation was performed.
Reported-by: Durk Strooisma
pkg_parse_copy(): fix references to variables in a comment
The comment still used the old names of variables from before the code had
been factored in a separate function (in commit
58df02f9d39c1e7b1c7f49026a649f125b87140d).
The comment still used the old names of variables from before the code had
been factored in a separate function (in commit
58df02f9d39c1e7b1c7f49026a649f125b87140d).
libdpkg: Do not lose reverse dependencies when parsing control data
Regression introduced in commit 58df02f9d39c1e7b1c7f49026a649f125b87140d.
Regression introduced in commit 58df02f9d39c1e7b1c7f49026a649f125b87140d.
Update German translation of manual pages
Update to 2008t0f0u.
Update to 2008t0f0u.
Add armhf support to ostable and triplettable
Closes: #594179
Closes: #594179
dpkg-split: fix a gcc warning
The refactoring made in commit 86cbf575b13d049504402f72d221fa1538c2e53b
was supposed to add the cast for the argument matching
the %jx specifier (and not %s).
The refactoring made in commit 86cbf575b13d049504402f72d221fa1538c2e53b
was supposed to add the cast for the argument matching
the %jx specifier (and not %s).
German dpkg translation update
Update to 1020t.
Update to 1020t.
build: Update po/POTFILES.in for new/renamed source files
lib/dpkg/dir.c (commit 20fdb395cc721a5060c5623eda956d73ea840a21)
src/infodb.c (commit 9f7f2a958321d41725c0ae7f46c434fe4cbf3c6a)
lib/dpkg/database.c → lib/dpkg/pkg-db.c (commit
ced5ec027285de3f207c0bb7a26e3455503e7e29)
lib/dpkg/dir.c (commit 20fdb395cc721a5060c5623eda956d73ea840a21)
src/infodb.c (commit 9f7f2a958321d41725c0ae7f46c434fe4cbf3c6a)
lib/dpkg/database.c → lib/dpkg/pkg-db.c (commit
ced5ec027285de3f207c0bb7a26e3455503e7e29)
dpkg-split: Fix typo
Use off_t and %jd or %jx to handle file sizes and offsets
This allows to support large files on 32-bit systems were a ‘long int’
type might not be of at least 64-bits. For printing %jd or %jx is used,
and the value is cast to intmax_t.
This allows to support large files on 32-bit systems were a ‘long int’
type might not be of at least 64-bits. For printing %jd or %jx is used,
and the value is cast to intmax_t.
Use size_t and %zu to handle memory sizes and offsets
libdpkg: Replace OtoL() with OtoM() converting to intmax_t
This allows storing at least 64-bit integers on 32-bit systems, and thus
large file support.
This allows storing at least 64-bit integers on 32-bit systems, and thus
large file support.
dpkg-split: Make decompose_filename() and setpartsize() use strtoimax()
This will allow parsing large numbers, required for large file support.
This will allow parsing large numbers, required for large file support.
dpkg-split: Replace unsignedlong() with parse_intmax()
build: Check for %j and %z format modifiers support
We use those to create binary output, so we require them to be working.
We use those to create binary output, so we require them to be working.
dpkg-split: Use a constant expression to declare an array
Although usually the compiler should replace strlen(literal) with a
built-in, it might not, and it's more predictable to use a constant
expression using sizeof() instead to avoid making it a variable
length array. This fixes a warning with latest gcc and -Wvla.
Although usually the compiler should replace strlen(literal) with a
built-in, it might not, and it's more predictable to use a constant
expression using sizeof() instead to avoid making it a variable
length array. This fixes a warning with latest gcc and -Wvla.
Inline rerr() into its only current call site
Inline werr() into its only current call site
dpkg-deb: Use fdio instead of stdio
Prefer fdio for binary data.
Prefer fdio for binary data.
dpkg-split: Do not slurp into memory the whole package parts
Use buffered I/O when reassembling split packages. This will make
possible to handle parts > 2 GiB on 32 bit systems.
Use buffered I/O when reassembling split packages. This will make
possible to handle parts > 2 GiB on 32 bit systems.
libdpkg: Add missing <errno.h> needed by fd_null_copy()
u-a: Do not unneedingly initialize variables to NULL
Those get initialized unconditionally later on in the code.
This was spotted by a run with the clang static analyzer.
Those get initialized unconditionally later on in the code.
This was spotted by a run with the clang static analyzer.
dpkg-query: Return a valid width even if opening /dev/tty failed
This was spotted by a run with the clang static analyzer.
This was spotted by a run with the clang static analyzer.
build: Add -Wformat-security and -Wpointer-arith to default warnings
dselect: Use a format string in printf() instead of only a variable
This fixes a warning with -Wformat-security.
This fixes a warning with -Wformat-security.
dpkg: Add comment about why writeback code ignores return values
Suggested-by: Sven Mueller <sven@debian.org>
Suggested-by: Sven Mueller <sven@debian.org>
Move pkgadmindir() and pkgadminfile() to the filesdb module
These functions are not really part of the modstatdb module, and by
moving them out they get detangled and will make it possible to extend
them w/o pulling additional code into binaries not using the functions.
These functions are not really part of the modstatdb module, and by
moving them out they get detangled and will make it possible to extend
them w/o pulling additional code into binaries not using the functions.
Make admindir file local everywhere
The interface to get and set the database directory is dpkg_db_get_dir()
and dpkg_db_set_dir().
The interface to get and set the database directory is dpkg_db_get_dir()
and dpkg_db_set_dir().
Do not pass admindir to database initialization functions
Use dpkg_db_get_dir() and dpkg_db_get_path() to globally retrieve the
database directory instead of passing it around.
Use dpkg_db_get_dir() and dpkg_db_get_path() to globally retrieve the
database directory instead of passing it around.
libdpkg: Use dpkg_db_get_path() instead of trig_get_triggersdir()
Remove now unused trig_get_triggersdir().
Remove now unused trig_get_triggersdir().
Use dpkg_db_set_dir() instead of pkgadmindir_init()
Remove now unused pkgadmindir_init().
Remove now unused pkgadmindir_init().
Use dpkg_db_get_path() instead of using m_asprintf() and admindir
Use dpkg_db_get_path() instead of ad-hoc building the string with varbuf
libdpkg: Add new dbdir module
dselect: Use modstatdb_can_lock() in refreshmenu() instead of ad-hoc code
libdpkg: Refactor modstatdb_can_lock() out from modstatdb_lock()
libdpkg: Handle EACCES as a permission error in modstatdb_lock()
The current code only considers EPERM, but EACCES is also a valid error
concerning permission issues from open(2).
The current code only considers EPERM, but EACCES is also a valid error
concerning permission issues from open(2).
libdpkg: Reset dblockfd on modstatdb_unlock()
This will allow locking again the database after having previously
unlocked it.
This will allow locking again the database after having previously
unlocked it.
Make modstatdb locking functions not take an admindir argument
Initialize the lockfile on modstatdb_init() via the fnis array. Make
sure we call modstatdb_init() and modstatdb_done() in case we are not
calling modstatdb_open() and modstatdb_shutdown().
Initialize the lockfile on modstatdb_init() via the fnis array. Make
sure we call modstatdb_init() and modstatdb_done() in case we are not
calling modstatdb_open() and modstatdb_shutdown().
libdpkg: Refactor modstatdb init/done sequence into new functions
Move variable path initialization and destruction code to the new
modstatdb_init() and modstatdb_done(). Add a boolean variable to protect
the funtions from reiterated calls.
Move variable path initialization and destruction code to the new
modstatdb_init() and modstatdb_done(). Add a boolean variable to protect
the funtions from reiterated calls.
libdpkg: Rename modstatdb_init() to modstatdb_open()
We'll need to reuse the modstatdb_init() function name for further
refactoring.
We'll need to reuse the modstatdb_init() function name for further
refactoring.
libdpkg: Rename database module to pkg-db
This matches the namespace for the provided functions, and disambiguates
what kind of database it's refering to.
This matches the namespace for the provided functions, and disambiguates
what kind of database it's refering to.
libdpkg: Rename hashreport() to pkg_db_report()
libdpkg: Move non pkg_db related functions to the pkg module
The pkgbin_blank, pkg_blank and pkg_is_informative are not strictly
part of the pkg_db module, and can be used w/o the latter.
The pkgbin_blank, pkg_blank and pkg_is_informative are not strictly
part of the pkg_db module, and can be used w/o the latter.
libdpkg: Move blankversion() to new version module
libdpkg: Change file_unlock() to act directly on its new arguments
This switches the function from unlocking the file via the popped
cleanup to do the action itself.
This switches the function from unlocking the file via the popped
cleanup to do the action itself.
