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

« back to all changes in this revision

Viewing changes to src/help.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:
57
57
 
58
58
struct filenamenode *namenodetouse(struct filenamenode *namenode, struct pkginfo *pkg) {
59
59
  struct filenamenode *r;
60
 
  
 
60
 
61
61
  if (!namenode->divert) {
62
62
    r = namenode;
63
63
    return r;
64
64
  }
65
 
  
 
65
 
66
66
  debug(dbg_eachfile,"namenodetouse namenode=`%s' pkg=%s",
67
67
        namenode->name,pkg->name);
68
 
  
 
68
 
69
69
  r=
70
70
    (namenode->divert->useinstead && namenode->divert->pkg != pkg)
71
71
      ? namenode->divert->useinstead : namenode;
72
 
  
 
72
 
73
73
  debug(dbg_eachfile,
74
74
        "namenodetouse ... useinstead=%s camefrom=%s pkg=%s return %s",
75
75
        namenode->divert->useinstead ? namenode->divert->useinstead->name : "<none>",
80
80
  return r;
81
81
}
82
82
 
 
83
/**
 
84
 * Verify that some programs can be found in the PATH.
 
85
 */
83
86
void checkpath(void) {
84
 
/* Verify that some programs can be found in the PATH. */
85
87
  static const char *const prog_list[] = {
86
88
    DEFAULTSHELL,
87
89
    RM,
91
93
    "ldconfig",
92
94
#if WITH_START_STOP_DAEMON
93
95
    "start-stop-daemon",
94
 
#endif    
95
 
    "update-rc.d",
 
96
#endif
96
97
    NULL
97
98
  };
98
99
 
114
115
      path_end = strchr(path, ':');
115
116
      path_len = path_end ? (size_t)(path_end - path) : strlen(path);
116
117
 
117
 
      varbufreset(&filename);
118
 
      varbufaddbuf(&filename, path, path_len);
 
118
      varbuf_reset(&filename);
 
119
      varbuf_add_buf(&filename, path, path_len);
119
120
      if (path_len)
120
 
        varbufaddc(&filename, '/');
121
 
      varbufaddstr(&filename, *prog);
122
 
      varbufaddc(&filename, '\0');
 
121
        varbuf_add_char(&filename, '/');
 
122
      varbuf_add_str(&filename, *prog);
 
123
      varbuf_end_str(&filename);
123
124
 
124
125
      if (stat(filename.buf, &stab) == 0 && (stab.st_mode & 0111))
125
126
        break;
134
135
 
135
136
  if (warned)
136
137
    forcibleerr(fc_badpath,
137
 
                P_("%d expected program not found in PATH or not executable.\n"
138
 
                   "NB: root's PATH should usually contain "
139
 
                   "/usr/local/sbin, /usr/sbin and /sbin.",
140
 
                   "%d expected programs not found in PATH or not executable.\n"
141
 
                   "NB: root's PATH should usually contain "
142
 
                   "/usr/local/sbin, /usr/sbin and /sbin.", warned), warned);
 
138
                P_("%d expected program not found in PATH or not executable.\n%s",
 
139
                   "%d expected programs not found in PATH or not executable.\n%s",
 
140
                   warned),
 
141
                warned, _("Note: root's PATH should usually contain "
 
142
                          "/usr/local/sbin, /usr/sbin and /sbin."));
143
143
}
144
144
 
145
145
bool
174
174
  return fc_conflicts;
175
175
}
176
176
 
 
177
/**
 
178
 * Returns the path to the script inside the chroot.
 
179
 */
