2
1
mirror of https://github.com/qpdf/qpdf.git synced 2025-02-02 20:08:24 +00:00

Prefix program name before exception message in qpdf CLI

This commit is contained in:
Jay Berkenbilt 2022-01-03 09:44:36 -05:00
parent 2c29a039cb
commit 8c718b7e6f
16 changed files with 21 additions and 20 deletions

View File

@ -6057,7 +6057,7 @@ int realmain(int argc, char* argv[])
} }
catch (std::exception& e) catch (std::exception& e)
{ {
std::cerr << e.what() << std::endl; std::cerr << whoami << ": " << e.what() << std::endl;
return EXIT_ERROR; return EXIT_ERROR;
} }

View File

@ -3494,7 +3494,7 @@ foreach my $d ('nn', 'ny', 'yn', 'yy')
$td->runtest("deterministic ID with encryption", $td->runtest("deterministic ID with encryption",
{$td->COMMAND => "qpdf -deterministic-id encrypted-with-images.pdf a.pdf"}, {$td->COMMAND => "qpdf -deterministic-id encrypted-with-images.pdf a.pdf"},
{$td->STRING => "INTERNAL ERROR: QPDFWriter::generateID" . {$td->STRING => "qpdf: INTERNAL ERROR: QPDFWriter::generateID" .
" has no data for deterministic ID." . " has no data for deterministic ID." .
" This may happen if deterministic ID and" . " This may happen if deterministic ID and" .
" file encryption are requested together.\n", " file encryption are requested together.\n",
@ -4272,7 +4272,8 @@ $td->runtest("non-encrypted",
$td->runtest("invalid password", $td->runtest("invalid password",
{$td->COMMAND => "qpdf -qdf --password=quack" . {$td->COMMAND => "qpdf -qdf --password=quack" .
" enc-R2,V1,U=view,O=view.pdf a.qdf"}, " enc-R2,V1,U=view,O=view.pdf a.qdf"},
{$td->STRING => "enc-R2,V1,U=view,O=view.pdf: invalid password\n", {$td->STRING =>
"qpdf: enc-R2,V1,U=view,O=view.pdf: invalid password\n",
$td->EXIT_STATUS => 2}, $td->EXIT_STATUS => 2},
$td->NORMALIZE_NEWLINES); $td->NORMALIZE_NEWLINES);
$td->runtest("C API: invalid password", $td->runtest("C API: invalid password",
@ -4740,7 +4741,7 @@ foreach my $d (@unicode_pw_cases)
my $exp = ''; my $exp = '';
if (ref($decode_cases) ne 'ARRAY') if (ref($decode_cases) ne 'ARRAY')
{ {
$exp = $decode_cases; $exp = "qpdf: $decode_cases";
$decode_cases = []; $decode_cases = [];
} }
$td->runtest("encode $bits, $pw, $w_encoding", $td->runtest("encode $bits, $pw, $w_encoding",
@ -4762,7 +4763,7 @@ foreach my $d (@unicode_pw_cases)
$r_output .= "trying other\n" if $tried_others; $r_output .= "trying other\n" if $tried_others;
if ($xfail) if ($xfail)
{ {
$r_output .= "a.pdf: invalid password\n"; $r_output .= "qpdf: a.pdf: invalid password\n";
} }
else else
{ {

View File

@ -14,4 +14,4 @@ WARNING: issue-100.pdf (object 5 0, offset 489): attempting to recover stream le
WARNING: issue-100.pdf (object 5 0, offset 489): recovered stream length: 12 WARNING: issue-100.pdf (object 5 0, offset 489): recovered stream length: 12
WARNING: issue-100.pdf (trailer, offset 953): expected dictionary key but found non-name object; inserting key /QPDFFake1 WARNING: issue-100.pdf (trailer, offset 953): expected dictionary key but found non-name object; inserting key /QPDFFake1
WARNING: issue-100.pdf (trailer, offset 953): dictionary ended prematurely; using null as value for last key WARNING: issue-100.pdf (trailer, offset 953): dictionary ended prematurely; using null as value for last key
issue-100.pdf (offset 1144): unable to find /Root dictionary qpdf: issue-100.pdf (offset 1144): unable to find /Root dictionary

View File

@ -40,4 +40,4 @@ WARNING: issue-101.pdf (object 11 0, offset 639): unknown token while reading ob
WARNING: issue-101.pdf (object 11 0, offset 644): unknown token while reading object; treating as string WARNING: issue-101.pdf (object 11 0, offset 644): unknown token while reading object; treating as string
WARNING: issue-101.pdf (object 11 0, offset 644): too many errors; giving up on reading object WARNING: issue-101.pdf (object 11 0, offset 644): too many errors; giving up on reading object
WARNING: issue-101.pdf (object 11 0, offset 647): expected endobj WARNING: issue-101.pdf (object 11 0, offset 647): expected endobj
issue-101.pdf (offset 687): unable to find /Root dictionary qpdf: issue-101.pdf (offset 687): unable to find /Root dictionary

View File

@ -5,4 +5,4 @@ WARNING: issue-141a.pdf (xref stream: object 9 0, offset 47): unable to recover
WARNING: issue-141a.pdf: file is damaged WARNING: issue-141a.pdf: file is damaged
WARNING: issue-141a.pdf (xref stream, offset 3): Cross-reference stream's /W indicates entry size of 0 WARNING: issue-141a.pdf (xref stream, offset 3): Cross-reference stream's /W indicates entry size of 0
WARNING: issue-141a.pdf: Attempting to reconstruct cross-reference table WARNING: issue-141a.pdf: Attempting to reconstruct cross-reference table
issue-141a.pdf: unable to find trailer dictionary while recovering damaged file qpdf: issue-141a.pdf: unable to find trailer dictionary while recovering damaged file

View File

@ -2,4 +2,4 @@ WARNING: issue-141b.pdf: can't find PDF header
WARNING: issue-141b.pdf: file is damaged WARNING: issue-141b.pdf: file is damaged
WARNING: issue-141b.pdf (offset 7): xref not found WARNING: issue-141b.pdf (offset 7): xref not found
WARNING: issue-141b.pdf: Attempting to reconstruct cross-reference table WARNING: issue-141b.pdf: Attempting to reconstruct cross-reference table
issue-141b.pdf: unable to find trailer dictionary while recovering damaged file qpdf: issue-141b.pdf: unable to find trailer dictionary while recovering damaged file

View File

@ -2,4 +2,4 @@ WARNING: issue-146.pdf: file is damaged
WARNING: issue-146.pdf: can't find startxref WARNING: issue-146.pdf: can't find startxref
WARNING: issue-146.pdf: Attempting to reconstruct cross-reference table WARNING: issue-146.pdf: Attempting to reconstruct cross-reference table
WARNING: issue-146.pdf (trailer, offset 695): ignoring excessively deeply nested data structure WARNING: issue-146.pdf (trailer, offset 695): ignoring excessively deeply nested data structure
issue-146.pdf: unable to find trailer dictionary while recovering damaged file qpdf: issue-146.pdf: unable to find trailer dictionary while recovering damaged file

View File

@ -5,4 +5,4 @@ WARNING: issue-147.pdf: Attempting to reconstruct cross-reference table
WARNING: issue-147.pdf (trailer, offset 9): expected dictionary key but found non-name object; inserting key /QPDFFake1 WARNING: issue-147.pdf (trailer, offset 9): expected dictionary key but found non-name object; inserting key /QPDFFake1
WARNING: issue-147.pdf (object 62 0, offset 88): expected endobj WARNING: issue-147.pdf (object 62 0, offset 88): expected endobj
WARNING: issue-147.pdf (trailer, offset 90): invalid /ID in trailer dictionary WARNING: issue-147.pdf (trailer, offset 90): invalid /ID in trailer dictionary
issue-147.pdf: invalid password qpdf: issue-147.pdf: invalid password

View File

@ -7,4 +7,4 @@ WARNING: issue-148.pdf (offset 73): error decoding stream data for object 8 0: s
WARNING: issue-148.pdf: file is damaged WARNING: issue-148.pdf: file is damaged
WARNING: issue-148.pdf (offset 73): getStreamData called on unfilterable stream WARNING: issue-148.pdf (offset 73): getStreamData called on unfilterable stream
WARNING: issue-148.pdf: Attempting to reconstruct cross-reference table WARNING: issue-148.pdf: Attempting to reconstruct cross-reference table
issue-148.pdf: unable to find trailer dictionary while recovering damaged file qpdf: issue-148.pdf: unable to find trailer dictionary while recovering damaged file

View File

@ -2,4 +2,4 @@ WARNING: issue-150.pdf: can't find PDF header
WARNING: issue-150.pdf: file is damaged WARNING: issue-150.pdf: file is damaged
WARNING: issue-150.pdf: error reading xref: overflow/underflow converting 9900000000000000000 to 64-bit integer WARNING: issue-150.pdf: error reading xref: overflow/underflow converting 9900000000000000000 to 64-bit integer
WARNING: issue-150.pdf: Attempting to reconstruct cross-reference table WARNING: issue-150.pdf: Attempting to reconstruct cross-reference table
issue-150.pdf: unable to find trailer dictionary while recovering damaged file qpdf: issue-150.pdf: unable to find trailer dictionary while recovering damaged file

View File

@ -3,4 +3,4 @@ WARNING: issue-202.pdf: file is damaged
WARNING: issue-202.pdf (offset 54769): expected trailer dictionary WARNING: issue-202.pdf (offset 54769): expected trailer dictionary
WARNING: issue-202.pdf: Attempting to reconstruct cross-reference table WARNING: issue-202.pdf: Attempting to reconstruct cross-reference table
WARNING: issue-202.pdf (trailer, offset 55770): ignoring excessively deeply nested data structure WARNING: issue-202.pdf (trailer, offset 55770): ignoring excessively deeply nested data structure
issue-202.pdf: unable to find trailer dictionary while recovering damaged file qpdf: issue-202.pdf: unable to find trailer dictionary while recovering damaged file

View File

@ -9,4 +9,4 @@ WARNING: issue-263.pdf (trailer, offset 82): unexpected )
WARNING: issue-263.pdf (trailer, offset 83): unknown token while reading object; treating as string WARNING: issue-263.pdf (trailer, offset 83): unknown token while reading object; treating as string
WARNING: issue-263.pdf (trailer, offset 87): unexpected > WARNING: issue-263.pdf (trailer, offset 87): unexpected >
WARNING: issue-263.pdf (trailer, offset 87): too many errors; giving up on reading object WARNING: issue-263.pdf (trailer, offset 87): too many errors; giving up on reading object
issue-263.pdf: unable to find trailer dictionary while recovering damaged file qpdf: issue-263.pdf: unable to find trailer dictionary while recovering damaged file

View File

@ -1313,4 +1313,4 @@ WARNING: issue-335a.pdf (object 5 0, offset 23485): attempting to recover stream
WARNING: issue-335a.pdf (object 5 0, offset 23485): unable to recover stream data; treating stream as empty WARNING: issue-335a.pdf (object 5 0, offset 23485): unable to recover stream data; treating stream as empty
WARNING: issue-335a.pdf (object 5 0, offset 24974): expected endobj WARNING: issue-335a.pdf (object 5 0, offset 24974): expected endobj
WARNING: issue-335a.pdf (object 5 0, offset 24974): EOF after endobj WARNING: issue-335a.pdf (object 5 0, offset 24974): EOF after endobj
issue-335a.pdf (offset 24974): unable to find /Root dictionary qpdf: issue-335a.pdf (offset 24974): unable to find /Root dictionary

View File

@ -2,4 +2,4 @@ WARNING: issue-335b.pdf: can't find PDF header
WARNING: issue-335b.pdf: file is damaged WARNING: issue-335b.pdf: file is damaged
WARNING: issue-335b.pdf (xref table, offset 23): invalid xref entry (obj=6) WARNING: issue-335b.pdf (xref table, offset 23): invalid xref entry (obj=6)
WARNING: issue-335b.pdf: Attempting to reconstruct cross-reference table WARNING: issue-335b.pdf: Attempting to reconstruct cross-reference table
issue-335b.pdf: unable to find trailer dictionary while recovering damaged file qpdf: issue-335b.pdf: unable to find trailer dictionary while recovering damaged file

View File

@ -1,4 +1,4 @@
WARNING: issue-99.pdf: file is damaged WARNING: issue-99.pdf: file is damaged
WARNING: issue-99.pdf (offset 3526): xref not found WARNING: issue-99.pdf (offset 3526): xref not found
WARNING: issue-99.pdf: Attempting to reconstruct cross-reference table WARNING: issue-99.pdf: Attempting to reconstruct cross-reference table
issue-99.pdf (offset 4798): unable to find /Root dictionary qpdf: issue-99.pdf (offset 4798): unable to find /Root dictionary

View File

@ -2,4 +2,4 @@ WARNING: issue-99b.pdf: file is damaged
WARNING: issue-99b.pdf (object 1 0, offset 9): object with ID 0 WARNING: issue-99b.pdf (object 1 0, offset 9): object with ID 0
WARNING: issue-99b.pdf: Attempting to reconstruct cross-reference table WARNING: issue-99b.pdf: Attempting to reconstruct cross-reference table
WARNING: issue-99b.pdf: object 1 0 not found in file after regenerating cross reference table WARNING: issue-99b.pdf: object 1 0 not found in file after regenerating cross reference table
issue-99b.pdf (offset 763): unable to find /Root dictionary qpdf: issue-99b.pdf (offset 763): unable to find /Root dictionary