fields.c 20 KB

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