The following commit has been merged in the master branch:
commit 694b4b5aded077b43abd4e0cf5a81c7040899a24
Merge: eedb20c17071efd92112edf60f74f9f637b4aaed
5f52c08852c672e48ca67ccddb17c83c8d1f9fe8
Author: Guillem Jover <[email protected]>
Date: Mon Jan 31 06:33:01 2011 +0100
Merge branch 'squeeze' (through tag '1.15.8.10')
Conflicts:
debian/changelog
diff --combined debian/changelog
index 78d7a90,02e679a..9d0cf03
--- a/debian/changelog
+++ b/debian/changelog
@@@ -1,68 -1,10 +1,75 @@@
+dpkg (1.16.0) UNRELEASED; urgency=low
+
+ [ Guillem Jover ]
+ * Fix realloc usage on compat scandir() implementation.
+ * Use DPKG_MAINTSCRIPT_PACKAGE environment variable as package name on
+ dpkg-divert when no --package or --local options have been specified.
+ * Do not allow versions starting with non-digit when doing strict parsing,
+ warn otherwise.
+ * Update dpkg(1) to note that --status-fd output does not contain newlines
+ in error messages anymore (this was fixed in 1.15.0).
+ * Add a new --status-logger option to dpkg, similar to --status-fd but
+ instead invoke the command ourselves and feed the status information
+ to its standard input. Suggested by Raphaël Hertzog.
+ * Add missing space in update-alternative --set-selections output.
+ * Add missing options to update-alternative --help output.
+ * Count “conffile name is duplicated” for dpkg-deb warning count summary.
+ * Improve and clarify strings for translation. Closes: #604914
+ * Prefix all fatal error messages with “error: ”.
+ * Do not check presence of update-rc.d in the PATH in dpkg, as it's not
+ a program needed for dpkg correct operation.
+ * Fix dpkg -GEO options on multiple versions of the same packages.
+ Closes: #31141
+ * Propagate --admindir to programs run from maintainer scritpts.
+ Closes: #97076
+ * Do not fail when trying to remove the root directory. This will only
+ happen either on distributions where dpkg is a foreign package manager,
+ or on artificial dpkg databases.
+
+ [ Raphaël Hertzog ]
+ * Fail properly when debian/source/format is empty. Closes: #600854
+ * Add new deb-src-control(5) manual page documenting the debian/control
+ file contained in source packages.
+ - it documents the X[SBC]- prefix. Closes: #476335
+ - it documents the VCS-* fields too. Closes: #483119
+ Thanks to Oxan van Leeuwen <[email protected]> who wrote it
+ as part of the Google Code In program.
+ * Enhance dpkg-shlibdeps to not fail immediatly when a library is not found.
+ Instead continue and fail after all problems have been reported. Thanks
+ to Chris Baines <[email protected]> for the patch. Closes: #596841
+ * Fix dpkg-source to not list Debian packaging files as modified
+ upstream files in Format "1.0" when unpacking to a non-standard
+ directory.
+
+ [ Jonathan Nieder ]
+ * Remove support for use of synchronous sync(2), due to its pernicious
+ side-effects and to ease maintenance.
+
+ [ Updated programs translations ]
+ * Portuguese (Miguel Figueiredo).
+ * Spanish (Javier Fernandez-Sanguino).
+ * Swedish (Peter Krefting).
+
+ [ Updated man page translations ]
+ * German (Helge Kreutzmann).
+ * Swedish (Peter Krefting).
+
+ [ Updated scripts translations ]
+ * German (Helge Kreutzmann).
+ * Swedish (Peter Krefting).
+
+ [ Updated dselect translations ]
+ * Spanish (Javier Fernandez-Sanguino).
+
+ -- Guillem Jover <[email protected]> Thu, 29 Jul 2010 11:00:22 +0200
+
+ dpkg (1.15.8.10) unstable; urgency=low
+
+ * Do not segfault on “update-alternatives --auto” when the link group only
+ has alternatives which are dangling symlinks. Closes: #611545
+
+ -- Guillem Jover <[email protected]> Sun, 30 Jan 2011 20:28:27 +0100
+
dpkg (1.15.8.9) unstable; urgency=low
[ Raphaël Hertzog ]
@@@ -260,7 -202,7 +267,7 @@@ dpkg (1.15.8.4) unstable; urgency=lo
[ Guillem Jover ]
* Fix use after free segfault on update-alternatives --remove-all.
Closes: #591653, #591654
- * Always print a massage on warning when parsing control files.
+ * Always print a message on warning when parsing control files.
* On database parsing only warn on bogus versions previously accepted,
the other instances will keep producing errors, to avoid newly
introduced bogosity. Closes: #590885, #590896, #591692, #591885
@@@ -522,7 -464,7 +529,7 @@@ dpkg (1.15.7) unstable; urgency=lo
returns new files added after the opendir() call, btrfs in particular
triggered the problematic behaviour. Closes: #575891
* Tigthen the regex used by dpkg-source to match the component name of
- supplementary tarballs so that undercore (_) are not allowed as it was
+ supplementary tarballs so that underscore (_) are not allowed as it was
supposed to be.
* Introduce a new script called dpkg-buildflags: its purpose is to retrieve
compilation flags and it should be used within debian/rules to pass
@@@ -534,7 -476,7 +541,7 @@@
* Modify dselect to treat all unknown package as known and marked for purge.
This is a temporary work-around so that dselect doesn't try to reinstall
packages of priority > standard that were removed or not installed. Thanks
- to Robert Luderda for the patch. Closes: #559519, #556889
+ to Robert Luberda for the patch. Closes: #559519, #556889
* dpkg now exports DPKG_MAINTSCRIPT_NAME to maintainer scripts with the
type of maintainer script currently running (preinst, postinst, prerm,
postrm). Closes: #546577
@@@ -742,9 -684,9 +749,9 @@@ dpkg (1.15.6) experimental; urgency=lo
variables when spawning a shell for conffile examination. Closes: #60329
Thanks to Daniel Martin <[email protected]> for the idea.
* Add support for disabling update-alternatives at configure time using
- --withouth-update-alternatives.
+ --without-update-alternatives.
* Add support for disabling install-info at configure time using
- --withouth-install-info.
+ --without-install-info.
* Update debian/copyright.
* Use Debian instead of ‘Debian GNU/Linux’ when referring to the
distribution.
@@@ -784,7 -726,7 +791,7 @@@
* When FIEMAP is not available use posix_fadvise() to start preloading the
.list files before loading them. With a cold cache it improves up to 40%.
Thanks to Stefan Fritsch <[email protected]>. Closes: #557560
- * Call fsync(2) after writting files on disk, to get the atomicity
+ * Call fsync(2) after writing files on disk, to get the atomicity
guarantees when doing rename(2). Based on a patch by
Jean-Baptiste Lallement <[email protected]>.
Closes: #430958
@@@ -949,7 -891,7 +956,7 @@@ dpkg (1.15.5.2) unstable; urgency=lo
dpkg (1.15.5.1) unstable; urgency=low
- * Fix build failures due to off_t type missmatch caused by not including
+ * Fix build failures due to off_t type mismatch caused by not including
<config.h> first on the unit tests. Suggested by Pierre Habouzit and
Julien Cristau, thanks!
@@@ -1120,7 -1062,7 +1127,7 @@@ dpkg (1.15.4) unstable; urgency=lo
package. Closes: #540019
* Remove double slash in database path visible to the user in some error
conditions.
- * Stop macthing sparc64-*-* GNU triplets with sparc Debian architecture.
+ * Stop matching sparc64-*-* GNU triplets with sparc Debian architecture.
* Add support for config.d style directories in dpkg and dselect,
(/etc/dpkg/dpkg.cfg.d and /etc/dpkg/dselect.cfg.d respectively).
* Define DPKG_MAINTSCRIPT_ARCH on the maintainer script environment to the
@@@ -1129,7 -1071,7 +1136,7 @@@
in dpkg man page.
* Document DPKG_RUNNING_VERSION maintainer script environment variable
in dpkg man page.
- * Change po4a usage to not create unwated changes depending if doing out or
+ * Change po4a usage to not create unwanted changes depending if doing out or
in-tree builds.
* Use po4a “--previous” support when updating the man pages.
Suggested by Christian Perrier <[email protected]>.
@@@ -1168,7 -1110,7 +1175,7 @@@
* Create /etc/cron.daily/dpkg to handle the backup of
/var/lib/dpkg/status in /var/backups. This is taken out of the cron
package and need no conflicts/breaks as the code does nothing if
- the current status file is already backupped. Thanks to Leo 'costela'
+ the current status file is already backuped. Thanks to Leo 'costela'
Antunes <[email protected]> for the patch. Closes: #541412
* Change behaviour of dpkg --merge-avail to not update a package's
information if the version provided is older than the one already listed
@@@ -1188,7 -1130,7 +1195,7 @@@
Jiří Paleček <[email protected]> for the patch.
* Slightly improve dpkg-source(1) by giving the section name that we're
referring to. Closes: #544037
- * Fix translation error in german manpage of dpkg-buildpackage. Thanks
+ * Fix translation error in German manpage of dpkg-buildpackage. Thanks
to Joachim Breitner <[email protected]>. Closes: #541829
[ Modestas Vainius ]
@@@ -1251,7 -1193,7 +1258,7 @@@ dpkg (1.15.3) unstable; urgency=lo
by switching it to automatic mode. Closes: #529999
* Add missing paragraph separator in dpkg-buildpackage(1). Thanks to Per
Andersson <[email protected]>. Closes: #532769
- * Fix english mistake (“as you request” → “as you requested”) in several
+ * Fix English mistake (“as you request” → “as you requested”) in several
places. Thanks to David Stansby for the patch. Closes: #533171
* Support tags before symbols in symbols file contained in source packages.
The first two tags are "optional" (use it to not fail if the symbol might
@@@ -1306,7 -1248,7 +1313,7 @@@
dpkg (1.15.2) unstable; urgency=low
[ Guillem Jover ]
- * Fix FTBFS on GNU/Hurd due to a missmatched define usage in
+ * Fix FTBFS on GNU/Hurd due to a mismatched define usage in
start-stop-daemon. Closes: #530446
* Remove obsolete priorities support from dselect.
Thanks to Sven Joachim <[email protected]>.
@@@ -1420,7 -1362,7 +1427,7 @@@ dpkg (1.15.1) unstable; urgency=lo
Closes: #475916
* Improves how dpkg-parsechangelog handles non-existing versions
in its --since, --until, --to, --from options. Approximate the intent
- by selectioning the nearest version instead. Closes: #477638
+ by selecting the nearest version instead. Closes: #477638
* Update dpkg-parsechangelog's documentation to make it clearer that spaces
are not allowed between single characters options and their values.
Closes: #494883
@@@ -1664,7 -1606,7 +1671,7 @@@ dpkg (1.15.0) experimental; urgency=lo
http://lintian.debian.org/tags/command-with-path-in-maintainer-script.html).
Closes: #216606
* Use dh_lintian to install lintian overrides. Build-Depends on debhelper
- (>= 6.0.7) for this. Update debhelper compatility level to 6 at the same
+ (>= 6.0.7) for this. Update debhelper compatibility level to 6 at the same
time.
* Drop cleanup-info script.
* Reset umask to 0022 in dpkg-gencontrol and dpkg-gensymbols to ensure that
@@@ -1823,7 -1765,7 +1830,7 @@@ dpkg (1.14.22) unstable; urgency=lo
"3.0 (quilt)" format when they have local changes and no pre-existing
quilt series file. Now always provide a valid name in QUILT_SERIES.
Closes: #496920
- * Fix permissions of the automatically generated pacth in "2.0" and "3.0
+ * Fix permissions of the automatically generated patch in "2.0" and "3.0
(quilt)" format. They were improperly set to 0600 due to tempfile()
and were not reset to a sane value. Closes: #496925
* Fix dpkg-gensymbols to not scan (real) directories accessed through a
@@@ -2137,7 -2079,7 +2144,7 @@@ dpkg (1.14.17) experimental; urgency=lo
Thanks to Ian Jackson. Closes: #255882
* Few file descriptor cleanup and error handling fixes.
Thanks to Ian Jackson. Closes: #443338
- * Move test suite invokation to a new check target in debian/rules.
+ * Move test suite invocation to a new check target in debian/rules.
* Add support for nocheck DEB_BUILD_OPTIONS in debian/rules, so that the
dpkg test suite can be skept if desired.
* Improve log and status-fd output by printing more status change updates
@@@ -2264,7 -2206,7 +2271,7 @@@
* Swedish (Peter Karlsson).
[ Updated dselect translations ]
- * Basque. (Piarres beobide). Closes: #462403
+ * Basque (Piarres Beobide). Closes: #462403
[ Updated scripts translations ]
* German (Helge Kreutzmann).
@@@ -2454,7 -2396,7 +2461,7 @@@ dpkg (1.14.15) unstable; urgency=lo
* Remove disabled, obsolete and quite incomplete Hebrew translations.
* Revert dpkg-dev versioned dependency bump on dpkg >= 1.14.13 back to
>= 1.14.6, as the compression variables are now in a module in dpkg-dev.
- * Do not disaplay garbage in dselect on monochrome terminals, by setting
+ * Do not display garbage in dselect on monochrome terminals, by setting
a missing ncurses character attribute. Closes: #155741, #157093
Thanks to Sven Rudolph.
* Do not loop endlessly in dselect with very long package descriptions.
@@@ -2548,7 -2490,7 +2555,7 @@@ dpkg (1.14.13) unstable; urgency=lo
* Ignore the man pages when building without NLS support. Closes: #457673
* Fix perl warnings:
- Check for undefined values when reading from the alternative db.
- * Properly handle symlinks for alternatives with inexistent slave links.
+ * Properly handle symlinks for alternatives with nonexistent slave links.
Closes: #76295, #246906, #433567, #451872, #220044, #392440, #441021
Closes: #443241
Based on a patch by Daniel Leidert <[email protected]>.
@@@ -2604,7 -2546,7 +2611,7 @@@ dpkg (1.14.11) unstable; urgency=lo
* dpkg-shlibdeps now ignores the lack of dependency information in some
specific cases (instead of failing):
- when the library is in the same package than the binary analyzed
- - when the library is not versionned and can't have a shlibs file
+ - when the library is not versioned and can't have a shlibs file
* dpkg-shlibdeps now only displays 10 warnings about symbols not found for
each binary and a count of skipped warnings. Closes: #452318
* dpkg-shlibdeps: optimize "dpkg -S" lookups by caching results, patch
@@@ -2786,7 -2728,7 +2793,7 @@@ dpkg (1.14.7) unstable; urgency=lo
* Let dpkg-buildpackage error out early if the version number from
the changelog is not a valid Debian version. Closes: #216075
* Fix dpkg-source to create correct diffs for files with spaces in
- their name (apparantly we don't have many of those ;).
+ their name (apparently we don't have many of those ;).
Based on a patch by Marcel Toele. Closes: #445380
[ Updated dpkg translations ]
@@@ -3317,7 -3259,7 +3324,7 @@@ dpkg (1.13.20) unstable; urgency=lo
* Add gettext support for the Perl scripts. Based on a patch by
Nicolas François. Closes: #165843
* Only print usage information of dpkg-scanpackages on stdout
- if requested explicetly. Use stderr in case of error.
+ if requested explicitly. Use stderr in case of error.
Closes: #366659
* Add remarks to dpkg-scansources and dpkg-scanpackages
man pages about the need to compress the generated files
@@@ -3348,7 -3290,7 +3355,7 @@@
* Don't claim in dpkg man page that we set DPKG_OLD_CONFFILE and
DPKG_NEW_CONFFILE on sub shells since we actually don't.
* Fix printing of user defined fields with --showformat and
- document the existance of this feature in dpkg-query man page.
+ document the existence of this feature in dpkg-query man page.
* Make --forget-old-unavail more reliable by deleting architecture
information of removed packages. Patch by Piotr Engelking.
Closes: #208532
@@@ -3370,7 -3312,7 +3377,7 @@@
* Fix the --force-depends-version option. Closes: #57104
[ Guillem Jover ]
- * Standarize scripts usage output format and at the same time make
+ * Standardize scripts usage output format and at the same time make
the strings easier for the translators. Add '--help' and '--version'
for most of the scripts. Print the usage and version to stdout.
* Do not strip the epoch from the source:Upstream-Version substvar.
@@@ -3462,14 -3404,14 +3469,14 @@@ dpkg (1.13.19) unstable; urgency=lo
ones from the package being built.
* Split usage strings to make it easier for translators when those change.
Closes: #323957
- * Standarize start-stop-daemon usage output format.
+ * Standardize start-stop-daemon usage output format.
* Make install-info '--dir-file' option compatible with GNU install-info
by renaming the infodir variable to dirfile and not appending the
'/dir' string except when initializing from '--info-dir' or
'--infodir' (Wayne Davison). Closes: #61640, #67237, #286275
* Make install-info add a new line after adding the last entry at the
end of the dir file, which makes the info readers able to see those
- last enties (Nicolas François). Closes: #164495
+ last entries (Nicolas François). Closes: #164495
* Use the numerical value of errno instead of a string in install-info
when checking if the locking error was due to an already existing
file, which is locale dependent, and die accordingly. Based on a patch
@@@ -3634,13 -3576,13 +3641,13 @@@ dpkg (1.13.14) experimental; urgency=lo
* Mark some strings as translatable (Changwoo Ryu). Closes: #256387
* Remove a trailing 'C' character from update-alternatives manpage.
* Use pkg-config to get the proper flags to link against libselinux.
- Add a Build-Dependency on pkg-config, thighten libselinux1-dev to
+ Add a Build-Dependency on pkg-config, tighten libselinux1-dev to
at least version 1.28-4 which provides a .pc file, and remove
libsepol1-dev as libselinux1-dev is Depending on it.
- * Add command descriptions in the synopis, and add a usage example for
+ * Add command descriptions in the synopsis, and add a usage example for
-f in the dpkg-query manpage. Thanks for the initial patch to
Philippe Batailler. Closes: #352091
- * Document about the default log file, the behaviour in case of multple
+ * Document about the default log file, the behaviour in case of multiple
--log options and add a reference to dpkg.cfg manpage in the dpkg manpage.
Thanks to James R. Van Zandt. Closes: #350440
* Escape ` and ' in manpages otherwise they are converted to quotation
@@@ -3726,7 -3668,7 +3733,7 @@@ dpkg (1.13.13) unstable; urgency=lo
* Document the correct format string for dpkg-query --showformat option.
Update -l example and lower case the program name in the title header.
Thanks to Zefram <[email protected]>. Closes: #174976
- * Make dpkg-architecture not print the warning about a missmatch between
+ * Make dpkg-architecture not print the warning about a mismatch between
gcc target machine type and GNU target system type if the actions are
'-e' or '-i'.
diff --combined utils/update-alternatives.c
index 09506cd,b141630..0133a56
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@@ -51,7 -51,7 +51,7 @@@
#define PROGNAME "update-alternatives"
static const char *altdir = SYSCONFDIR "/alternatives";
-static const char *admdir = ADMINDIR "/alternatives";
+static const char *admdir;
static const char *prog_path = "update-alternatives";
@@@ -95,9 -95,7 +95,9 @@@ usage(void
{
printf(_(
"Usage: %s [<option> ...] <command>\n"
-"\n"
+"\n"), PROGNAME);
+
+ printf(_(
"Commands:\n"
" --install <link> <name> <path> <priority>\n"
" [--slave <link> <name> <path>] ...\n"
@@@ -108,15 -106,11 +108,15 @@@
" --display <name> display information about the <name> group.\n"
" --query <name> machine parseable version of --display <name>.\n"
" --list <name> display all targets of the <name> group.\n"
+" --get-selections list master alternative names and their status.\n"
+" --set-selections read alternative status from standard input.\n"
" --config <name> show alternatives for the <name> group and ask
the\n"
" user to select which one to use.\n"
" --set <name> <path> set <path> as alternative for <name>.\n"
" --all call --config on all alternatives.\n"
-"\n"
+"\n"));
+
+ printf(_(
"<link> is the symlink pointing to %s/<name>.\n"
" (e.g. /usr/bin/pager)\n"
"<name> is the master name for this link group.\n"
@@@ -125,21 -119,17 +125,21 @@@
" (e.g. /usr/bin/less)\n"
"<priority> is an integer; options with higher numbers have higher priority
in\n"
" automatic mode.\n"
-"\n"
+"\n"), altdir);
+
+ printf(_(
"Options:\n"
" --altdir <directory> change the alternatives directory.\n"
" --admindir <directory> change the administrative directory.\n"
+" --log <file> change the log file.\n"
+" --force allow replacing files with alternative links.\n"
" --skip-auto skip prompt for alternatives correctly
configured\n"
" in automatic mode (relevant for --config only)\n"
" --verbose verbose operation, more output.\n"
" --quiet quiet operation, minimal output.\n"
" --help show this help message.\n"
" --version show the version.\n"
-), PROGNAME, altdir);
+));
}
static void DPKG_ATTR_NORET DPKG_ATTR_PRINTF(1)
@@@ -147,7 -137,7 +147,7 @@@ error(char const *fmt, ...
{
va_list args;
- fprintf(stderr, PROGNAME ": %s: ", _("error"));
+ fprintf(stderr, "%s: %s: ", PROGNAME, _("error"));
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
@@@ -160,7 -150,7 +160,7 @@@ badusage(char const *fmt, ...
{
va_list args;
- fprintf(stderr, PROGNAME ": ");
+ fprintf(stderr, "%s: ", PROGNAME);
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
@@@ -177,7 -167,7 +177,7 @@@ warning(char const *fmt, ...
if (opt_verbose < 0)
return;
- fprintf(stderr, PROGNAME ": %s: ", _("warning"));
+ fprintf(stderr, "%s: %s: ", PROGNAME, _("warning"));
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
@@@ -206,7 -196,7 +206,7 @@@ verbose(char const *fmt, ...
if (opt_verbose < 1)
return;
- printf(PROGNAME ": ");
+ printf("%s: ", PROGNAME);
va_start(args, fmt);
vprintf(fmt, args);
va_end(args);
@@@ -221,7 -211,7 +221,7 @@@ info(char const *fmt, ...
if (opt_verbose < 0)
return;
- printf(PROGNAME ": ");
+ printf("%s: ", PROGNAME);
va_start(args, fmt);
vprintf(fmt, args);
va_end(args);
@@@ -295,18 -285,6 +295,18 @@@ xreadlink(const char *linkname, bool er
return buf;
}
+static int DPKG_ATTR_VPRINTF(2)
+xvasprintf(char **strp, const char *fmt, va_list args)
+{
+ int ret;
+
+ ret = vasprintf(strp, fmt, args);
+ if (ret < 0)
+ error(_("failed to allocate memory"));
+
+ return ret;
+}
+
static int DPKG_ATTR_PRINTF(2)
xasprintf(char **strp, const char *fmt, ...)
{
@@@ -314,8 -292,10 +314,8 @@@
int ret;
va_start(args, fmt);
- ret = vasprintf(strp, fmt, args);
+ ret = xvasprintf(strp, fmt, args);
va_end(args);
- if (ret < 0)
- error(_("failed to allocate memory"));
return ret;
}
@@@ -328,23 -308,6 +328,23 @@@ set_action(const char *new_action
action = new_action;
}
+static const char *
+admindir_init(void)
+{
+ const char *basedir, *dpkg_basedir;
+ char *admindir;
+
+ dpkg_basedir = getenv("DPKG_ADMINDIR");
+ if (dpkg_basedir)
+ basedir = dpkg_basedir;
+ else
+ basedir = ADMINDIR;
+
+ xasprintf(&admindir, "%s/%s", basedir, "alternatives");
+
+ return admindir;
+}
+
static FILE *fh_log = NULL;
static void DPKG_ATTR_PRINTF(1)
@@@ -365,7 -328,7 +365,7 @@@ log_msg(const char *fmt, ...
time(&now);
strftime(timestamp, sizeof(timestamp), "%Y-%m-%d %H:%M:%S",
localtime(&now));
- fprintf(fh_log, "%s " PROGNAME ": ", timestamp);
+ fprintf(fh_log, "%s %s: ", PROGNAME, timestamp);
va_start(args, fmt);
vfprintf(fh_log, fmt, args);
va_end(args);
@@@ -519,20 -482,6 +519,20 @@@ checked_rm(const char *f
error(_("unable to remove %s: %s"), f, strerror(errno));
}
+static void DPKG_ATTR_PRINTF(1)
+checked_rm_args(const char *fmt, ...)
+{
+ va_list args;
+ char *path;
+
+ va_start(args, fmt);
+ xvasprintf(&path, fmt, args);
+ va_end(args);
+
+ checked_rm(path);
+ free(path);
+}
+
/*
* OBJECTS
*/
@@@ -735,21 -684,10 +735,21 @@@ alternative_choices_free(struct alterna
}
static void
+alternative_commit_operations_free(struct alternative *a)
+{
+ struct commit_operation *op;
+
+ while (a->commit_ops) {
+ op = a->commit_ops;
+ a->commit_ops = op->next;
+ commit_operation_free(op);
+ }
+}
+
+static void
alternative_reset(struct alternative *alt)
{
struct slave_link *slave;
- struct commit_operation *commit_op;
free(alt->master_link);
alt->master_link = NULL;
@@@ -759,7 -697,11 +759,7 @@@
slave_link_free(slave);
}
alternative_choices_free(alt);
- while (alt->commit_ops) {
- commit_op = alt->commit_ops;
- alt->commit_ops = commit_op->next;
- commit_operation_free(commit_op);
- }
+ alternative_commit_operations_free(alt);
alt->modified = false;
}
@@@ -922,9 -864,7 +922,9 @@@ alternative_add_choice(struct alternati
prev->next = fs;
else
a->choices = fs;
- a->modified = true; /* XXX: be smarter in detecting
change? */
+
+ /* XXX: Be smarter in detecting change? */
+ a->modified = true;
return;
}
prev = cur;
@@@ -1076,10 -1016,13 +1076,10 @@@ altdb_parse_error(struct altdb_context
{
char *msg;
va_list args;
- int ret;
va_start(args, format);
- ret = vasprintf(&msg, format, args);
+ xvasprintf(&msg, format, args);
va_end(args);
- if (ret < 0)
- error(_("failed to allocate memory"));
error(_("%s corrupt: %s"), ctx->filename, msg);
}
@@@ -1115,7 -1058,7 +1115,7 @@@ alternative_parse_slave(struct alternat
if (alternative_has_slave(a, name)) {
sl = alternative_get_slave(a, name);
free(name);
- ctx->bad_format(ctx, _("duplicate slave %s"), sl->name);
+ ctx->bad_format(ctx, _("duplicate slave name %s"), sl->name);
}
linkname = altdb_get_line(ctx, _("slave link"));
@@@ -1229,7 -1172,7 +1229,7 @@@ alternative_load(struct alternative *a
if (errno == ENOENT)
return false;
else
- error(_("unable to stat %s: %s"), ctx.filename,
+ error(_("cannot stat %s: %s"), ctx.filename,
strerror(errno));
}
if (st.st_size == 0) {
@@@ -1272,12 -1215,11 +1272,12 @@@
}
static void
-alternative_save(struct alternative *a, const char *file)
+alternative_save(struct alternative *a)
{
struct altdb_context ctx;
struct slave_link *sl, *sl_prev;
struct fileset *fs;
+ char *filenew, *file;
/* Cleanup unused slaves before writing admin file. */
sl_prev = NULL;
@@@ -1304,7 -1246,7 +1304,7 @@@
sl = sl_prev ? sl_prev : a->slaves;
slave_link_free(sl_rm);
if (!sl)
- break; /* no other slave left */
+ break; /* No other slave left. */
}
}
@@@ -1313,13 -1255,10 +1313,13 @@@
alternative_sort_choices(a);
/* Write admin file. */
- ctx.filename = xstrdup(file);
- ctx.fh = fopen(file, "w");
+ xasprintf(&file, "%s/%s", admdir, a->master_name);
+ xasprintf(&filenew, "%s" DPKG_TMP_EXT, file);
+
+ ctx.filename = filenew;
+ ctx.fh = fopen(ctx.filename, "w");
if (ctx.fh == NULL)
- error(_("cannot write %s: %s"), file, strerror(errno));
+ error(_("cannot write %s: %s"), ctx.filename, strerror(errno));
altdb_print_line(&ctx, alternative_status_string(a->status));
altdb_print_line(&ctx, a->master_link);
@@@ -1351,12 -1290,6 +1351,12 @@@
/* Close database file */
if (fclose(ctx.fh))
error(_("unable to close %s: %s"), ctx.filename,
strerror(errno));
+
+ /* Put in place atomically. */
+ checked_mv(filenew, file);
+
+ free(filenew);
+ free(file);
}
static struct fileset *
@@@ -1418,8 -1351,12 +1418,8 @@@ alternative_display_query(struct altern
if (best)
pr("Best: %s", best->master_file);
current = alternative_get_current(a);
- if (current) {
- pr("Value: %s", current);
- free(current);
- } else {
- pr("Value: none");
- }
+ pr("Value: %s", current ? current : "none");
+ free(current);
for (fs = a->choices; fs; fs = fs->next) {
printf("\n");
@@@ -1605,7 -1542,11 +1605,7 @@@ alternative_commit(struct alternative *
}
}
- while (a->commit_ops) {
- op = a->commit_ops;
- a->commit_ops = op->next;
- commit_operation_free(op);
- }
+ alternative_commit_operations_free(a);
}
static void
@@@ -1688,26 -1629,39 +1688,26 @@@ alternative_prepare_install(struct alte
static void
alternative_remove(struct alternative *a)
{
struct stat st;
struct slave_link *sl;
- xasprintf(&fn, "%s" DPKG_TMP_EXT, a->master_link);
- checked_rm(fn);
- free(fn);
+ checked_rm_args("%s" DPKG_TMP_EXT, a->master_link);
if (lstat(a->master_link, &st) == 0 && S_ISLNK(st.st_mode))
checked_rm(a->master_link);
- xasprintf(&fn, "%s/%s" DPKG_TMP_EXT, altdir, a->master_name);
- checked_rm(fn);
- free(fn);
- xasprintf(&fn, "%s/%s", altdir, a->master_name);
- checked_rm(fn);
- free(fn);
+
+ checked_rm_args("%s/%s" DPKG_TMP_EXT, altdir, a->master_name);
+ checked_rm_args("%s/%s", altdir, a->master_name);
for (sl = a->slaves; sl; sl = sl->next) {
- xasprintf(&fn, "%s" DPKG_TMP_EXT, sl->link);
- checked_rm(fn);
- free(fn);
+ checked_rm_args("%s" DPKG_TMP_EXT, sl->link);
if (lstat(sl->link, &st) == 0 && S_ISLNK(st.st_mode))
checked_rm(sl->link);
- xasprintf(&fn, "%s/%s" DPKG_TMP_EXT, altdir, sl->name);
- checked_rm(fn);
- free(fn);
- xasprintf(&fn, "%s/%s", altdir, sl->name);
- checked_rm(fn);
- free(fn);
+
+ checked_rm_args("%s/%s" DPKG_TMP_EXT, altdir, sl->name);
+ checked_rm_args("%s/%s", altdir, sl->name);
}
/* Drop admin file */
- xasprintf(&fn, "%s/%s", admdir, a->master_name);
- checked_rm(fn);
- free(fn);
+ checked_rm_args("%s/%s", admdir, a->master_name);
}
static bool
@@@ -1868,12 -1822,12 +1868,12 @@@ alternative_set_selection(struct altern
char *cmd;
if (strcmp(status, "auto") == 0) {
- xasprintf(&cmd, PROGNAME " --auto %s", name);
+ xasprintf(&cmd, "%s --auto %s", PROGNAME, name);
pr(_("Call %s."), cmd);
free(cmd);
subcall(prog_path, "--auto", name, NULL);
} else if (alternative_has_choice(a, choice)) {
- xasprintf(&cmd, PROGNAME " --set %s %s",
+ xasprintf(&cmd, "%s --set %s %s", PROGNAME,
name, choice);
pr(_("Call %s."), cmd);
free(cmd);
@@@ -1890,6 -1844,8 +1890,6 @@@
static void
alternative_set_selections(struct alternative_map *all, FILE* input, const
char *desc)
{
- const char *prefix = "[" PROGNAME "--set-selections] ";
-
for (;;) {
char line[1024], *res, *name, *status, *choice;
size_t len, i;
@@@ -1918,7 -1874,7 +1918,7 @@@
while (i < len && !isblank(line[i]))
i++;
if (i >= len) {
- printf("%s", prefix);
+ printf("[%s %s] ", PROGNAME, "--set-selections");
pr(_("Skip invalid line: %s"), line);
continue;
}
@@@ -1931,7 -1887,7 +1931,7 @@@
while (i < len && !isblank(line[i]))
i++;
if (i >= len) {
- printf("%s", prefix);
+ printf("[%s %s] ", PROGNAME, "--set-selections");
pr(_("Skip invalid line: %s"), line);
continue;
}
@@@ -1941,13 -1897,13 +1941,13 @@@
/* Delimit choice string in the line */
if (i >= len) {
- printf("%s", prefix);
+ printf("[%s %s] ", PROGNAME, "--set-selections");
pr(_("Skip invalid line: %s"), line);
continue;
}
choice = line + i;
- printf("%s", prefix);
+ printf("[%s %s] ", PROGNAME, "--set-selections");
alternative_set_selection(all, name, status, choice);
}
}
@@@ -2031,8 -1987,6 +2031,8 @@@ main(int argc, char **argv
bindtextdomain("dpkg", LOCALEDIR);
textdomain("dpkg");
+ admdir = admindir_init();
+
if (setvbuf(stdout, NULL, _IONBF, 0))
error("setvbuf failed: %s", strerror(errno));
@@@ -2121,14 -2075,14 +2121,14 @@@
badusage(_("link %s is both primary and slave"),
slink);
if (alternative_has_slave(inst_alt, sname))
- badusage(_("slave name %s duplicated"), sname);
+ badusage(_("duplicate slave name %s"), sname);
for (sl = inst_alt->slaves; sl; sl = sl->next) {
const char *linkname = sl->link;
if (linkname == NULL)
linkname = "";
if (strcmp(linkname, slink) == 0)
- badusage(_("slave link %s duplicated"),
+ badusage(_("duplicate slave link %s"),
slink);
}
@@@ -2210,9 -2164,12 +2210,9 @@@
inst_alt->master_name);
if (found && strcmp(found->master_name,
inst_alt->master_name) != 0) {
- char *msg;
-
- xasprintf(&msg, _("it is a slave of %s"),
- found->master_name);
- error(_("alternative %s can't be master: %s"),
- inst_alt->master_name, msg);
+ error(_("alternative %s can't be master: "
+ "it is a slave of %s"),
+ inst_alt->master_name, found->master_name);
}
found = alternative_map_find(alt_map_links,
@@@ -2250,7 -2207,8 +2250,7 @@@
char *msg;
if (strcmp(found->master_name, sl->name) == 0)
- xasprintf(&msg, "%s",
- _("it is a master
alternative."));
+ msg = _("it is a master alternative.");
else
xasprintf(&msg, _("it is a slave of
%s"),
found->master_name);
@@@ -2287,10 -2245,9 +2287,10 @@@
exit(0);
} else if (strcmp(action, "get-selections") == 0) {
struct alternative_map *am;
- char *current;
for (am = alt_map_obj; am && am->item; am = am->next) {
+ char *current;
+
current = alternative_get_current(am->item);
printf("%-30s %-8s %s\n", am->key,
alternative_status_string(am->item->status),
@@@ -2334,18 -2291,21 +2334,18 @@@
/* Detect manually modified alternative, switch to manual. */
if (!alternative_has_choice(a, current_choice)) {
struct stat st;
- char *altlink;
- xasprintf(&altlink, "%s/%s", altdir, a->master_name);
if (stat(current_choice, &st) == -1 &&
errno == ENOENT) {
- warning(_("%s is dangling, it will be updated "
- "with best choice."), altlink);
+ warning(_("%s/%s is dangling, it will be
updated "
+ "with best choice."), altdir,
a->master_name);
alternative_set_status(a, ALT_ST_AUTO);
} else if (a->status != ALT_ST_MANUAL) {
- warning(_("%s has been changed (manually or by "
+ warning(_("%s/%s has been changed (manually or
by "
"a script). Switching to manual "
- "updates only."), altlink);
+ "updates only."), altdir,
a->master_name);
alternative_set_status(a, ALT_ST_MANUAL);
}
- free(altlink);
}
} else {
/* Lack of alternative link => automatic mode. */
@@@ -2363,7 -2323,11 +2363,11 @@@
alternative_set_status(a, ALT_ST_MANUAL);
} else if (strcmp(action, "auto") == 0) {
alternative_set_status(a, ALT_ST_AUTO);
- new_choice = alternative_get_best(a)->master_file;
+ if (alternative_choices_count(a) == 0)
+ pr(_("There is no program which provides %s."),
+ a->master_name);
+ else
+ new_choice = alternative_get_best(a)->master_file;
} else if (strcmp(action, "config") == 0) {
if (alternative_choices_count(a) == 0) {
pr(_("There is no program which provides %s."),
@@@ -2420,10 -2384,15 +2424,10 @@@
if (a->status == ALT_ST_AUTO) {
new_choice = alternative_get_best(a)->master_file;
} else {
- char *fn;
-
- xasprintf(&fn, "%s/%s", altdir, a->master_name);
- verbose(_("automatic updates of %s are disabled, "
- "leaving it alone."), fn);
+ verbose(_("automatic updates of %s/%s are disabled, "
+ "leaving it alone."), altdir, a->master_name);
verbose(_("to return to automatic updates use "
- "`update-alternatives --auto %s'."),
- a->master_name);
- free(fn);
+ "'%s --auto %s'."), PROGNAME, a->master_name);
}
}
@@@ -2468,8 -2437,17 +2472,8 @@@
/* Save administrative file if needed. */
if (a->modified) {
- char *fntmp, *fn;
-
- xasprintf(&fntmp, "%s/%s" DPKG_TMP_EXT, admdir, a->master_name);
- xasprintf(&fn, "%s/%s", admdir, a->master_name);
-
debug("%s is modified and will be saved", a->master_name);
- alternative_save(a, fntmp);
- checked_mv(fntmp, fn);
-
- free(fntmp);
- free(fn);
+ alternative_save(a);
}
/* Replace all symlinks in one pass. */
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]