mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 02:49:00 +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>
|
||||
|
||||
* 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
|
||||
when transcoding UTF-8 to PDFDoc. These codepoints have different
|
||||
meanings in those two encoding systems. Fixes #650.
|
||||
|
@ -554,8 +554,7 @@ QPDFArgParser::parseArgs()
|
||||
bool have_parameter = false;
|
||||
std::string o_arg(arg);
|
||||
std::string arg_s(arg);
|
||||
if ((strcmp(arg, "--") == 0) &&
|
||||
(this->m->option_table != &this->m->main_option_table))
|
||||
if (strcmp(arg, "--") == 0)
|
||||
{
|
||||
// Special case for -- option, which is used to break out
|
||||
// of subparsers.
|
||||
|
@ -67,6 +67,11 @@ ArgParser::initOptionTables()
|
||||
this->ap.addFinalCheck([this](){c_main->checkConfiguration();});
|
||||
// add_help is defined in auto_job_help.hh
|
||||
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
|
||||
|
@ -149,7 +149,7 @@ foreach my $c (@completion_tests)
|
||||
show_ntests();
|
||||
# ----------
|
||||
$td->notify("--- Argument Parsing ---");
|
||||
$n_tests += 12;
|
||||
$n_tests += 13;
|
||||
|
||||
$td->runtest("required argument",
|
||||
{$td->COMMAND => "qpdf --password minimal.pdf"},
|
||||
@ -211,6 +211,14 @@ $td->runtest("duplicated pages password",
|
||||
{$td->REGEXP => ".*password already specified.*",
|
||||
$td->EXIT_STATUS => 2},
|
||||
$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();
|
||||
# ----------
|
||||
|
Loading…
Reference in New Issue
Block a user