mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 19:08:59 +00:00
Ignore -- at the top level arg parser (fixes #652)
This was unintended behavior that was added back for backward compatibility. It is intentionally undocumented.
This commit is contained in:
parent
19608ec151
commit
fbd3e56da7
@ -1,5 +1,8 @@
|
|||||||
2022-02-15 Jay Berkenbilt <ejb@ql.org>
|
2022-02-15 Jay Berkenbilt <ejb@ql.org>
|
||||||
|
|
||||||
|
* Bug fix: 10.6.0 inadvertently removed an unknown/undocumented
|
||||||
|
CLI parsing feature, which has been restored in 10.6.2. Fixes #652.
|
||||||
|
|
||||||
* Don't map 0x18 through 0x1f, 0x7f, 0x9f, or 0xad as fixed points
|
* Don't map 0x18 through 0x1f, 0x7f, 0x9f, or 0xad as fixed points
|
||||||
when transcoding UTF-8 to PDFDoc. These codepoints have different
|
when transcoding UTF-8 to PDFDoc. These codepoints have different
|
||||||
meanings in those two encoding systems. Fixes #650.
|
meanings in those two encoding systems. Fixes #650.
|
||||||
|
@ -554,8 +554,7 @@ QPDFArgParser::parseArgs()
|
|||||||
bool have_parameter = false;
|
bool have_parameter = false;
|
||||||
std::string o_arg(arg);
|
std::string o_arg(arg);
|
||||||
std::string arg_s(arg);
|
std::string arg_s(arg);
|
||||||
if ((strcmp(arg, "--") == 0) &&
|
if (strcmp(arg, "--") == 0)
|
||||||
(this->m->option_table != &this->m->main_option_table))
|
|
||||||
{
|
{
|
||||||
// Special case for -- option, which is used to break out
|
// Special case for -- option, which is used to break out
|
||||||
// of subparsers.
|
// of subparsers.
|
||||||
|
@ -67,6 +67,11 @@ ArgParser::initOptionTables()
|
|||||||
this->ap.addFinalCheck([this](){c_main->checkConfiguration();});
|
this->ap.addFinalCheck([this](){c_main->checkConfiguration();});
|
||||||
// add_help is defined in auto_job_help.hh
|
// add_help is defined in auto_job_help.hh
|
||||||
add_help(this->ap);
|
add_help(this->ap);
|
||||||
|
// Special case: ignore -- at the top level. This undocumented
|
||||||
|
// behavior is for backward compatibility; it was unintentionally
|
||||||
|
// the case prior to 10.6, and some users were relying on it.
|
||||||
|
this->ap.selectMainOptionTable();
|
||||||
|
this->ap.addBare("--", [](){});
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -149,7 +149,7 @@ foreach my $c (@completion_tests)
|
|||||||
show_ntests();
|
show_ntests();
|
||||||
# ----------
|
# ----------
|
||||||
$td->notify("--- Argument Parsing ---");
|
$td->notify("--- Argument Parsing ---");
|
||||||
$n_tests += 12;
|
$n_tests += 13;
|
||||||
|
|
||||||
$td->runtest("required argument",
|
$td->runtest("required argument",
|
||||||
{$td->COMMAND => "qpdf --password minimal.pdf"},
|
{$td->COMMAND => "qpdf --password minimal.pdf"},
|
||||||
@ -211,6 +211,14 @@ $td->runtest("duplicated pages password",
|
|||||||
{$td->REGEXP => ".*password already specified.*",
|
{$td->REGEXP => ".*password already specified.*",
|
||||||
$td->EXIT_STATUS => 2},
|
$td->EXIT_STATUS => 2},
|
||||||
$td->NORMALIZE_NEWLINES);
|
$td->NORMALIZE_NEWLINES);
|
||||||
|
# Ignoring -- at the top level was never intended but turned out to
|
||||||
|
# have been there for a long time so that people relied on it. It is
|
||||||
|
# intentionally not documented.
|
||||||
|
$td->runtest("ignore -- at top level",
|
||||||
|
{$td->COMMAND => "qpdf -- --check -- minimal.pdf --"},
|
||||||
|
{$td->REGEXP => ".*No syntax or stream encoding errors found.*",
|
||||||
|
$td->EXIT_STATUS => 0},
|
||||||
|
$td->NORMALIZE_NEWLINES);
|
||||||
|
|
||||||
show_ntests();
|
show_ntests();
|
||||||
# ----------
|
# ----------
|
||||||
|
Loading…
Reference in New Issue
Block a user