Commit fa3cdaf1b46dcbb583393f93a02f89207ba21a88

Authored by Jay Berkenbilt
1 parent dedf9a06

Check for warnings in files used by --pages

ChangeLog
  1 +2023-09-03 Jay Berkenbilt <ejb@ql.org>
  2 +
  3 + * Bug fix: with --pages, if one of the external files had warnings
  4 + but the main file did not, the warning was previously not taken
  5 + into consideration when determining the exit status.
  6 +
1 7 2023-09-02 Jay Berkenbilt <ejb@ql.org>
2 8  
3 9 * Bug fix from M. Holger: allow fix-qdf to read from pipe. Fixes #1010.
... ...
libqpdf/QPDFJob.cc
... ... @@ -2561,6 +2561,11 @@ QPDFJob::handlePageSpecs(QPDF&amp; pdf, std::vector&lt;std::unique_ptr&lt;QPDF&gt;&gt;&amp; page_hea
2561 2561 }
2562 2562 }
2563 2563 }
  2564 + for (auto const& p: page_spec_qpdfs) {
  2565 + if (!p.second->getWarnings().empty()) {
  2566 + m->warnings = true;
  2567 + }
  2568 + }
2564 2569 }
2565 2570  
2566 2571 void
... ...
qpdf/qtest/page-errors.test
... ... @@ -22,7 +22,7 @@ $td-&gt;runtest(&quot;handle page no with contents&quot;,
22 22 $td->NORMALIZE_NEWLINES);
23 23 $td->runtest("handle page with missing MediaBox",
24 24 {$td->COMMAND => "qpdf --static-id --empty --pages page-no-content.pdf -- out.pdf"},
25   - {$td->FILE => "page-missing-mediabox.out", $td->EXIT_STATUS => 0},
  25 + {$td->FILE => "page-missing-mediabox.out", $td->EXIT_STATUS => 3},
26 26 $td->NORMALIZE_NEWLINES);
27 27 $td->runtest("check output",
28 28 {$td->FILE => "out.pdf"},
... ...
qpdf/qtest/qpdf/page-missing-mediabox.out
1 1 WARNING: page-no-content.pdf, object 4 0 at offset 288: kid 1 (from 0) MediaBox is undefined; setting to letter / ANSI A
  2 +qpdf: operation succeeded with warnings; resulting file may have some problems
... ...