177
180
static const char *
178
181
preexecscript(struct command *cmd)
179
182
{
180
 
  /* returns the path to the script inside the chroot
181
 
   * FIXME: none of the stuff here will work if admindir isn't inside
182
 
   * instdir as expected.
183
 
   */
184
 
  size_t instdirl;
 
183
  const char *admindir = dpkg_db_get_dir();
 
184
  size_t instdirl = strlen(instdir);
185
185
 
186
186
  if (*instdir) {
 
187
    if (strncmp(admindir, instdir, instdirl) != 0)
 
188
      ohshit(_("admindir must be inside instdir for dpkg to work properly"));
 
189
    if (setenv("DPKG_ADMINDIR", admindir + instdirl, 1) < 0)
 
190
      ohshite(_("unable to setenv for subprocesses"));
 
191
 
187
192
    if (chroot(instdir)) ohshite(_("failed to chroot to `%.250s'"),instdir);
188
193
    if (chdir("/"))
189
194
      ohshite(_("failed to chdir to `%.255s'"), "/");
190
195
  }
191
 
  if (f_debug & dbg_scripts) {
 
196
  if (debug_has_flag(dbg_scripts)) {
192
197
    struct varbuf args = VARBUF_INIT;
193
198
    const char **argv = cmd->argv;
194
199
 
195
200
    while (*++argv) {
196
 
      varbufaddc(&args, ' ');
197
 
      varbufaddstr(&args, *argv);
 
201
      varbuf_add_char(&args, ' ');
 
202
      varbuf_add_str(&args, *argv);
198
203
    }
199
 
    varbufaddc(&args, '\0');
 
204
    varbuf_end_str(&args);
200
205
    debug(dbg_scripts, "fork/exec %s (%s )", cmd->filename, args.buf);
201
206
    varbuf_destroy(&args);
202
207
  }
203
 
  instdirl= strlen(instdir);
204
208
  if (!instdirl)
205
209
    return cmd->filename;
206
210
  assert(strlen(cmd->filename) >= instdirl);
207
211
  return cmd->filename + instdirl;
208
 
}  
 
212
}
209
213
 
210
214
void
211
215
post_postinst_tasks(struct pkginfo *pkg, enum pkgstatus new_status)
223
227
 
224
228
  if (!f_noact) {
225
229
    debug(dbg_triggersdetail, "post_postinst_tasks_core - trig_incorporate");
226
 
    trig_incorporate(msdbrw_write, admindir);
 
230
    trig_incorporate(msdbrw_write);
227
231
  }
228
232
}
229
233
 
234
238
 
235
239
  debug(dbg_triggersdetail,
236
240
        "post_script_tasks - ensure_diversions; trig_incorporate");
237
 
  trig_incorporate(msdbrw_write, admindir);
 
241
  trig_incorporate(msdbrw_write);
238
242
}
239
243
 
240
244
static void
250
254
}
251
255
 
252
256
static int
253
 
