Commit 8c718b7e6f6e1fdf88ca3b93be0304d5753bc376
1 parent
2c29a039
Prefix program name before exception message in qpdf CLI
Showing
16 changed files
with
21 additions
and
20 deletions
qpdf/qpdf.cc
| @@ -6057,7 +6057,7 @@ int realmain(int argc, char* argv[]) | @@ -6057,7 +6057,7 @@ int realmain(int argc, char* argv[]) | ||
| 6057 | } | 6057 | } |
| 6058 | catch (std::exception& e) | 6058 | catch (std::exception& e) |
| 6059 | { | 6059 | { |
| 6060 | - std::cerr << e.what() << std::endl; | 6060 | + std::cerr << whoami << ": " << e.what() << std::endl; |
| 6061 | return EXIT_ERROR; | 6061 | return EXIT_ERROR; |
| 6062 | } | 6062 | } |
| 6063 | 6063 |
qpdf/qtest/qpdf.test
| @@ -3494,7 +3494,7 @@ foreach my $d ('nn', 'ny', 'yn', 'yy') | @@ -3494,7 +3494,7 @@ foreach my $d ('nn', 'ny', 'yn', 'yy') | ||
| 3494 | 3494 | ||
| 3495 | $td->runtest("deterministic ID with encryption", | 3495 | $td->runtest("deterministic ID with encryption", |
| 3496 | {$td->COMMAND => "qpdf -deterministic-id encrypted-with-images.pdf a.pdf"}, | 3496 | {$td->COMMAND => "qpdf -deterministic-id encrypted-with-images.pdf a.pdf"}, |
| 3497 | - {$td->STRING => "INTERNAL ERROR: QPDFWriter::generateID" . | 3497 | + {$td->STRING => "qpdf: INTERNAL ERROR: QPDFWriter::generateID" . |
| 3498 | " has no data for deterministic ID." . | 3498 | " has no data for deterministic ID." . |
| 3499 | " This may happen if deterministic ID and" . | 3499 | " This may happen if deterministic ID and" . |
| 3500 | " file encryption are requested together.\n", | 3500 | " file encryption are requested together.\n", |
| @@ -4272,8 +4272,9 @@ $td->runtest("non-encrypted", | @@ -4272,8 +4272,9 @@ $td->runtest("non-encrypted", | ||
| 4272 | $td->runtest("invalid password", | 4272 | $td->runtest("invalid password", |
| 4273 | {$td->COMMAND => "qpdf -qdf --password=quack" . | 4273 | {$td->COMMAND => "qpdf -qdf --password=quack" . |
| 4274 | " enc-R2,V1,U=view,O=view.pdf a.qdf"}, | 4274 | " enc-R2,V1,U=view,O=view.pdf a.qdf"}, |
| 4275 | - {$td->STRING => "enc-R2,V1,U=view,O=view.pdf: invalid password\n", | ||
| 4276 | - $td->EXIT_STATUS => 2}, | 4275 | + {$td->STRING => |
| 4276 | + "qpdf: enc-R2,V1,U=view,O=view.pdf: invalid password\n", | ||
| 4277 | + $td->EXIT_STATUS => 2}, | ||
| 4277 | $td->NORMALIZE_NEWLINES); | 4278 | $td->NORMALIZE_NEWLINES); |
| 4278 | $td->runtest("C API: invalid password", | 4279 | $td->runtest("C API: invalid password", |
| 4279 | {$td->COMMAND => | 4280 | {$td->COMMAND => |
| @@ -4740,7 +4741,7 @@ foreach my $d (@unicode_pw_cases) | @@ -4740,7 +4741,7 @@ foreach my $d (@unicode_pw_cases) | ||
| 4740 | my $exp = ''; | 4741 | my $exp = ''; |
| 4741 | if (ref($decode_cases) ne 'ARRAY') | 4742 | if (ref($decode_cases) ne 'ARRAY') |
| 4742 | { | 4743 | { |
| 4743 | - $exp = $decode_cases; | 4744 | + $exp = "qpdf: $decode_cases"; |
| 4744 | $decode_cases = []; | 4745 | $decode_cases = []; |
| 4745 | } | 4746 | } |
| 4746 | $td->runtest("encode $bits, $pw, $w_encoding", | 4747 | $td->runtest("encode $bits, $pw, $w_encoding", |
| @@ -4762,7 +4763,7 @@ foreach my $d (@unicode_pw_cases) | @@ -4762,7 +4763,7 @@ foreach my $d (@unicode_pw_cases) | ||
| 4762 | $r_output .= "trying other\n" if $tried_others; | 4763 | $r_output .= "trying other\n" if $tried_others; |
| 4763 | if ($xfail) | 4764 | if ($xfail) |
| 4764 | { | 4765 | { |
| 4765 | - $r_output .= "a.pdf: invalid password\n"; | 4766 | + $r_output .= "qpdf: a.pdf: invalid password\n"; |
| 4766 | } | 4767 | } |
| 4767 | else | 4768 | else |
| 4768 | { | 4769 | { |
qpdf/qtest/qpdf/issue-100.out
| @@ -14,4 +14,4 @@ WARNING: issue-100.pdf (object 5 0, offset 489): attempting to recover stream le | @@ -14,4 +14,4 @@ WARNING: issue-100.pdf (object 5 0, offset 489): attempting to recover stream le | ||
| 14 | WARNING: issue-100.pdf (object 5 0, offset 489): recovered stream length: 12 | 14 | WARNING: issue-100.pdf (object 5 0, offset 489): recovered stream length: 12 |
| 15 | WARNING: issue-100.pdf (trailer, offset 953): expected dictionary key but found non-name object; inserting key /QPDFFake1 | 15 | WARNING: issue-100.pdf (trailer, offset 953): expected dictionary key but found non-name object; inserting key /QPDFFake1 |
| 16 | WARNING: issue-100.pdf (trailer, offset 953): dictionary ended prematurely; using null as value for last key | 16 | WARNING: issue-100.pdf (trailer, offset 953): dictionary ended prematurely; using null as value for last key |
| 17 | -issue-100.pdf (offset 1144): unable to find /Root dictionary | 17 | +qpdf: issue-100.pdf (offset 1144): unable to find /Root dictionary |
qpdf/qtest/qpdf/issue-101.out
| @@ -40,4 +40,4 @@ WARNING: issue-101.pdf (object 11 0, offset 639): unknown token while reading ob | @@ -40,4 +40,4 @@ WARNING: issue-101.pdf (object 11 0, offset 639): unknown token while reading ob | ||
| 40 | WARNING: issue-101.pdf (object 11 0, offset 644): unknown token while reading object; treating as string | 40 | WARNING: issue-101.pdf (object 11 0, offset 644): unknown token while reading object; treating as string |
| 41 | WARNING: issue-101.pdf (object 11 0, offset 644): too many errors; giving up on reading object | 41 | WARNING: issue-101.pdf (object 11 0, offset 644): too many errors; giving up on reading object |
| 42 | WARNING: issue-101.pdf (object 11 0, offset 647): expected endobj | 42 | WARNING: issue-101.pdf (object 11 0, offset 647): expected endobj |
| 43 | -issue-101.pdf (offset 687): unable to find /Root dictionary | 43 | +qpdf: issue-101.pdf (offset 687): unable to find /Root dictionary |
qpdf/qtest/qpdf/issue-141a.out
| @@ -5,4 +5,4 @@ WARNING: issue-141a.pdf (xref stream: object 9 0, offset 47): unable to recover | @@ -5,4 +5,4 @@ WARNING: issue-141a.pdf (xref stream: object 9 0, offset 47): unable to recover | ||
| 5 | WARNING: issue-141a.pdf: file is damaged | 5 | WARNING: issue-141a.pdf: file is damaged |
| 6 | WARNING: issue-141a.pdf (xref stream, offset 3): Cross-reference stream's /W indicates entry size of 0 | 6 | WARNING: issue-141a.pdf (xref stream, offset 3): Cross-reference stream's /W indicates entry size of 0 |
| 7 | WARNING: issue-141a.pdf: Attempting to reconstruct cross-reference table | 7 | WARNING: issue-141a.pdf: Attempting to reconstruct cross-reference table |
| 8 | -issue-141a.pdf: unable to find trailer dictionary while recovering damaged file | 8 | +qpdf: issue-141a.pdf: unable to find trailer dictionary while recovering damaged file |
qpdf/qtest/qpdf/issue-141b.out
| @@ -2,4 +2,4 @@ WARNING: issue-141b.pdf: can't find PDF header | @@ -2,4 +2,4 @@ WARNING: issue-141b.pdf: can't find PDF header | ||
| 2 | WARNING: issue-141b.pdf: file is damaged | 2 | WARNING: issue-141b.pdf: file is damaged |
| 3 | WARNING: issue-141b.pdf (offset 7): xref not found | 3 | WARNING: issue-141b.pdf (offset 7): xref not found |
| 4 | WARNING: issue-141b.pdf: Attempting to reconstruct cross-reference table | 4 | WARNING: issue-141b.pdf: Attempting to reconstruct cross-reference table |
| 5 | -issue-141b.pdf: unable to find trailer dictionary while recovering damaged file | 5 | +qpdf: issue-141b.pdf: unable to find trailer dictionary while recovering damaged file |
qpdf/qtest/qpdf/issue-146.out
| @@ -2,4 +2,4 @@ WARNING: issue-146.pdf: file is damaged | @@ -2,4 +2,4 @@ WARNING: issue-146.pdf: file is damaged | ||
| 2 | WARNING: issue-146.pdf: can't find startxref | 2 | WARNING: issue-146.pdf: can't find startxref |
| 3 | WARNING: issue-146.pdf: Attempting to reconstruct cross-reference table | 3 | WARNING: issue-146.pdf: Attempting to reconstruct cross-reference table |
| 4 | WARNING: issue-146.pdf (trailer, offset 695): ignoring excessively deeply nested data structure | 4 | WARNING: issue-146.pdf (trailer, offset 695): ignoring excessively deeply nested data structure |
| 5 | -issue-146.pdf: unable to find trailer dictionary while recovering damaged file | 5 | +qpdf: issue-146.pdf: unable to find trailer dictionary while recovering damaged file |
qpdf/qtest/qpdf/issue-147.out
| @@ -5,4 +5,4 @@ WARNING: issue-147.pdf: Attempting to reconstruct cross-reference table | @@ -5,4 +5,4 @@ WARNING: issue-147.pdf: Attempting to reconstruct cross-reference table | ||
| 5 | WARNING: issue-147.pdf (trailer, offset 9): expected dictionary key but found non-name object; inserting key /QPDFFake1 | 5 | WARNING: issue-147.pdf (trailer, offset 9): expected dictionary key but found non-name object; inserting key /QPDFFake1 |
| 6 | WARNING: issue-147.pdf (object 62 0, offset 88): expected endobj | 6 | WARNING: issue-147.pdf (object 62 0, offset 88): expected endobj |
| 7 | WARNING: issue-147.pdf (trailer, offset 90): invalid /ID in trailer dictionary | 7 | WARNING: issue-147.pdf (trailer, offset 90): invalid /ID in trailer dictionary |
| 8 | -issue-147.pdf: invalid password | 8 | +qpdf: issue-147.pdf: invalid password |
qpdf/qtest/qpdf/issue-148.out
| @@ -7,4 +7,4 @@ WARNING: issue-148.pdf (offset 73): error decoding stream data for object 8 0: s | @@ -7,4 +7,4 @@ WARNING: issue-148.pdf (offset 73): error decoding stream data for object 8 0: s | ||
| 7 | WARNING: issue-148.pdf: file is damaged | 7 | WARNING: issue-148.pdf: file is damaged |
| 8 | WARNING: issue-148.pdf (offset 73): getStreamData called on unfilterable stream | 8 | WARNING: issue-148.pdf (offset 73): getStreamData called on unfilterable stream |
| 9 | WARNING: issue-148.pdf: Attempting to reconstruct cross-reference table | 9 | WARNING: issue-148.pdf: Attempting to reconstruct cross-reference table |
| 10 | -issue-148.pdf: unable to find trailer dictionary while recovering damaged file | 10 | +qpdf: issue-148.pdf: unable to find trailer dictionary while recovering damaged file |
qpdf/qtest/qpdf/issue-150.out
| @@ -2,4 +2,4 @@ WARNING: issue-150.pdf: can't find PDF header | @@ -2,4 +2,4 @@ WARNING: issue-150.pdf: can't find PDF header | ||
| 2 | WARNING: issue-150.pdf: file is damaged | 2 | WARNING: issue-150.pdf: file is damaged |
| 3 | WARNING: issue-150.pdf: error reading xref: overflow/underflow converting 9900000000000000000 to 64-bit integer | 3 | WARNING: issue-150.pdf: error reading xref: overflow/underflow converting 9900000000000000000 to 64-bit integer |
| 4 | WARNING: issue-150.pdf: Attempting to reconstruct cross-reference table | 4 | WARNING: issue-150.pdf: Attempting to reconstruct cross-reference table |
| 5 | -issue-150.pdf: unable to find trailer dictionary while recovering damaged file | 5 | +qpdf: issue-150.pdf: unable to find trailer dictionary while recovering damaged file |
qpdf/qtest/qpdf/issue-202.out
| @@ -3,4 +3,4 @@ WARNING: issue-202.pdf: file is damaged | @@ -3,4 +3,4 @@ WARNING: issue-202.pdf: file is damaged | ||
| 3 | WARNING: issue-202.pdf (offset 54769): expected trailer dictionary | 3 | WARNING: issue-202.pdf (offset 54769): expected trailer dictionary |
| 4 | WARNING: issue-202.pdf: Attempting to reconstruct cross-reference table | 4 | WARNING: issue-202.pdf: Attempting to reconstruct cross-reference table |
| 5 | WARNING: issue-202.pdf (trailer, offset 55770): ignoring excessively deeply nested data structure | 5 | WARNING: issue-202.pdf (trailer, offset 55770): ignoring excessively deeply nested data structure |
| 6 | -issue-202.pdf: unable to find trailer dictionary while recovering damaged file | 6 | +qpdf: issue-202.pdf: unable to find trailer dictionary while recovering damaged file |
qpdf/qtest/qpdf/issue-263.out
| @@ -9,4 +9,4 @@ WARNING: issue-263.pdf (trailer, offset 82): unexpected ) | @@ -9,4 +9,4 @@ WARNING: issue-263.pdf (trailer, offset 82): unexpected ) | ||
| 9 | WARNING: issue-263.pdf (trailer, offset 83): unknown token while reading object; treating as string | 9 | WARNING: issue-263.pdf (trailer, offset 83): unknown token while reading object; treating as string |
| 10 | WARNING: issue-263.pdf (trailer, offset 87): unexpected > | 10 | WARNING: issue-263.pdf (trailer, offset 87): unexpected > |
| 11 | WARNING: issue-263.pdf (trailer, offset 87): too many errors; giving up on reading object | 11 | WARNING: issue-263.pdf (trailer, offset 87): too many errors; giving up on reading object |
| 12 | -issue-263.pdf: unable to find trailer dictionary while recovering damaged file | 12 | +qpdf: issue-263.pdf: unable to find trailer dictionary while recovering damaged file |
qpdf/qtest/qpdf/issue-335a.out
| @@ -1313,4 +1313,4 @@ WARNING: issue-335a.pdf (object 5 0, offset 23485): attempting to recover stream | @@ -1313,4 +1313,4 @@ WARNING: issue-335a.pdf (object 5 0, offset 23485): attempting to recover stream | ||
| 1313 | WARNING: issue-335a.pdf (object 5 0, offset 23485): unable to recover stream data; treating stream as empty | 1313 | WARNING: issue-335a.pdf (object 5 0, offset 23485): unable to recover stream data; treating stream as empty |
| 1314 | WARNING: issue-335a.pdf (object 5 0, offset 24974): expected endobj | 1314 | WARNING: issue-335a.pdf (object 5 0, offset 24974): expected endobj |
| 1315 | WARNING: issue-335a.pdf (object 5 0, offset 24974): EOF after endobj | 1315 | WARNING: issue-335a.pdf (object 5 0, offset 24974): EOF after endobj |
| 1316 | -issue-335a.pdf (offset 24974): unable to find /Root dictionary | 1316 | +qpdf: issue-335a.pdf (offset 24974): unable to find /Root dictionary |
qpdf/qtest/qpdf/issue-335b.out
| @@ -2,4 +2,4 @@ WARNING: issue-335b.pdf: can't find PDF header | @@ -2,4 +2,4 @@ WARNING: issue-335b.pdf: can't find PDF header | ||
| 2 | WARNING: issue-335b.pdf: file is damaged | 2 | WARNING: issue-335b.pdf: file is damaged |
| 3 | WARNING: issue-335b.pdf (xref table, offset 23): invalid xref entry (obj=6) | 3 | WARNING: issue-335b.pdf (xref table, offset 23): invalid xref entry (obj=6) |
| 4 | WARNING: issue-335b.pdf: Attempting to reconstruct cross-reference table | 4 | WARNING: issue-335b.pdf: Attempting to reconstruct cross-reference table |
| 5 | -issue-335b.pdf: unable to find trailer dictionary while recovering damaged file | 5 | +qpdf: issue-335b.pdf: unable to find trailer dictionary while recovering damaged file |
qpdf/qtest/qpdf/issue-99.out
| 1 | WARNING: issue-99.pdf: file is damaged | 1 | WARNING: issue-99.pdf: file is damaged |
| 2 | WARNING: issue-99.pdf (offset 3526): xref not found | 2 | WARNING: issue-99.pdf (offset 3526): xref not found |
| 3 | WARNING: issue-99.pdf: Attempting to reconstruct cross-reference table | 3 | WARNING: issue-99.pdf: Attempting to reconstruct cross-reference table |
| 4 | -issue-99.pdf (offset 4798): unable to find /Root dictionary | 4 | +qpdf: issue-99.pdf (offset 4798): unable to find /Root dictionary |
qpdf/qtest/qpdf/issue-99b.out
| @@ -2,4 +2,4 @@ WARNING: issue-99b.pdf: file is damaged | @@ -2,4 +2,4 @@ WARNING: issue-99b.pdf: file is damaged | ||
| 2 | WARNING: issue-99b.pdf (object 1 0, offset 9): object with ID 0 | 2 | WARNING: issue-99b.pdf (object 1 0, offset 9): object with ID 0 |
| 3 | WARNING: issue-99b.pdf: Attempting to reconstruct cross-reference table | 3 | WARNING: issue-99b.pdf: Attempting to reconstruct cross-reference table |
| 4 | WARNING: issue-99b.pdf: object 1 0 not found in file after regenerating cross reference table | 4 | WARNING: issue-99b.pdf: object 1 0 not found in file after regenerating cross reference table |
| 5 | -issue-99b.pdf (offset 763): unable to find /Root dictionary | 5 | +qpdf: issue-99b.pdf (offset 763): unable to find /Root dictionary |