~ubuntu-branches/debian/wheezy/dpkg/wheezy

« back to all changes in this revision

Viewing changes to src/trigproc.c

  • Committer: Bazaar Package Importer
  • Author(s): Guillem Jover, Guillem Jover, Raphaël Hertzog, Jonathan Nieder, Steve Langasek, Mark Hymers, Updated programs translations, Updated man page translations, Updated scripts translations, Updated dselect translations
  • Date: 2011-04-01 23:56:54 UTC
  • Revision ID: james.westby@ubuntu.com-20110401235654-8y800dtb75skfrh7
Tags: 1.16.0
[ Guillem Jover ]
* 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.
* Always warn when parsing any package control data which does not have
  an Architecture field except for status and status log files when
  packages are not-installed or half-installed.
* By default reject installing packages w/o an Architecture field. They
  now need --force-architecture, dpkg will still warn about them though.
* Fix build failure when passing --disable-nls to configure.
* Do not segfault on “dpkg -i --no-act”.
* Add missing semicolon to the vsnprintf() compat declaration.
  Thanks to Robert Millan. Closes: #612203
* On install for Ubuntu adjust the i386 GNU cpu name in cputable.
  Thanks to Colin Watson <cjwatson@ubuntu.com>. Closes: #611741
* Sync the info database directory on unpack instead of the temporary
  control information directory, and print the correct pathname on error
  instead of the last file acted on that directory.
* Document in dpkg-query --help output and man page that --list and --show
  arguments are optional.
* Do not read and write the available file unnecessarily.
  Thanks to Michel Lespinasse <walken@zoy.org>. Closes: #397121
* Fix typo in «dpkg-name --overwrite» argument parsing so that it actually
  works at all. Thanks to Ivan Gagis <igagis@gmail.com>. LP: #728708
* Add armhf support to ostable and triplettable. Closes: #594179
* Set the modification time for unpacked symlinks on supported systems.
* Fix undefined value useage in dpkg-genchanges 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.
* Terminate immediately on dpkg-divert rename errors instead of propagating
  up the error codes, this improves error reporting and avoids triggering
  leak detectors. Closes: #620380
* When moving a diverted file across filesystems in dpkg-divert, remove
  the source file.

[ 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 <oxan@oxanvanleeuwen.nl> 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 <cbaines8@gmail.com> 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.
* Apply patch from Colin Watson to let dpkg-buildflags return -O3
  instead of -O2 when building ppc64 packages on Ubuntu. Closes: #612472
* Add new function get_control_path() to Dpkg::Path, it wraps dpkg-query
  --control-path.
* Update dpkg-shlibdeps to be multiarch-ready:
  - use get_control_path() to find symbols/shlibs files
  - parse correctly the output of dpkg --search
* Small fix to support files >2GB in .deb on 64-bit systems. Closes: #616502
  Thanks to Martin Dorey <mdorey@bluearc.com> for the patch.
* dpkg-source now keeps the file ordering in the autogenerated patch when
  regenerating it. Closes: #606080
  Thanks to Colin Watson for the patch.
* dpkg-source now uses a timestamp retrieved from the filesystem when
  resetting the timestamp of patched files so that a time skew when using
  NFS doesn't introduce any inconsistency. Closes: #613023
  Thanks to Jonathan Nieder <jrnieder@gmail.com> for the patch and the
  diagnosis.
* dpkg-source will now remove quilt's .pc directory when --unapply-patches
  is in use. Closes: #591858
* dpkg-source is now a bit less strict when parsing patches:
  - it accepts seeing the same file twice; Closes: #608829
  - it doesn't match on the English text "No newline at end of file" as it
    might be translated in some cases. Closes: #612465
* Improve parser in Dpkg::Control::Hash to not require an empty line
  before the PGP signature. Closes: #617923
  Thanks to Roger Leigh for the initial patch.
* Fix a regression in dpkg-divert where using --rename led to a failure when
  the rename implies crossing file systems. Thanks to Durk Strooisma for
  spotting it.
* Use the correct mtime when installing a file with statoverrides.
  Regression introduced in 1.16.0. LP: #739179
* Remove duplicate word in german translation of dpkg(1). Closes: #616096
* Strip repeated non-significant spaces before and after newlines
  in Uploaders. Closes: #598922
* Ignore whitespaces after options in headers of changelog entries.
  Closes: #605719
* Fix dpkg-source's regression with empty patches (introduced while fixing
  #613023). Closes: #619541

[ Jonathan Nieder ]
* Remove support for use of synchronous sync(2), due to its pernicious
  side-effects and to ease maintenance.
* Clarify that an up-to-date dpkg only needs to be unpacked for
  dpkg-maintscript-helper to work.

[ Steve Langasek ]
* Add new variables to dpkg-architecture, DEB_HOST_MULTIARCH and
  DEB_BUILD_MULTIARCH, that return the "ideal" GNU triplet for each
  architecture which should be used as the path component for library
  installation.

[ Mark Hymers ]
* Add support for Built-Using field. Closes: #619311

[ Updated programs translations ]
* German (Sven Joachim).
* 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).

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 * Trigger processing algorithms:
42
42
 *