do_script(struct pkginfo *pkg, struct pkginfoperfile *pif,
 
257
do_script(struct pkginfo *pkg, struct pkgbin *pif,
254
258
          struct command *cmd, struct stat *stab, int warn)
255
259
{
256
 
  int c1, r;
 
260
  pid_t pid;
 
261
  int r;
257
262
 
258
263
  setexecute(cmd->filename, stab);
259
264
 
260
265
  push_cleanup(cu_post_script_tasks, ehflag_bombout, NULL, 0, 0);
261
266
 
262
 
  c1 = subproc_fork();
263
 
  if (!c1) {
264
 
    if (setenv(MAINTSCRIPTPKGENVVAR, pkg->name, 1) ||
265
 
        setenv(MAINTSCRIPTARCHENVVAR, pif->architecture, 1) ||
266
 
        setenv(MAINTSCRIPTNAMEENVVAR, cmd->argv[0], 1) ||
267
 
        setenv(MAINTSCRIPTDPKGENVVAR, PACKAGE_VERSION, 1))
 
267
  pid = subproc_fork();
 
268
  if (pid == 0) {
 
269
    if (setenv("DPKG_MAINTSCRIPT_PACKAGE", pkg->name, 1) ||
 
270
        setenv("DPKG_MAINTSCRIPT_ARCH", pif->arch, 1) ||
 
271
        setenv("DPKG_MAINTSCRIPT_NAME", cmd->argv[0], 1) ||
 
272
        setenv("DPKG_RUNNING_VERSION", PACKAGE_VERSION, 1))
268
273
      ohshite(_("unable to setenv for maintainer script"));
269
274
 
270
275
    cmd->filename = cmd->argv[0] = preexecscript(cmd);
271
276
    command_exec(cmd);
272
277
  }
273
 
  subproc_signals_setup(cmd->name); /* This does a push_cleanup() */
274
 
  r = subproc_wait_check(c1, cmd->name, warn);
 
278
  subproc_signals_setup(cmd->name); /* This does a push_cleanup(). */
 
279
  r = subproc_wait_check(pid, cmd->name, warn);
275
280
  pop_cleanup(ehflag_normaltidy);
276
281
 
277
282
  pop_cleanup(ehflag_normaltidy);
311
316
  return 1;
312
317
}
313
318
 
314
 
/* All ...'s are const char*'s. */
 
319
/*
 
320
 * All ...'s in maintainer_script_* are const char *'s.
 
321
 */
 
322
 
315
323
int
316
324
maintainer_script_installed(struct pkginfo *pkg, const char *scriptname,
317
325
                            const char *desc, ...)
352
360
  struct stat stab;
353
361
  va_list args;
354
362
  char buf[100];
355
 
  
 
363
 
356
364
  strcpy(cidirrest, scriptname);
357
365
  sprintf(buf, _("new %s script"), desc);
358
366
 
443
451
  struct pkgiterator *it;
444
452
  struct pkginfo *pkg;
445
453
 
446
 
  it= iterpkgstart();
447
 
  while ((pkg = iterpkgnext(it)) != NULL) {
 
454
  it = pkg_db_iter_new();
 
455
  while ((pkg = pkg_db_iter_next(it)) != NULL) {
448
456
    ensure_package_clientdata(pkg);
449
457
    pkg->clientdata->istobe= itb_normal;
450
458
    pkg->clientdata->replacingfilesandsaid= 0;
451
459
  }
452
 
  iterpkgend(it);
453
 
}
454
 
 
455
 
void debug(int which, const char *fmt, ...) {
456
 
  va_list args;
457
 
 
458
 
  if (!(f_debug & which)) return;
459
 
  fprintf(stderr,"D0%05o: ",which);
460
 
  va_start(args, fmt);
461
 
  vfprintf(stderr, fmt, args);
462
 
  va_end(args);
463
 
  putc('\n',stderr);
 
460
  pkg_db_iter_free(it);
464
461
}
465
462
 
466
463
/*
496
493
{
497
494
  struct filepackages_iterator *iter;
498
495
  struct pkginfo *other_pkg;
499
 
    
 
496
 
500
497
  debug(dbg_veryverbose, "isdirectoryinuse `%s' (except %s)", file->name,
501
498
        pkg ? pkg->name : "<none>");
502
499
 
516
513
 
517
514
void oldconffsetflags(const struct conffile *searchconff) {
518
515
  struct filenamenode *namenode;
519
 
  
 
516
 
520
517
  while (searchconff) {
521
518
    namenode= findnamenode(searchconff->name, 0); /* XXX */
522
519
    namenode->flags |= fnnf_old_conff;
561
558
}
562
559
 
563
560
void ensure_pathname_nonexisting(const char *pathname) {
564
 
  int c1;
 
561
  pid_t pid;
565
562
  const char *u;
566
563
 
567
564
  u = path_skip_slash_dotslash(pathname);
568
565
  assert(*u);
569
566
 
570
567
  debug(dbg_eachfile,"ensure_pathname_nonexisting `%s'",pathname);
571
 
  if (!rmdir(pathname)) return; /* Deleted it OK, it was a directory. */
 
568
  if (!rmdir(pathname))
 
569
    return; /* Deleted it OK, it was a directory. */
572
570
  if (errno == ENOENT || errno == ELOOP) return;
573
571
  if (errno == ENOTDIR) {
574
 
    /* Either it's a file, or one of the path components is.  If one
575
 
     * of the path components is this will fail again ...
576
 
     */
 
572
    /* Either it's a file, or one of the path components is. If one
 
573
     * of the path components is this will fail again ... */
577
574
    if (secure_unlink(pathname) == 0)
578
 
      return; /* OK, it was */
 
575
      return; /* OK, it was. */
579
576
    if (errno == ENOTDIR) return;
580
577
  }
581
 
  if (errno != ENOTEMPTY && errno != EEXIST) { /* Huh ? */
 
578
  if (errno != ENOTEMPTY && errno != EEXIST) { /* Huh? */
582
579
    ohshite(_("unable to securely remove '%.255s'"), pathname);
583
580
  }
584
 
  c1 = subproc_fork();
585
 
  if (!c1) {
 
581
  pid = subproc_fork();
 
582
  if (pid == 0) {
586
583
    execlp(RM, "rm", "-rf", "--", pathname, NULL);
587
 
    ohshite(_("failed to exec rm for cleanup"));
 
584
    ohshite(_("unable to execute %s (%s)"), _("rm command for cleanup"), RM);
588
585
  }
589
586
  debug(dbg_eachfile,"ensure_pathname_nonexisting running rm -rf");
590
 
  subproc_wait_check(c1, "rm cleanup", 0);
 
587
  subproc_wait_check(pid, "rm cleanup", 0);
591
588
}
592
589
 
593
590
void log_action(const char *action, struct pkginfo *pkg) {