Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ban "[" and "]" in plan names #832

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Revision history for Perl extension App::Sqitch
1.4.2
- Fix improperly nested Pod headers that were incrementing two levels
relative to their parent headers.
- Banned "[" and "]" in names (changes, tags, projects) because they
muck with dependency parsing of the plan file. Thanks to Žiga Leber for
the bug report (#829).

1.4.1 2024-02-04T16:35:32Z
- Removed the quoting of the role and warehouse identifiers that was
Expand Down
2 changes: 1 addition & 1 deletion lib/App/Sqitch/Command/init.pm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ sub _validate_project {
my $name_re = 'App::Sqitch::Plan'->name_regex;
hurl init => __x(
qq{invalid project name "{project}": project names must not }
. 'begin with punctuation, contain "@", ":", "#", or blanks, or end in '
. 'begin with punctuation, contain "@", ":", "#", "[", "]", or blanks, or end in '
. 'punctuation or digits following punctuation',
project => $project
) unless $project =~ /\A$name_re\z/;
Expand Down
10 changes: 5 additions & 5 deletions lib/App/Sqitch/Plan.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ my $name_re = qr{
(?![$punct]) # first character isn't punctuation
(?: # start non-capturing group, repeated once or more ...
(?! # negative look ahead for...
[~/=%^] # symbolic reference punctuation
[~/=%^\[\]] # symbolic reference punctuation
[[:digit:]]+ # digits
(?:$|[[:blank:]]) # eol or blank
) # ...
Expand Down Expand Up @@ -237,7 +237,7 @@ sub _parse {
my $proj = $+{value};
$raise_syntax_error->(__x(
qq{invalid project name "{project}": project names must not }
. 'begin with punctuation, contain "@", ":", "#", "\\", or blanks, '
. 'begin with punctuation, contain "@", ":", "#", "\\", "[", "]", or blanks, '
. 'or end in punctuation or digits following punctuation',
project => $proj,
)) unless $proj =~ /\A$name_re\z/;
Expand Down Expand Up @@ -318,7 +318,7 @@ sub _parse {
# Raise errors for missing data.
$raise_syntax_error->(__(
qq{Invalid name; names must not begin with punctuation, }
. 'contain "@", ":", "#", "\\", or blanks, or end in punctuation or digits following punctuation',
. 'contain "@", ":", "#", "\\", "[", "]", or blanks, or end in punctuation or digits following punctuation',
)) if !$params{name}
|| (!$params{yr} && $line =~ $ts_re);

Expand Down Expand Up @@ -916,13 +916,13 @@ sub _is_valid {
if ($type eq 'change' && $name !~ /\A$name_re\z/) {
hurl plan => __x(
qq{"{name}" is invalid: changes must not begin with punctuation, }
. 'contain "@", ":", "#", "\\", or blanks, or end in punctuation or digits following punctuation',
. 'contain "@", ":", "#", "\\", "[", "]", or blanks, or end in punctuation or digits following punctuation',
name => $name,
);
} elsif ($type eq 'tag' && ($name !~ /\A$name_re\z/ || $name =~ $dir_sep_re)) {
hurl plan => __x(
qq{"{name}" is invalid: tags must not begin with punctuation, }
. 'contain "@", ":", "#", "/", "\\", or blanks, or end in punctuation or digits following punctuation',
. 'contain "@", ":", "#", "/", "\\", "[", "]", or blanks, or end in punctuation or digits following punctuation',
name => $name,
);
}
Expand Down
10 changes: 5 additions & 5 deletions po/App-Sqitch.pot
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ msgstr ""
#, perl-brace-format
msgid ""
"invalid project name \"{project}\": project names must not begin with "
"punctuation, contain \"@\", \":\", \"#\", or blanks, or end in punctuation "
"punctuation, contain \"@\", \":\", \"#\", "[", "]", or blanks, or end in punctuation "
"or digits following punctuation"
msgstr ""

Expand Down Expand Up @@ -1205,7 +1205,7 @@ msgstr ""
#, perl-brace-format
msgid ""
"invalid project name \"{project}\": project names must not begin with "
"punctuation, contain \"@\", \":\", \"#\", \"\\\", or blanks, or end in "
"punctuation, contain \"@\", \":\", \"#\", \"\\\", "[", "]", or blanks, or end in "
"punctuation or digits following punctuation"
msgstr ""

Expand All @@ -1217,7 +1217,7 @@ msgstr ""
#: lib/App/Sqitch/Plan.pm:320
msgid ""
"Invalid name; names must not begin with punctuation, contain \"@\", \":\", "
"\"#\", \"\\\", or blanks, or end in punctuation or digits following "
"\"#\", \"\\\", "[", "]", or blanks, or end in punctuation or digits following "
"punctuation"
msgstr ""

Expand Down Expand Up @@ -1362,15 +1362,15 @@ msgstr ""
#, perl-brace-format
msgid ""
"\"{name}\" is invalid: changes must not begin with punctuation, contain "
"\"@\", \":\", \"#\", \"\\\", or blanks, or end in punctuation or digits "
"\"@\", \":\", \"#\", \"\\\", "[", "]", or blanks, or end in punctuation or digits "
"following punctuation"
msgstr ""

#: lib/App/Sqitch/Plan.pm:924
#, perl-brace-format
msgid ""
"\"{name}\" is invalid: tags must not begin with punctuation, contain \"@\", "
"\":\", \"#\", \"/\", \"\\\", or blanks, or end in punctuation or digits "
"\":\", \"#\", \"/\", \"\\\", "[", "]", or blanks, or end in punctuation or digits "
"following punctuation"
msgstr ""

Expand Down
10 changes: 5 additions & 5 deletions po/de_DE.po
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ msgstr "Kein Hilfeeintrag für {command} verfügbar"
#, perl-brace-format
msgid ""
"invalid project name \"{project}\": project names must not begin with "
"punctuation, contain \"@\", \":\", \"#\", or blanks, or end in punctuation "
"punctuation, contain \"@\", \":\", \"#\", "[", "]", or blanks, or end in punctuation "
"or digits following punctuation"
msgstr ""
"Ungültiger Projektname \"{project}\". Projektnamen dürfen nicht mit "
Expand Down Expand Up @@ -1275,7 +1275,7 @@ msgstr ""
#, fuzzy, perl-brace-format
msgid ""
"invalid project name \"{project}\": project names must not begin with "
"punctuation, contain \"@\", \":\", \"#\", \"\\\", or blanks, or end in "
"punctuation, contain \"@\", \":\", \"#\", \"\\\", "[", "]", or blanks, or end in "
"punctuation or digits following punctuation"
msgstr ""
"Ungültiger Projektname \"{project}\". Projektnamen dürfen nicht mit "
Expand All @@ -1292,7 +1292,7 @@ msgstr "Fehlendes %project Pragma in {file}"
#, fuzzy
msgid ""
"Invalid name; names must not begin with punctuation, contain \"@\", \":\", "
"\"#\", \"\\\", or blanks, or end in punctuation or digits following "
"\"#\", \"\\\", "[", "]", or blanks, or end in punctuation or digits following "
"punctuation"
msgstr ""
"Ungültiger Name. Namen dürfen nicht mit Satzzeichen beginnen, \"@\", \":\", "
Expand Down Expand Up @@ -1455,7 +1455,7 @@ msgstr ""
#, fuzzy, perl-brace-format
msgid ""
"\"{name}\" is invalid: changes must not begin with punctuation, contain "
"\"@\", \":\", \"#\", \"\\\", or blanks, or end in punctuation or digits "
"\"@\", \":\", \"#\", \"\\\", "[", "]", or blanks, or end in punctuation or digits "
"following punctuation"
msgstr ""
"\"{name}\" ist ungültig. Änderungen dürfen nicht mit Satzzeichen beginnen, "
Expand All @@ -1466,7 +1466,7 @@ msgstr ""
#, fuzzy, perl-brace-format
msgid ""
"\"{name}\" is invalid: tags must not begin with punctuation, contain \"@\", "
"\":\", \"#\", \"/\", \"\\\", or blanks, or end in punctuation or digits "
"\":\", \"#\", \"/\", \"\\\", "[", "]", or blanks, or end in punctuation or digits "
"following punctuation"
msgstr ""
"\"{name}\" ist ungültig. Tags dürfen nicht mit Satzzeichen beginnen, \"@\", "
Expand Down
10 changes: 5 additions & 5 deletions po/fr_FR.po
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ msgstr "Pas d'entrée dans le manuel pour {command}"
#, fuzzy, perl-brace-format
msgid ""
"invalid project name \"{project}\": project names must not begin with "
"punctuation, contain \"@\", \":\", \"#\", or blanks, or end in punctuation "
"punctuation, contain \"@\", \":\", \"#\", "[", "]", or blanks, or end in punctuation "
"or digits following punctuation"
msgstr ""
"nom de projet invalide \"{project}\" : les noms de projets ne doivent pas "
Expand Down Expand Up @@ -1233,7 +1233,7 @@ msgstr ""
#, fuzzy, perl-brace-format
msgid ""
"invalid project name \"{project}\": project names must not begin with "
"punctuation, contain \"@\", \":\", \"#\", \"\\\", or blanks, or end in "
"punctuation, contain \"@\", \":\", \"#\", \"\\\", "[", "]", or blanks, or end in "
"punctuation or digits following punctuation"
msgstr ""
"nom de projet invalide \"{project}\" : les noms de projets ne doivent pas "
Expand All @@ -1249,7 +1249,7 @@ msgstr "Pragma %project absent dans {file}"
#, fuzzy
msgid ""
"Invalid name; names must not begin with punctuation, contain \"@\", \":\", "
"\"#\", \"\\\", or blanks, or end in punctuation or digits following "
"\"#\", \"\\\", "[", "]", or blanks, or end in punctuation or digits following "
"punctuation"
msgstr ""
"Nom invalide; les noms ne doivent pas commencer par de la ponctuation, "
Expand Down Expand Up @@ -1414,7 +1414,7 @@ msgstr ""
#, fuzzy, perl-brace-format
msgid ""
"\"{name}\" is invalid: changes must not begin with punctuation, contain "
"\"@\", \":\", \"#\", \"\\\", or blanks, or end in punctuation or digits "
"\"@\", \":\", \"#\", \"\\\", "[", "]", or blanks, or end in punctuation or digits "
"following punctuation"
msgstr ""
"\"{name}\" est invalide : les changements ne doivent pas commencer par de la "
Expand All @@ -1425,7 +1425,7 @@ msgstr ""
#, fuzzy, perl-brace-format
msgid ""
"\"{name}\" is invalid: tags must not begin with punctuation, contain \"@\", "
"\":\", \"#\", \"/\", \"\\\", or blanks, or end in punctuation or digits "
"\":\", \"#\", \"/\", \"\\\", "[", "]", or blanks, or end in punctuation or digits "
"following punctuation"
msgstr ""
"\"{name}\" est invalide : les étiquettes ne doivent pas commencer par de la "
Expand Down
10 changes: 5 additions & 5 deletions po/it_IT.po
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ msgstr "Non trovo {command} nel manuale"
#, perl-brace-format
msgid ""
"invalid project name \"{project}\": project names must not begin with "
"punctuation, contain \"@\", \":\", \"#\", or blanks, or end in punctuation "
"punctuation, contain \"@\", \":\", \"#\", "[", "]", or blanks, or end in punctuation "
"or digits following punctuation"
msgstr ""
"Il nome di progetto \"{project}\" non è valido: i nomi di progetto non "
Expand Down Expand Up @@ -1261,7 +1261,7 @@ msgstr ""
#, fuzzy, perl-brace-format
msgid ""
"invalid project name \"{project}\": project names must not begin with "
"punctuation, contain \"@\", \":\", \"#\", \"\\\", or blanks, or end in "
"punctuation, contain \"@\", \":\", \"#\", \"\\\", "[", "]", or blanks, or end in "
"punctuation or digits following punctuation"
msgstr ""
"Il nome di progetto \"{project}\" non è valido: i nomi di progetto non "
Expand All @@ -1278,7 +1278,7 @@ msgstr "Pragma %project mancante in {file}"
#, fuzzy
msgid ""
"Invalid name; names must not begin with punctuation, contain \"@\", \":\", "
"\"#\", \"\\\", or blanks, or end in punctuation or digits following "
"\"#\", \"\\\", "[", "]", or blanks, or end in punctuation or digits following "
"punctuation"
msgstr ""
"Nome non valido; i nomi non devono cominciare con caratteri di "
Expand Down Expand Up @@ -1445,7 +1445,7 @@ msgstr ""
#, fuzzy, perl-brace-format
msgid ""
"\"{name}\" is invalid: changes must not begin with punctuation, contain "
"\"@\", \":\", \"#\", \"\\\", or blanks, or end in punctuation or digits "
"\"@\", \":\", \"#\", \"\\\", "[", "]", or blanks, or end in punctuation or digits "
"following punctuation"
msgstr ""
"\"{name}\" non è valido: le modifiche non devono iniziare con segni di "
Expand All @@ -1456,7 +1456,7 @@ msgstr ""
#, fuzzy, perl-brace-format
msgid ""
"\"{name}\" is invalid: tags must not begin with punctuation, contain \"@\", "
"\":\", \"#\", \"/\", \"\\\", or blanks, or end in punctuation or digits "
"\":\", \"#\", \"/\", \"\\\", "[", "]", or blanks, or end in punctuation or digits "
"following punctuation"
msgstr ""
"\"{name}\" non è valido: i tag non devono iniziare con segni di "
Expand Down
2 changes: 1 addition & 1 deletion t/init.t
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ for my $bad (@bad_names) {
is $@->ident, 'init', qq{Bad project "$bad" ident should be "init"};
is $@->message, __x(
qq{invalid project name "{project}": project names must not }
. 'begin with punctuation, contain "@", ":", "#", or blanks, or end in '
. 'begin with punctuation, contain "@", ":", "#", "[", "]", or blanks, or end in '
. 'punctuation or digits following punctuation',
project => $bad
), qq{Bad project "$bad" error message should be correct};
Expand Down
12 changes: 6 additions & 6 deletions t/plan.t
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ is $@->message, __x(
lineno => 5,
error => __(
qq{Invalid name; names must not begin with punctuation, }
. 'contain "@", ":", "#", "\\", or blanks, or end in punctuation or digits following punctuation',
. 'contain "@", ":", "#", "\\", "[", "]", or blanks, or end in punctuation or digits following punctuation',
),
), 'And the bad change name error message should be correct';

Expand Down Expand Up @@ -371,7 +371,7 @@ for my $name (@bad_names) {
lineno => 4,
error => __(
qq{Invalid name; names must not begin with punctuation, }
. 'contain "@", ":", "#", "\\", or blanks, or end in punctuation or digits following punctuation',
. 'contain "@", ":", "#", "\\", "[", "]", or blanks, or end in punctuation or digits following punctuation',
),
), qq{And "$line" should trigger the appropriate message};
is sorted, 0, 'Should not have sorted changes';
Expand Down Expand Up @@ -1220,7 +1220,7 @@ for my $name (@bad_names) {
is $@->ident, 'plan', qq{Invalid name "$name" error ident should be "plan"};
is $@->message, __x(
qq{"{name}" is invalid: tags must not begin with punctuation, }
. 'contain "@", ":", "#", "/", "\\", or blanks, or end in punctuation or digits following punctuation',
. 'contain "@", ":", "#", "/", "\\", "[", "]", or blanks, or end in punctuation or digits following punctuation',
name => $name,
), qq{And the "$name" error message should be correct};
}
Expand Down Expand Up @@ -1299,7 +1299,7 @@ for my $name (@bad_names, 'foo#bar', @bad_tags) {
is $@->ident, 'plan', qq{Invalid name "$name" error ident should be "plan"};
is $@->message, __x(
qq{"{name}" is invalid: tags must not begin with punctuation, }
. 'contain "@", ":", "#", "/", "\\", or blanks, or end in punctuation or digits following punctuation',
. 'contain "@", ":", "#", "/", "\\", "[", "]", or blanks, or end in punctuation or digits following punctuation',
name => $name,
), qq{And the "$name" error message should be correct};
}
Expand Down Expand Up @@ -1420,7 +1420,7 @@ for my $name (@bad_names) {
is $@->ident, 'plan', qq{Invalid name "$name" error ident should be "plan"};
is $@->message, __x(
qq{"{name}" is invalid: changes must not begin with punctuation, }
. 'contain "@", ":", "#", "\\", or blanks, or end in punctuation or digits following punctuation',
. 'contain "@", ":", "#", "\\", "[", "]", or blanks, or end in punctuation or digits following punctuation',
name => $name,
), qq{And the "$name" error message should be correct};
}
Expand Down Expand Up @@ -2047,7 +2047,7 @@ for my $bad (@bad_names) {
is $@->ident, 'parse', qq{Ident for bad proj "$bad" should be "parse"};
my $error = __x(
'invalid project name "{project}": project names must not '
. 'begin with punctuation, contain "@", ":", "#", "\\", or blanks, or end in '
. 'begin with punctuation, contain "@", ":", "#", "\\", "[", "]", or blanks, or end in '
. 'punctuation or digits following punctuation',
project => $bad);
is $@->message, __x(
Expand Down
Loading