43
43
 *
44
 
 * There is a separate queue (`deferred trigproc list') for triggers
45
 
 * `relevant' to what we just did; when we find something triggered `now'
 
44
 * There is a separate queue (‘deferred trigproc list’) for triggers
 
45
 * ‘relevant’ to what we just did; when we find something triggered ‘now’
46
46
 * we add it to that queue (unless --no-triggers).
47
47
 *
48
48
 *
49
49
 * We want to prefer configuring packages where possible to doing
50
50
 * trigger processing, but we want to prefer trigger processing to
51
 
 * cycle-breaking and dependency forcing.  This is achieved as
 
51
 * cycle-breaking and dependency forcing. This is achieved as
52
52
 * follows:
53
53
 *
54
54
 * Each time during configure processing where a package D is blocked by
55
55
 * only (ie Depends unsatisfied but would be satisfied by) a t-awaiter W
56
 
 * we make a note of (one of) W's t-pending, T.  (Only the last such T.)
 
56
 * we make a note of (one of) W's t-pending, T. (Only the last such T.)
57
57
 * (If --no-triggers and nonempty argument list and package isn't in
58
58
 * argument list then we don't do this.)
59
59
 *
60
60
 * Each time in packages.c where we increment dependtry, we instead see
61
 
 * if we have encountered such a t-pending T.  If we do, we trigproc T
 
61
 * if we have encountered such a t-pending T. If we do, we trigproc T
62
62
 * instead of incrementing dependtry and this counts as having done
63
63
 * something so we reset sincenothing.
64
64
 *
65
65
 *
66
66
 * For --triggers-only and --configure, we go through each thing in the
67
67
 * argument queue (the add_to_queue queue) and check what its state is
68
 
 * and if appropriate we trigproc it.  If we didn't have a queue (or had
 
68
 * and if appropriate we trigproc it. If we didn't have a queue (or had
69
69
 * just --pending) we search all triggers-pending packages and add them
70
70
 * to the deferred trigproc list.
71
71
 *
72
72
 *
73
73
 * Before quitting from most operations, we trigproc each package in the
74
 
 * deferred trigproc list.  This may (if not --no-triggers) of course add
 
74
 * deferred trigproc list. This may (if not --no-triggers) of course add
75
75
 * new things to the deferred trigproc list.
76
76
 *
77
77
 *
78
 
 * Note that `we trigproc T' must involve trigger cycle detection and
79
 
 * also automatic setting of t-awaiters to t-pending or installed.  In
 
78
 * Note that ‘we trigproc T’ must involve trigger cycle detection and
 
79
 * also automatic setting of t-awaiters to t-pending or installed. In
80
80
 * particular, we do cycle detection even for trigger processing in the
81
81
 * configure dependtry loop (and it is OK to do it for explicitly
82
82
 * specified packages from the command line arguments; duplicates are
83
83
 * removed by packages.c:process_queue).
84
 
 *
85
84
 */
86
85
 
87
 
/*========== deferred trigger queue ==========*/
 
86
/*========== Deferred trigger queue. ==========*/
88
87
 
89
88
static struct pkg_queue deferred = PKG_QUEUE_INIT;
90
89
 
114
113
                        continue;
115
114
 
116
115
                if (setjmp(ejbuf)) {
117
 
                        error_unwind(ehflag_bombout);
 
116
                        pop_error_context(ehflag_bombout);
118
117
                        continue;
119
118
                }
120
 
                push_error_handler(&ejbuf, print_error_perpackage, pkg->name);
 
119
                push_error_context_jump(&ejbuf, print_error_perpackage,
 
120
                                        pkg->name);
121
121
 
122
122
                pkg->clientdata->trigprocdeferred = NULL;
123
123
                trigproc(pkg);
124
124
 
125
 
                set_error_display(NULL, NULL);
126
 
                error_unwind(ehflag_normaltidy);
 
125
                pop_error_context(ehflag_normaltidy);
127
126
        }
128
127
}
129
128
 
 
129
/*
 
130
 * Called by modstatdb_note.
 
131
 */
130
132
void
131
133
trig_activate_packageprocessing(struct pkginfo *pkg)
132
134
{
137
139
                      trig_cicb_statuschange_activate, pkg);
138
140
}
139
141
 
140
 
/*========== actual trigger processing ==========*/
 
142
/*========== Actual trigger processing. ==========*/
141
143
 
142
144
struct trigcyclenode {
143
145
        struct trigcyclenode *next;
161
163
        tortoise = hare = NULL;
162
164
}
163
165
 
164
 
/* Returns package we're to give up on. */
 
166
/*
 
167
 * Returns package we're to give up on.
 
168
 */
165
169
static struct pkginfo *
166
170
check_trigger_cycle(struct pkginfo *processing_now)
167
171
{
178
182
        tcn->pkgs = NULL;
179
183
        tcn->then_processed = processing_now;
180
184
 
181
 
        it = iterpkgstart();
182
 
        while ((pkg = iterpkgnext(it))) {
 
185
        it = pkg_db_iter_new();
 
186
        while ((pkg = pkg_db_iter_next(it))) {
183
187
                if (!pkg->trigpend_head)
184
188
                        continue;
185
189
                tcpp = nfmalloc(sizeof(*tcpp));
188
192
                tcpp->next = tcn->pkgs;
189
193
                tcn->pkgs = tcpp;
190
194
        }
191
 
        iterpkgend(it);
 
195
        pkg_db_iter_free(it);
192
196
        if (!hare) {
193
197
                debug(dbg_triggersdetail, "check_triggers_cycle pnow=%s first",
194
198
                      processing_now->name);
207
211
        /* Now we compare hare to tortoise.
208
212
         * We want to find a trigger pending in tortoise which is not in hare
209
213
         * if we find such a thing we have proved that hare isn't a superset
210
 
         * of tortoise and so that we haven't found a loop (yet).
211
 
         */
 
214
         * of tortoise and so that we haven't found a loop (yet). */
212
215
        for (tortoise_pkg = tortoise->pkgs;
213
216
             tortoise_pkg;
214
217
             tortoise_pkg = tortoise_pkg->next) {
242
245
                        found_in_hare:;
243
246
                }
244
247
        }
245
 
        /* Oh dear. hare is a superset of tortoise. We are making no progress. */
 
248
        /* Oh dear. hare is a superset of tortoise. We are making no
 
249
         * progress. */
246
250
        fprintf(stderr, _("%s: cycle found while processing triggers:\n chain of"
247
251
                " packages whose triggers are or may be responsible:\n"),
248
 
                DPKG);
 
252
                thisname);
249
253
        sep = "  ";
250
254
        for (tcn = tortoise; tcn; tcn = tcn->next) {
251
255
                fprintf(stderr, "%s%s", sep, tcn->then_processed->name);
279
283
        return giveup;
280
284
}
281
285
 
 
286
/*
 
287
 * Does cycle checking. Doesn't mind if pkg has no triggers pending - in
 
288
 * that case does nothing but fix up any stale awaiters.
 
289
 */
282
290
void
283
291
trigproc(struct pkginfo *pkg)
284
292
{
304
312
                printf(_("Processing triggers for %s ...\n"), pkg->name);
305
313
                log_action("trigproc", pkg);
306
314
 
307
 
                varbufreset(&namesarg);
 
315
                varbuf_reset(&namesarg);
308
316
                for (tp = pkg->trigpend_head; tp; tp = tp->next) {
309
 
                        varbufaddc(&namesarg, ' ');
310
 
                        varbufaddstr(&namesarg, tp->name);
 
317
                        varbuf_add_char(&namesarg, ' ');
 
318
                        varbuf_add_str(&namesarg, tp->name);
311
319
                }
312
 
                varbufaddc(&namesarg, 0);
 
320
                varbuf_end_str(&namesarg);
313
321
 
314
 
                /* Setting the status to halfconfigured
315
 
                 * causes modstatdb_note to clear pending triggers.
316
 
                 */
 
322
                /* Setting the status to half-configured
 
323
                 * causes modstatdb_note to clear pending triggers. */
317
324
                pkg->status = stat_halfconfigured;
318
325
                modstatdb_note(pkg);
319
326
 
335
342
        }
336
343
}
337
344
 
338
 
/*========== transitional global activation ==========*/
 
345
/*========== Transitional global activation. ==========*/
339
346
 
340
347
static void
341
348
transitional_interest_callback_ro(const char *trig, void *user)
358
365
        transitional_interest_callback_ro(trig, user);
359
366
}
360
367
 
 
368
/*
 
369
 * cstatus might be msdbrw_readonly if we're in --no-act mode, in which
 
370
 * case we don't write out all of the interest files etc. but we do
 
371
 * invent all of the activations for our own benefit.
 
372
 */
361
373
static void
362
374
trig_transitional_activate(enum modstatdb_rw cstatus)
363
375
{
364
 
        /* cstatus might be _read if we're in --no-act mode, in which
365
 
         * case we don't write out all of the interest files etc.
366
 
         * but we do invent all of the activations for our own benefit.
367
 
         */
368
376
        struct pkgiterator *it;
369
377
        struct pkginfo *pkg;
370
378
 
371
 
        it = iterpkgstart();
372
 
 
373
 
        while ((pkg = iterpkgnext(it))) {
 
379
        it = pkg_db_iter_new();
 
380
        while ((pkg = pkg_db_iter_next(it))) {
374
381
                if (pkg->status <= stat_halfinstalled)
375
382
                        continue;
376
383
                debug(dbg_triggersdetail, "trig_transitional_activate %s %s",
381
388
                              transitional_interest_callback :
382
389
                              transitional_interest_callback_ro, NULL, pkg);
383
390
        }
384
 
        iterpkgend(it);
 
391
        pkg_db_iter_free(it);
 
392
 
385
393
        if (cstatus >= msdbrw_write) {
386
394
                modstatdb_checkpoint();
387
395
                trig_file_interests_save();
388
396
        }
389
397
}
390
398
 
391
 
/*========== hook setup ==========*/
 
399
/*========== Hook setup. ==========*/
392
400
 
393
401
static struct filenamenode *
394
402
th_proper_nn_find(const char *name, bool nonew)
411
419
{
412
420
        trig_override_hooks(&trig_our_hooks);
413
421
}
414