~ubuntu-branches/ubuntu/lucid/dpkg/lucid

« back to all changes in this revision

Viewing changes to lib/dpkg/fields.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2009-09-18 13:39:36 UTC
  • mfrom: (1.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20090918133936-dj8kjtc2qz3yqj7i
Tags: 1.15.4ubuntu1
* Resynchronise with Debian (LP: #427854). Remaining changes:
  Ubuntu-specific adjustments (probably):
  - Use i686 for lpia in cputable and triplettable.
  - Hack Dpkg::Arch to return i686 for lpia.
  - Move various Conflicts to Breaks, since upgrades from stable Ubuntu
    releases support Breaks.

  Miscellaneous bug fixes:
  - Avoid duplicate attempts to [f]close in obscure error situations which
    might conceiveably close wrong fds.
  - Revert change to stop outputting a newline after a postinst is run
    (Debian #392317).
  - Use the two-arg form of open in Dpkg::Control so that "-" can be
    passed to parse stdin as a control file (Debian #465340).

  Launchpad integration:
  - Add Launchpad-Bugs-Fixed handling in a few more places.

  Build options:
  - Point to https://wiki.ubuntu.com/DistCompilerFlags from
    dpkg-buildpackage(1).
  - Set default LDFLAGS to -Wl,-Bsymbolic-functions. (We've already taken
    this hit in Ubuntu.)
  - Implement handling of hardening-wrapper options via DEB_BUILD_OPTIONS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * libdpkg - Debian packaging suite library routines
 
3
 * fields.c - parsing of all the different fields, when reading in
 
4
 *
 
5
 * Copyright © 1995 Ian Jackson <ian@chiark.greenend.org.uk>
 
6
 * Copyright © 2001 Wichert Akkerman
 
7
 *
 
8
 * This is free software; you can redistribute it and/or modify
 
9
 * it under the terms of the GNU General Public License as
 
10
 * published by the Free Software Foundation; either version 2,
 
11
 * or (at your option) any later version.
 
12
 *
 
13
 * This is distributed in the hope that it will be useful, but
 
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
 * GNU General Public License for more details.
 
17
 *
 
18
 * You should have received a copy of the GNU General Public
 
19
 * License along with dpkg; if not, write to the Free Software
 
20
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
21
 */
 
22
#include <config.h>
 
23
#include <compat.h>
 
24
 
 
25
#include <dpkg/i18n.h>
 
26
 
 
27
#include <stdio.h>
 
28
#include <ctype.h>
 
29
#include <string.h>
 
30
 
 
31
#include <dpkg/dpkg.h>
 
32
#include <dpkg/dpkg-db.h>
 
33
#include <dpkg/path.h>
 
34
#include <dpkg/parsedump.h>
 
35
 
 
36
static int
 
37
convert_string(struct parsedb_state *ps, const char *what, int otherwise,
 
38
               const struct pkginfo *pigp,
 
39
               const char *startp, const struct namevalue *ivip,
 
40
               const char **endpp)
 
41
{
 
42
  const char *ep;
 
43
  const struct namevalue *nvip = ivip;
 
44
 
 
45
  if (!*startp)
 
46
    parse_error(ps, pigp, _("%s is missing"), what);
 
47
  while (nvip->name) {
 
48
    if (strncasecmp(nvip->name, startp, nvip->length))
 
49
      nvip++;
 
50
    else
 
51
      break;
 
52
  }
 
53
  if (!nvip->name) {
 
54
    if (otherwise != -1) return otherwise;
 
55
    parse_error(ps, pigp, _("`%.*s' is not allowed for %s"),
 
56
                (int)strnlen(startp, 50), startp, what);
 
57
  }
 
58
 
 
59
  ep = startp + nvip->length;
 
60
  while (isspace(*ep))
 
61
    ep++;
 
62
  if (*ep && !endpp)
 
63
    parse_error(ps, pigp, _("junk after %s"), what);
 
64
  if (endpp) *endpp= ep;
 
65
  return nvip->value;
 
66
}
 
67
 
 
68
void
 
69
f_name(struct pkginfo *pigp, struct pkginfoperfile *pifp,
 
70
       struct parsedb_state *ps,
 
71
       const char *value, const struct fieldinfo *fip)
 
72
{
 
73
  const char *e;
 
74
  if ((e= illegal_packagename(value,NULL)) != NULL)
 
75
    parse_error(ps, pigp, _("invalid package name (%.250s)"), e);
 
76
  pigp->name= findpackage(value)->name;
 
77
  /* We use the new name, as findpackage() may have
 
78
     done a tolower for us.
 
79
   */
 
80
}
 
81
 
 
82
void f_filecharf(struct pkginfo *pigp, struct pkginfoperfile *pifp,
 
83
                 struct parsedb_state *ps,
 
84
                 const char *value, const struct fieldinfo *fip) {
 
85
  struct filedetails *fdp, **fdpp;
 
86
  char *cpos, *space;
 
87
  int allowextend;
 
88
 
 
89
  if (!*value)
 
90
    parse_error(ps, pigp, _("empty file details field `%s'"), fip->name);
 
91
  if (!(ps->flags & pdb_recordavailable))
 
92
    parse_error(ps, pigp,
 
93
                _("file details field `%s' not allowed in status file"),
 
94
               fip->name);
 
95
  allowextend= !pigp->files;
 
96
  fdpp= &pigp->files;
 
97
  cpos= nfstrsave(value);
 
98
  while (*cpos) {
 
99
    space= cpos; while (*space && !isspace(*space)) space++;
 
100
    if (*space)
 
101
      *space++ = '\0';
 
102
    fdp= *fdpp;
 
103
    if (!fdp) {
 
104
      if (!allowextend)
 
105
        parse_error(ps, pigp,
 
106
                    _("too many values in file details field `%s' "
 
107
                      "(compared to others)"), fip->name);
 
108
      fdp= nfmalloc(sizeof(struct filedetails));
 
109
      fdp->next= NULL;
 
110
      fdp->name= fdp->msdosname= fdp->size= fdp->md5sum= NULL;
 
111
      *fdpp= fdp;
 
112
    }
 
113
    FILEFFIELD(fdp,fip->integer,const char*)= cpos;
 
114
    fdpp= &fdp->next;
 
115
    while (*space && isspace(*space)) space++;
 
116
    cpos= space;
 
117
  }
 
118
  if (*fdpp)
 
119
    parse_error(ps, pigp,
 
120
                _("too few values in file details field `%s' "
 
121
                  "(compared to others)"), fip->name);
 
122
}
 
123
 
 
124
void f_charfield(struct pkginfo *pigp, struct pkginfoperfile *pifp,
 
125
                 struct parsedb_state *ps,
 
126
                 const char *value, const struct fieldinfo *fip) {
 
127
  if (*value) PKGPFIELD(pifp,fip->integer,char*)= nfstrsave(value);
 
128
}
 
129
 
 
130
void f_boolean(struct pkginfo *pigp, struct pkginfoperfile *pifp,
 
131
               struct parsedb_state *ps,
 
132
               const char *value, const struct fieldinfo *fip) {
 
133
  int boolean;
 
134
 
 
135
  if (!*value)
 
136
    return;
 
137
 
 
138
  boolean = convert_string(ps, _("yes/no in boolean field"),
 
139
                           -1, pigp, value, booleaninfos, NULL);
 
140
  PKGPFIELD(pifp, fip->integer, int) = boolean;
 
141
}
 
142
 
 
143
void f_section(struct pkginfo *pigp, struct pkginfoperfile *pifp,
 
144
               struct parsedb_state *ps,
 
145
               const char *value, const struct fieldinfo *fip) {
 
146
  if (!*value) return;
 
147
  pigp->section= nfstrsave(value);
 
148
}
 
149
 
 
150
void f_priority(struct pkginfo *pigp, struct pkginfoperfile *pifp,
 
151
                struct parsedb_state *ps,
 
152
                const char *value, const struct fieldinfo *fip) {
 
153
  if (!*value) return;
 
154
  pigp->priority = convert_string(ps, _("word in `priority' field"),
 
155
                                  pri_other, pigp, value, priorityinfos, NULL);
 
156
  if (pigp->priority == pri_other) pigp->otherpriority= nfstrsave(value);
 
157
}
 
158
 
 
159
void f_status(struct pkginfo *pigp, struct pkginfoperfile *pifp,
 
160
              struct parsedb_state *ps,
 
161
              const char *value, const struct fieldinfo *fip) {
 
162
  const char *ep;
 
163
 
 
164
  if (ps->flags & pdb_rejectstatus)
 
165
    parse_error(ps, pigp,
 
166
                _("value for `status' field not allowed in this context"));
 
167
  if (ps->flags & pdb_recordavailable)
 
168
    return;
 
169
  
 
170
  pigp->want = convert_string(ps, _("first (want) word in `status' field"),
 
171
                              -1, pigp, value, wantinfos, &ep);
 
172
  pigp->eflag = convert_string(ps, _("second (error) word in `status' field"),
 
173
                               -1, pigp, ep, eflaginfos, &ep);
 
174
  pigp->status = convert_string(ps, _("third (status) word in `status' field"),
 
175
                                -1, pigp, ep, statusinfos, NULL);
 
176
}
 
177
 
 
178
void f_version(struct pkginfo *pigp, struct pkginfoperfile *pifp,
 
179
               struct parsedb_state *ps,
 
180
               const char *value, const struct fieldinfo *fip) {
 
181
  const char *emsg;
 
182
  
 
183
  emsg= parseversion(&pifp->version,value);
 
184
  if (emsg)
 
185
    parse_error(ps, pigp,
 
186
                _("error in Version string `%.250s': %.250s"), value, emsg);
 
187
}  
 
188
 
 
189
void f_revision(struct pkginfo *pigp, struct pkginfoperfile *pifp,
 
190
                struct parsedb_state *ps,
 
191
                const char *value, const struct fieldinfo *fip) {
 
192
  char *newversion;
 
193
 
 
194
  parse_warn(ps, pigp,
 
195
             _("obsolete `Revision' or `Package-Revision' field used"));
 
196
  if (!*value) return;
 
197
  if (pifp->version.revision && *pifp->version.revision) {
 
198
    newversion= nfmalloc(strlen(pifp->version.version)+strlen(pifp->version.revision)+2);
 
199
    sprintf(newversion,"%s-%s",pifp->version.version,pifp->version.revision);
 
200
    pifp->version.version= newversion;
 
201
  }
 
202
  pifp->version.revision= nfstrsave(value);
 
203
}  
 
204
 
 
205
void f_configversion(struct pkginfo *pigp, struct pkginfoperfile *pifp,
 
206
                     struct parsedb_state *ps,
 
207
                     const char *value, const struct fieldinfo *fip) {
 
208
  const char *emsg;
 
209
  
 
210
  if (ps->flags & pdb_rejectstatus)
 
211
    parse_error(ps, pigp,
 
212
                _("value for `config-version' field not allowed in this context"));
 
213
  if (ps->flags & pdb_recordavailable)
 
214
    return;
 
215
 
 
216
  emsg= parseversion(&pigp->configversion,value);
 
217
  if (emsg)
 
218
    parse_error(ps, pigp,
 
219
                _("error in Config-Version string `%.250s': %.250s"),
 
220
                value, emsg);
 
221
}
 
222
 
 
223
static void conffvalue_lastword(const char *value, const char *from,
 
224
                                const char *endent,
 
225
                                const char **word_start_r, int *word_len_r,
 
226
                                const char **new_from_r,
 
227
                                struct parsedb_state *ps,
 
228
                                struct pkginfo *pigp)
 
229
{
 
230
  /* the code in f_conffiles ensures that value[-1]==' ', which is helpful */
 
231
  const char *lastspc;
 
232
  
 
233
  if (from <= value+1) goto malformed;
 
234
  for (lastspc= from-1; *lastspc != ' '; lastspc--);
 
235
  if (lastspc <= value+1 || lastspc >= endent-1) goto malformed;
 
236
 
 
237
  *new_from_r= lastspc;
 
238
  *word_start_r= lastspc + 1;
 
239
  *word_len_r= (int)(from - *word_start_r);
 
240
  return;
 
241
 
 
242
malformed:
 
243
  parse_error(ps, pigp,
 
244
              _("value for `conffiles' has malformatted line `%.*s'"),
 
245
              (int)min(endent - value, 250), value);
 
246
}
 
247
 
 
248
void f_conffiles(struct pkginfo *pigp, struct pkginfoperfile *pifp,
 
249
                 struct parsedb_state *ps,
 
250
                 const char *value, const struct fieldinfo *fip) {
 
251
  static const char obsolete_str[]= "obsolete";
 
252
  struct conffile **lastp, *newlink;
 
253
  const char *endent, *endfn, *hashstart;
 
254
  int c, namelen, hashlen, obsolete;
 
255
  char *newptr;
 
256
  
 
257
  lastp= &pifp->conffiles;
 
258
  while (*value) {
 
259
    c= *value++;
 
260
    if (c == '\n') continue;
 
261
    if (c != ' ')
 
262
      parse_error(ps, pigp,
 
263
                  _("value for `conffiles' has line starting with non-space `%c'"),
 
264
                  c);
 
265
    for (endent = value; (c = *endent) != '\0' && c != '\n'; endent++) ;
 
266
    conffvalue_lastword(value, endent, endent,
 
267
                        &hashstart, &hashlen, &endfn,
 
268
                        ps, pigp);
 
269
    obsolete= (hashlen == sizeof(obsolete_str)-1 &&
 
270
               !memcmp(hashstart, obsolete_str, hashlen));
 
271
    if (obsolete)
 
272
      conffvalue_lastword(value, endfn, endent,
 
273
                          &hashstart, &hashlen, &endfn,
 
274
                          ps, pigp);
 
275
    newlink= nfmalloc(sizeof(struct conffile));
 
276
    value = path_skip_slash_dotslash(value);
 
277
    namelen= (int)(endfn-value);
 
278
    if (namelen <= 0)
 
279
      parse_error(ps, pigp,
 
280
                  _("root or null directory is listed as a conffile"));
 
281
    newptr = nfmalloc(namelen+2);
 
282
    newptr[0]= '/';
 
283
    memcpy(newptr+1,value,namelen);
 
284
    newptr[namelen+1] = '\0';
 
285
    newlink->name= newptr;
 
286
    newptr= nfmalloc(hashlen+1);
 
287
    memcpy(newptr, hashstart, hashlen);
 
288
    newptr[hashlen] = '\0';
 
289
    newlink->hash= newptr;
 
290
    newlink->obsolete= obsolete;
 
291
    newlink->next =NULL;
 
292
    *lastp= newlink;
 
293
    lastp= &newlink->next;
 
294
    value= endent;
 
295
  }
 
296
}
 
297
 
 
298
void f_dependency(struct pkginfo *pigp, struct pkginfoperfile *pifp,
 
299
                  struct parsedb_state *ps,
 
300
                  const char *value, const struct fieldinfo *fip) {
 
301
  char c1, c2;
 
302
  const char *p, *emsg;
 
303
  const char *depnamestart, *versionstart;
 
304
  int depnamelength, versionlength;
 
305
  static int depnameused= 0, versionused= 0;
 
306
  static char *depname= NULL, *version= NULL;
 
307
 
 
308
  struct dependency *dyp, **ldypp;
 
309
  struct deppossi *dop, **ldopp;
 
310
 
 
311
  if (!*value) return; /* empty fields are ignored */
 
312
  p= value;
 
313
  ldypp= &pifp->depends; while (*ldypp) ldypp= &(*ldypp)->next;
 
314
  for (;;) { /* loop creating new struct dependency's */
 
315
    dyp= nfmalloc(sizeof(struct dependency));
 
316
    dyp->up= NULL; /* Set this to zero for now, as we don't know what our real
 
317
                 * struct pkginfo address (in the database) is going to be yet.
 
318
                 */
 
319
    dyp->next= NULL; *ldypp= dyp; ldypp= &dyp->next;
 
320
    dyp->list= NULL; ldopp= &dyp->list;
 
321
    dyp->type= fip->integer;
 
322
    for (;;) { /* loop creating new struct deppossi's */
 
323
      depnamestart= p;
 
324
/* skip over package name characters */
 
325
      while (*p && !isspace(*p) && *p != '(' && *p != ',' && *p != '|') {
 
326
        p++;
 
327
      }
 
328
      depnamelength= p - depnamestart ;
 
329
      if (depnamelength >= depnameused) {
 
330
        depnameused= depnamelength;
 
331
        depname = m_realloc(depname, depnamelength + 1);
 
332
      }
 
333
      strncpy(depname, depnamestart, depnamelength);
 
334
      *(depname + depnamelength) = '\0';
 
335
      if (!*depname)
 
336
        parse_error(ps, pigp,
 
337
                    _("`%s' field, missing package name, or garbage where "
 
338
                      "package name expected"), fip->name);
 
339
      emsg= illegal_packagename(depname,NULL);
 
340
      if (emsg)
 
341
        parse_error(ps, pigp,
 
342
                    _("`%s' field, invalid package name `%.255s': %s"),
 
343
                    fip->name, depname, emsg);
 
344
      dop= nfmalloc(sizeof(struct deppossi));
 
345
      dop->up= dyp;
 
346
      dop->ed= findpackage(depname);
 
347
      dop->next= NULL; *ldopp= dop; ldopp= &dop->next;
 
348
      dop->nextrev= NULL; /* Don't link this (which is after all only `newpig' from */
 
349
      dop->backrev= NULL; /* the main parsing loop in parsedb) into the depended on
 
350
                        * packages' lists yet.  This will be done later when we
 
351
                        * install this (in parse.c).  For the moment we do the
 
352
                        * `forward' links in deppossi (`ed') only, and the backward
 
353
                        * links from the depended on packages to dop are left undone.
 
354
                        */
 
355
      dop->cyclebreak= 0;
 
356
/* skip whitespace after packagename */
 
357
      while (isspace(*p)) p++;
 
358
      if (*p == '(') {                  /* if we have a versioned relation */
 
359
        p++; while (isspace(*p)) p++;
 
360
        c1= *p;
 
361
        if (c1 == '<' || c1 == '>') {
 
362
          c2= *++p;
 
363
          dop->verrel= (c1 == '<') ? dvrf_earlier : dvrf_later;
 
364
          if (c2 == '=') {
 
365
            dop->verrel |= (dvrf_orequal | dvrf_builtup);
 
366
            p++;
 
367
          } else if (c2 == c1) {
 
368
            dop->verrel |= (dvrf_strict | dvrf_builtup);
 
369
            p++;
 
370
          } else if (c2 == '<' || c2 == '>') {
 
371
            parse_error(ps, pigp,
 
372
                        _("`%s' field, reference to `%.255s':\n"
 
373
                          " bad version relationship %c%c"),
 
374
                        fip->name, depname, c1, c2);
 
375
            dop->verrel= dvr_none;
 
376
          } else {
 
377
            parse_warn(ps, pigp,
 
378
                       _("`%s' field, reference to `%.255s':\n"
 
379
                         " `%c' is obsolete, use `%c=' or `%c%c' instead"),
 
380
                       fip->name, depname, c1, c1, c1, c1);
 
381
            dop->verrel |= (dvrf_orequal | dvrf_builtup);
 
382
          }
 
383
        } else if (c1 == '=') {
 
384
          dop->verrel= dvr_exact;
 
385
          p++;
 
386
        } else {
 
387
          parse_warn(ps, pigp,
 
388
                     _("`%s' field, reference to `%.255s':\n"
 
389
                       " implicit exact match on version number, "
 
390
                       "suggest using `=' instead"),
 
391
                     fip->name, depname);
 
392
          dop->verrel= dvr_exact;
 
393
        }
 
394
        if ((dop->verrel!=dvr_exact) && (fip->integer==dep_provides))
 
395
          parse_warn(ps, pigp,
 
396
                     _("Only exact versions may be used for Provides"));
 
397
 
 
398
        if (!isspace(*p) && !isalnum(*p)) {
 
399
          parse_warn(ps, pigp,
 
400
                     _("`%s' field, reference to `%.255s':\n"
 
401
                       " version value starts with non-alphanumeric, "
 
402
                       "suggest adding a space"),
 
403
                     fip->name, depname);
 
404
        }
 
405
/* skip spaces between the relation and the version */
 
406
        while (isspace(*p)) p++;
 
407
 
 
408
        versionstart= p;
 
409
        while (*p && *p != ')' && *p != '(') {
 
410
          if (isspace(*p)) break;
 
411
          p++;
 
412
        }
 
413
        versionlength= p - versionstart;
 
414
        while (isspace(*p)) p++;
 
415
        if (*p == '(')
 
416
          parse_error(ps, pigp,
 
417
                      _("`%s' field, reference to `%.255s': "
 
418
                        "version contains `%c'"), fip->name,depname, ')');
 
419
        else if (*p != ')')
 
420
          parse_error(ps, pigp,
 
421
                      _("`%s' field, reference to `%.255s': "
 
422
                        "version contains `%c'"), fip->name,depname, ' ');
 
423
        else if (*p == '\0')
 
424
          parse_error(ps, pigp,
 
425
                      _("`%s' field, reference to `%.255s': "
 
426
                        "version unterminated"), fip->name, depname);
 
427
        if (versionlength >=  versionused) {
 
428
          versionused= versionlength;
 
429
          version = m_realloc(version, versionlength + 1);
 
430
        }
 
431
        strncpy(version,  versionstart, versionlength);
 
432
        *(version + versionlength) = '\0';
 
433
        emsg= parseversion(&dop->version,version);
 
434
        if (emsg)
 
435
          parse_error(ps, pigp,
 
436
                      _("`%s' field, reference to `%.255s': "
 
437
                        "error in version: %.255s"), fip->name, depname, emsg);
 
438
        p++; while (isspace(*p)) p++;
 
439
      } else {
 
440
        dop->verrel= dvr_none;
 
441
        blankversion(&dop->version);
 
442
      }
 
443
      if (!*p || *p == ',') break;
 
444
      if (*p != '|')
 
445
        parse_error(ps, pigp,
 
446
                    _("`%s' field, syntax error after reference to package `%.255s'"),
 
447
                    fip->name, dop->ed->name);
 
448
      if (fip->integer == dep_conflicts ||
 
449
          fip->integer == dep_breaks ||
 
450
          fip->integer == dep_provides ||
 
451
          fip->integer == dep_replaces)
 
452
        parse_error(ps, pigp,
 
453
                    _("alternatives (`|') not allowed in %s field"), fip->name);
 
454
      p++; while (isspace(*p)) p++;
 
455
    }
 
456
    if (!*p) break;
 
457
    p++; while (isspace(*p)) p++;
 
458
  }
 
459
}
 
460
 
 
461
static const char *
 
462
scan_word(const char **valp)
 
463
{
 
464
  static char *buf;
 
465
  static int avail;
 
466
 
 
467
  int l;
 
468
  const char *p, *start, *end;
 
469
 
 
470
  p = *valp;
 
471
  for (;;) {
 
472
    if (!*p) {
 
473
      *valp = p;
 
474
      return NULL;
 
475
    }
 
476
    if (cisspace(*p)) {
 
477
      p++;
 
478
      continue;
 
479
    }
 
480
    start = p;
 
481
    break;
 
482
  }
 
483
  for (;;) {
 
484
    if (*p && !cisspace(*p)) {
 
485
      p++;
 
486
      continue;
 
487
    }
 
488
    end = p;
 
489
    break;
 
490
  }
 
491
  l = end - start;
 
492
  if (l >= avail) {
 
493
    avail = l * 2 + 4;
 
494
    buf = m_realloc(buf, avail);
 
495
  }
 
496
  memcpy(buf, start, l);
 
497
  buf[l] = '\0';
 
498
  *valp = p;
 
499
 
 
500
  return buf;
 
501
}
 
502
 
 
503
void
 
504
f_trigpend(struct pkginfo *pend, struct pkginfoperfile *pifp,
 
505
           struct parsedb_state *ps,
 
506
           const char *value, const struct fieldinfo *fip)
 
507
{
 
508
  const char *word, *emsg;
 
509
 
 
510
  if (ps->flags & pdb_rejectstatus)
 
511
    parse_error(ps, pend,
 
512
                _("value for `triggers-pending' field not allowed in "
 
513
                  "this context"));
 
514
 
 
515
  while ((word = scan_word(&value))) {
 
516
    emsg = illegal_triggername(word);
 
517
    if (emsg)
 
518
      parse_error(ps, pend,
 
519
                  _("illegal pending trigger name `%.255s': %s"), word, emsg);
 
520
 
 
521
    if (!trig_note_pend_core(pend, nfstrsave(word)))
 
522
      parse_error(ps, pend,
 
523
                  _("duplicate pending trigger `%.255s'"), word);
 
524
  }
 
525
}
 
526
 
 
527
void
 
528
f_trigaw(struct pkginfo *aw, struct pkginfoperfile *pifp,
 
529
         struct parsedb_state *ps,
 
530
         const char *value, const struct fieldinfo *fip)
 
531
{
 
532
  const char *word, *emsg;
 
533
  struct pkginfo *pend;
 
534
 
 
535
  if (ps->flags & pdb_rejectstatus)
 
536
    parse_error(ps, aw,
 
537
                _("value for `triggers-awaited' field not allowed in "
 
538
                  "this context"));
 
539
 
 
540
  while ((word = scan_word(&value))) {
 
541
    emsg = illegal_packagename(word, NULL);
 
542
    if (emsg)
 
543
      parse_error(ps, aw,
 
544
                  _("illegal package name in awaited trigger `%.255s': %s"),
 
545
                  word, emsg);
 
546
    pend = findpackage(word);
 
547
 
 
548
    if (!trig_note_aw(pend, aw))
 
549
      parse_error(ps, aw,
 
550
                  _("duplicate awaited trigger package `%.255s'"), word);
 
551
 
 
552
    trig_enqueue_awaited_pend(pend);
 
553
  }
 
554
}
 
555