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
Version control conflict markers #15294
Comments
From @epaCreated by @epaSometimes Perl code will appear to compile when there are git conflict I suggest adding explict detection of <<<<<<< ======= >>>>>>> as For C and C++ programs, the latest gcc now reports Perl Info
|
From @demerphqOn 26 April 2016 at 09:04, Ed Avis <perlbug-followup@perl.org> wrote:
++ Yves |
The RT System itself - Status changed from 'new' to 'open' |
From @kentfredricOn 26 April 2016 at 19:04, Ed Avis <perlbug-followup@perl.org> wrote:
A CPAN Grep says there's not a lot of risk for a mistake here, a <{5,90}.{0,500}={5,90} http://grep.cpan.me/?q=%3C{5%2C90}.{0%2C500}%3D{5%2C90} An Anchored CPAN Grep returns no results, suggesting its probably safe: ^<{5,90}.{0,500}^={5,90} http://grep.cpan.me/?q=^%3C{5%2C90}.{0%2C500}^%3D{5%2C90} Obviously, C has the Luxury that it doesn't have heredocs. But fortunately for us, <<<<<< Is parsed as <<"" <<"" <<"" Not <<"<<<<" So there's no risk of it being some weird heredoc side-effect either, The only thing I'd want to make sure of is how we handled embedded git -- KENTNL - https://metacpan.org/author/KENTNL |
From @epaI agree, the check would have to be only in code, not inside heredocs or As an additional precaution against false positives, these markers could Though I do feel in general that tokenization could be a bit stricter, -- |
From @cpansproutOn Tue Apr 26 02:01:25 2016, kentfredric@gmail.com wrote:
Actually <<"" << <<"". That’s a bitshift in the middle.
The best thing would be to handle this in yyerror, just the way we do ‘(Missing semicolon?)’. That way, it would never have false positives. -- Father Chrysostomos |
From @demerphqOn 27 April 2016 at 02:53, Father Chrysostomos via RT
Just thought someone should mention we can also check that the token my $x= <<<<<< bar continues to work just fine. |
From @maukeOn Tue Apr 26 00:04:31 2016, eda@waniasset.com wrote:
Patch attached. I followed gcc's example: + Specifically, we consider a run of 7 '<', '=' or '>' characters |
From @mauke0001-recognize-and-reject-version-control-conflict-marker.patchFrom ff34a3aa2e1c9a7ef41e1d49a3b978d0c6c21d35 Mon Sep 17 00:00:00 2001
From: Lukas Mai <l.mai@web.de>
Date: Sat, 21 May 2016 10:14:39 +0200
Subject: [PATCH] recognize and reject version control conflict markers (RT
#127993)
---
pod/perldiag.pod | 6 ++++++
t/comp/parser.t | 21 ++++++++++++++++++++-
toke.c | 11 ++++++++++-
3 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index 01f9e29..dc0e369 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -7072,6 +7072,12 @@ S<<-- HERE> in m/%s/
(F) You used a verb pattern that is not allowed an argument. Remove the
argument or check that you are using the right verb.
+=item Version control conflict marker '%s'
+
+(P) The parser found a line starting with C<E<lt><<<<<<>,
+C<E<gt>E<gt>E<gt>E<gt>E<gt>E<gt>E<gt>>, or C<=======>. These may be left by a
+version control system to mark conflicts after a failed merge operation.
+
=item Version number must be a constant number
(P) The attempt to translate a C<use Module n.n LIST> statement into
diff --git a/t/comp/parser.t b/t/comp/parser.t
index 50f601c..19d49f9 100644
--- a/t/comp/parser.t
+++ b/t/comp/parser.t
@@ -8,7 +8,7 @@ BEGIN {
chdir 't' if -d 't';
}
-print "1..173\n";
+print "1..182\n";
sub failed {
my ($got, $expected, $name) = @_;
@@ -546,6 +546,25 @@ eval "grep+grep";
eval 'qq{@{0]}${}},{})';
is(1, 1, "RT #124207");
+# RT #127993 version control conflict markers
+" this should keep working
+<<<<<<<
+" =~ /
+>>>>>>>
+/;
+for my $marker (qw(
+<<<<<<<
+=======
+>>>>>>>
+)) {
+ eval "$marker";
+ like $@, qr/^Version control conflict marker '$marker' at \(eval \d+\) line 1\./, "VCS marker '$marker' at beginning";
+ eval "\$_\n$marker";
+ like $@, qr/^Version control conflict marker '$marker' at \(eval \d+\) line 2\./, "VCS marker '$marker' after value";
+ eval "\n\$_ =\n$marker";
+ like $@, qr/^Version control conflict marker '$marker' at \(eval \d+\) line 3\./, "VCS marker '$marker' after operator";
+}
+
# Add new tests HERE (above this line)
diff --git a/toke.c b/toke.c
index 4a20e61..6262f4d8 100644
--- a/toke.c
+++ b/toke.c
@@ -5992,6 +5992,8 @@ Perl_yylex(pTHX)
{
const char tmp = *s++;
if (tmp == '=') {
+ if ((s == PL_linestart+2 || s[-3] == '\n') && strnEQ(s, "=====", 5))
+ Perl_croak(aTHX_ "Version control conflict marker '%.*s'", 7, s - 2);
if (!PL_lex_allbrackets
&& PL_lex_fakeeof >= LEX_FAKEEOF_COMPARE)
{
@@ -6106,8 +6108,11 @@ Perl_yylex(pTHX)
if (PL_expect != XOPERATOR) {
if (s[1] != '<' && !strchr(s,'>'))
check_uni();
- if (s[1] == '<' && s[2] != '>')
+ if (s[1] == '<' && s[2] != '>') {
+ if ((s == PL_linestart || s[-1] == '\n') && strnEQ(s+2, "<<<<<", 5))
+ Perl_croak(aTHX_ "Version control conflict marker '%.*s'", 7, s);
s = scan_heredoc(s);
+ }
else
s = scan_inputsymbol(s);
PL_expect = XOPERATOR;
@@ -6117,6 +6122,8 @@ Perl_yylex(pTHX)
{
char tmp = *s++;
if (tmp == '<') {
+ if ((s == PL_linestart+2 || s[-3] == '\n') && strnEQ(s, "<<<<<", 5))
+ Perl_croak(aTHX_ "Version control conflict marker '%.*s'", 7, s - 2);
if (*s == '=' && !PL_lex_allbrackets
&& PL_lex_fakeeof >= LEX_FAKEEOF_ASSIGN)
{
@@ -6157,6 +6164,8 @@ Perl_yylex(pTHX)
{
const char tmp = *s++;
if (tmp == '>') {
+ if ((s == PL_linestart+2 || s[-3] == '\n') && strnEQ(s, ">>>>>", 5))
+ Perl_croak(aTHX_ "Version control conflict marker '%.*s'", 7, s - 2);
if (*s == '=' && !PL_lex_allbrackets
&& PL_lex_fakeeof >= LEX_FAKEEOF_ASSIGN)
{
--
2.8.2
|
From @maukeOn Sat May 21 01:27:22 2016, mauke- wrote:
Here's a new patch that also updates perldelta. |
From @mauke0001-recognize-and-reject-version-control-conflict-marker.patchFrom 2cb82f9f237e4539f219b278ebf62664e852634c Mon Sep 17 00:00:00 2001
From: Lukas Mai <l.mai@web.de>
Date: Sat, 21 May 2016 10:35:17 +0200
Subject: [PATCH] recognize and reject version control conflict markers (RT
#127993)
---
pod/perldelta.pod | 4 ++++
pod/perldiag.pod | 6 ++++++
t/comp/parser.t | 21 ++++++++++++++++++++-
toke.c | 11 ++++++++++-
4 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index f5bcd6a..e1726f7 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -182,6 +182,10 @@ and New Warnings
=item *
+L<Version control conflict marker '%s'|perldiag/"Version control conflict marker '%s'">
+
+=item *
+
XXX L<message|perldiag/"message">
=back
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index 2210a60..cb732d2 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -7058,6 +7058,12 @@ S<<-- HERE> in m/%s/
(F) You used a verb pattern that is not allowed an argument. Remove the
argument or check that you are using the right verb.
+=item Version control conflict marker '%s'
+
+(P) The parser found a line starting with C<E<lt><<<<<<>,
+C<E<gt>E<gt>E<gt>E<gt>E<gt>E<gt>E<gt>>, or C<=======>. These may be left by a
+version control system to mark conflicts after a failed merge operation.
+
=item Version number must be a constant number
(P) The attempt to translate a C<use Module n.n LIST> statement into
diff --git a/t/comp/parser.t b/t/comp/parser.t
index 50f601c..19d49f9 100644
--- a/t/comp/parser.t
+++ b/t/comp/parser.t
@@ -8,7 +8,7 @@ BEGIN {
chdir 't' if -d 't';
}
-print "1..173\n";
+print "1..182\n";
sub failed {
my ($got, $expected, $name) = @_;
@@ -546,6 +546,25 @@ eval "grep+grep";
eval 'qq{@{0]}${}},{})';
is(1, 1, "RT #124207");
+# RT #127993 version control conflict markers
+" this should keep working
+<<<<<<<
+" =~ /
+>>>>>>>
+/;
+for my $marker (qw(
+<<<<<<<
+=======
+>>>>>>>
+)) {
+ eval "$marker";
+ like $@, qr/^Version control conflict marker '$marker' at \(eval \d+\) line 1\./, "VCS marker '$marker' at beginning";
+ eval "\$_\n$marker";
+ like $@, qr/^Version control conflict marker '$marker' at \(eval \d+\) line 2\./, "VCS marker '$marker' after value";
+ eval "\n\$_ =\n$marker";
+ like $@, qr/^Version control conflict marker '$marker' at \(eval \d+\) line 3\./, "VCS marker '$marker' after operator";
+}
+
# Add new tests HERE (above this line)
diff --git a/toke.c b/toke.c
index 39c59c8..cfe8913 100644
--- a/toke.c
+++ b/toke.c
@@ -5992,6 +5992,8 @@ Perl_yylex(pTHX)
{
const char tmp = *s++;
if (tmp == '=') {
+ if ((s == PL_linestart+2 || s[-3] == '\n') && strnEQ(s, "=====", 5))
+ Perl_croak(aTHX_ "Version control conflict marker '%.*s'", 7, s - 2);
if (!PL_lex_allbrackets
&& PL_lex_fakeeof >= LEX_FAKEEOF_COMPARE)
{
@@ -6106,8 +6108,11 @@ Perl_yylex(pTHX)
if (PL_expect != XOPERATOR) {
if (s[1] != '<' && !strchr(s,'>'))
check_uni();
- if (s[1] == '<' && s[2] != '>')
+ if (s[1] == '<' && s[2] != '>') {
+ if ((s == PL_linestart || s[-1] == '\n') && strnEQ(s+2, "<<<<<", 5))
+ Perl_croak(aTHX_ "Version control conflict marker '%.*s'", 7, s);
s = scan_heredoc(s);
+ }
else
s = scan_inputsymbol(s);
PL_expect = XOPERATOR;
@@ -6117,6 +6122,8 @@ Perl_yylex(pTHX)
{
char tmp = *s++;
if (tmp == '<') {
+ if ((s == PL_linestart+2 || s[-3] == '\n') && strnEQ(s, "<<<<<", 5))
+ Perl_croak(aTHX_ "Version control conflict marker '%.*s'", 7, s - 2);
if (*s == '=' && !PL_lex_allbrackets
&& PL_lex_fakeeof >= LEX_FAKEEOF_ASSIGN)
{
@@ -6157,6 +6164,8 @@ Perl_yylex(pTHX)
{
const char tmp = *s++;
if (tmp == '>') {
+ if ((s == PL_linestart+2 || s[-3] == '\n') && strnEQ(s, ">>>>>", 5))
+ Perl_croak(aTHX_ "Version control conflict marker '%.*s'", 7, s - 2);
if (*s == '=' && !PL_lex_allbrackets
&& PL_lex_fakeeof >= LEX_FAKEEOF_ASSIGN)
{
--
2.8.2
|
From @cpansproutOn Sat May 21 01:47:49 2016, mauke- wrote:
Can the used of s[-1], s[-3], etc. read past the beginning of the buffer? E.g., does eval "<<<<<<" produce a bad read? -- Father Chrysostomos |
From @maukeAm Sa 21. Mai 2016, 05:25:24, sprout schrieb:
I copied this logic from the code that deals with "=cut". It should be fine as long as (s >= PL_linestart) holds: By the time we reach s[-3], we've skipped over two characters (==, >>, <<) in s, so we know s[-1] and s[-2] are OK. The code then checks whether s == PL_linestart+2 first. If it's not, we know s > PL_linestart+2, which makes s[-3] OK. I haven't actually tried it but I think in eval "<<<<<<" we end up hitting the s == PL_linestart case so s[-1] never runs. |
From zefram@fysh.orgl.mai@web.de via RT wrote:
That "(P)" is not the correct classification. Given your implementation, -zefram |
From @maukeOn Sat May 21 06:31:40 2016, zefram@fysh.org wrote:
You're right. Brainfart on my side. Revised patch attached. |
From @mauke0001-recognize-and-reject-version-control-conflict-marker.patchFrom ca733ecaa237d012de2054a759a5357ef22dd985 Mon Sep 17 00:00:00 2001
From: Lukas Mai <l.mai@web.de>
Date: Sat, 21 May 2016 19:12:21 +0200
Subject: [PATCH] recognize and reject version control conflict markers (RT
#127993)
---
pod/perldelta.pod | 4 ++++
pod/perldiag.pod | 6 ++++++
t/comp/parser.t | 21 ++++++++++++++++++++-
toke.c | 11 ++++++++++-
4 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index f5bcd6a..e1726f7 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -182,6 +182,10 @@ and New Warnings
=item *
+L<Version control conflict marker '%s'|perldiag/"Version control conflict marker '%s'">
+
+=item *
+
XXX L<message|perldiag/"message">
=back
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index 2210a60..d6c27f9 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -7058,6 +7058,12 @@ S<<-- HERE> in m/%s/
(F) You used a verb pattern that is not allowed an argument. Remove the
argument or check that you are using the right verb.
+=item Version control conflict marker '%s'
+
+(F) The parser found a line starting with C<E<lt><<<<<<>,
+C<E<gt>E<gt>E<gt>E<gt>E<gt>E<gt>E<gt>>, or C<=======>. These may be left by a
+version control system to mark conflicts after a failed merge operation.
+
=item Version number must be a constant number
(P) The attempt to translate a C<use Module n.n LIST> statement into
diff --git a/t/comp/parser.t b/t/comp/parser.t
index 50f601c..19d49f9 100644
--- a/t/comp/parser.t
+++ b/t/comp/parser.t
@@ -8,7 +8,7 @@ BEGIN {
chdir 't' if -d 't';
}
-print "1..173\n";
+print "1..182\n";
sub failed {
my ($got, $expected, $name) = @_;
@@ -546,6 +546,25 @@ eval "grep+grep";
eval 'qq{@{0]}${}},{})';
is(1, 1, "RT #124207");
+# RT #127993 version control conflict markers
+" this should keep working
+<<<<<<<
+" =~ /
+>>>>>>>
+/;
+for my $marker (qw(
+<<<<<<<
+=======
+>>>>>>>
+)) {
+ eval "$marker";
+ like $@, qr/^Version control conflict marker '$marker' at \(eval \d+\) line 1\./, "VCS marker '$marker' at beginning";
+ eval "\$_\n$marker";
+ like $@, qr/^Version control conflict marker '$marker' at \(eval \d+\) line 2\./, "VCS marker '$marker' after value";
+ eval "\n\$_ =\n$marker";
+ like $@, qr/^Version control conflict marker '$marker' at \(eval \d+\) line 3\./, "VCS marker '$marker' after operator";
+}
+
# Add new tests HERE (above this line)
diff --git a/toke.c b/toke.c
index 39c59c8..cfe8913 100644
--- a/toke.c
+++ b/toke.c
@@ -5992,6 +5992,8 @@ Perl_yylex(pTHX)
{
const char tmp = *s++;
if (tmp == '=') {
+ if ((s == PL_linestart+2 || s[-3] == '\n') && strnEQ(s, "=====", 5))
+ Perl_croak(aTHX_ "Version control conflict marker '%.*s'", 7, s - 2);
if (!PL_lex_allbrackets
&& PL_lex_fakeeof >= LEX_FAKEEOF_COMPARE)
{
@@ -6106,8 +6108,11 @@ Perl_yylex(pTHX)
if (PL_expect != XOPERATOR) {
if (s[1] != '<' && !strchr(s,'>'))
check_uni();
- if (s[1] == '<' && s[2] != '>')
+ if (s[1] == '<' && s[2] != '>') {
+ if ((s == PL_linestart || s[-1] == '\n') && strnEQ(s+2, "<<<<<", 5))
+ Perl_croak(aTHX_ "Version control conflict marker '%.*s'", 7, s);
s = scan_heredoc(s);
+ }
else
s = scan_inputsymbol(s);
PL_expect = XOPERATOR;
@@ -6117,6 +6122,8 @@ Perl_yylex(pTHX)
{
char tmp = *s++;
if (tmp == '<') {
+ if ((s == PL_linestart+2 || s[-3] == '\n') && strnEQ(s, "<<<<<", 5))
+ Perl_croak(aTHX_ "Version control conflict marker '%.*s'", 7, s - 2);
if (*s == '=' && !PL_lex_allbrackets
&& PL_lex_fakeeof >= LEX_FAKEEOF_ASSIGN)
{
@@ -6157,6 +6164,8 @@ Perl_yylex(pTHX)
{
const char tmp = *s++;
if (tmp == '>') {
+ if ((s == PL_linestart+2 || s[-3] == '\n') && strnEQ(s, ">>>>>", 5))
+ Perl_croak(aTHX_ "Version control conflict marker '%.*s'", 7, s - 2);
if (*s == '=' && !PL_lex_allbrackets
&& PL_lex_fakeeof >= LEX_FAKEEOF_ASSIGN)
{
--
2.8.2
|
From @cpansproutOn Sat May 21 05:37:59 2016, mauke- wrote:
Yes, you’re right. Your patch looks fine, then (specifically, the one with the (F) correction). -- Father Chrysostomos |
@mauke - Status changed from 'open' to 'pending release' |
From @tonycozOn Sat May 21 10:13:47 2016, mauke- wrote:
+ if ((s == PL_linestart+2 || s[-3] == '\n') && strnEQ(s, "=====", 5)) Shouldn't the errors be reported with yyerror() (or one of its variants) ? Tony |
From @cpansproutOn Sun May 22 17:57:48 2016, tonyc wrote:
It depends on whether you want perl to continue parsing and reporting other possible errors. In this case, I’m not sure that would make much sense. -- Father Chrysostomos |
From @maukeAm So 22. Mai 2016, 17:57:48, tonyc schrieb:
I tried that, but it added "at end of line" to the message, followed by another syntax error for "==". |
From @tonycozOn Sun, May 22, 2016 at 06:32:52PM -0700, l.mai@web.de via RT wrote:
You'd also want to skip parsing to the next line (as with a comment), Also, git can add |||||| conflict to separate the original text if you Tony |
From @maukeOn Sun May 22 19:04:46 2016, tonyc wrote:
I've attached a patch to do it that way. Any comments?
I didn't add that one initially because gcc doesn't recognize it either. Should I? |
From @mauke0001-use-yyerror-instead-of-croaking-immediately-RT-12799.patchFrom 0e7163d07e4baa9a920c10d18b8da09f3254db42 Mon Sep 17 00:00:00 2001
From: Lukas Mai <l.mai@web.de>
Date: Sat, 4 Jun 2016 13:05:36 +0200
Subject: [PATCH] use yyerror instead of croaking immediately (RT #127993)
---
pod/perldelta.pod | 2 +-
pod/perldiag.pod | 2 +-
t/comp/parser.t | 6 +++---
toke.c | 52 ++++++++++++++++++++++++++++++++++++----------------
4 files changed, 41 insertions(+), 21 deletions(-)
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 69a3d53..97f8444 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -204,7 +204,7 @@ and New Warnings
=item *
-L<Version control conflict marker '%s'|perldiag/"Version control conflict marker '%s'">
+L<Version control conflict marker|perldiag/"Version control conflict marker">
=item *
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index fdf79c8..dae7c26 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -7057,7 +7057,7 @@ S<<-- HERE> in m/%s/
(F) You used a verb pattern that is not allowed an argument. Remove the
argument or check that you are using the right verb.
-=item Version control conflict marker '%s'
+=item Version control conflict marker
(F) The parser found a line starting with C<E<lt><<<<<<>,
C<E<gt>E<gt>E<gt>E<gt>E<gt>E<gt>E<gt>>, or C<=======>. These may be left by a
diff --git a/t/comp/parser.t b/t/comp/parser.t
index 19d49f9..efd3a8d 100644
--- a/t/comp/parser.t
+++ b/t/comp/parser.t
@@ -558,11 +558,11 @@ for my $marker (qw(
>>>>>>>
)) {
eval "$marker";
- like $@, qr/^Version control conflict marker '$marker' at \(eval \d+\) line 1\./, "VCS marker '$marker' at beginning";
+ like $@, qr/^Version control conflict marker at \(eval \d+\) line 1, near "$marker"/, "VCS marker '$marker' at beginning";
eval "\$_\n$marker";
- like $@, qr/^Version control conflict marker '$marker' at \(eval \d+\) line 2\./, "VCS marker '$marker' after value";
+ like $@, qr/^Version control conflict marker at \(eval \d+\) line 2, near "$marker"/, "VCS marker '$marker' after value";
eval "\n\$_ =\n$marker";
- like $@, qr/^Version control conflict marker '$marker' at \(eval \d+\) line 3\./, "VCS marker '$marker' after operator";
+ like $@, qr/^Version control conflict marker at \(eval \d+\) line 3, near "$marker"/, "VCS marker '$marker' after operator";
}
diff --git a/toke.c b/toke.c
index e6f6bf9..327d984 100644
--- a/toke.c
+++ b/toke.c
@@ -4422,6 +4422,26 @@ S_check_scalar_slice(pTHX_ char *s)
pl_yylval.ival = OPpSLICEWARNING;
}
+#define lex_token_boundary() S_lex_token_boundary(aTHX)
+static void
+S_lex_token_boundary(pTHX)
+{
+ PL_oldoldbufptr = PL_oldbufptr;
+ PL_oldbufptr = PL_bufptr;
+}
+
+#define vcs_conflict_marker(s) S_vcs_conflict_marker(aTHX_ s)
+static char *
+S_vcs_conflict_marker(pTHX_ char *s)
+{
+ lex_token_boundary();
+ PL_bufptr = s;
+ yyerror("Version control conflict marker");
+ while (s < PL_bufend && *s != '\n')
+ s++;
+ return s;
+}
+
/*
yylex
@@ -5992,8 +6012,10 @@ Perl_yylex(pTHX)
{
const char tmp = *s++;
if (tmp == '=') {
- if ((s == PL_linestart+2 || s[-3] == '\n') && strnEQ(s, "=====", 5))
- Perl_croak(aTHX_ "Version control conflict marker '%.*s'", 7, s - 2);
+ if ((s == PL_linestart+2 || s[-3] == '\n') && strnEQ(s, "=====", 5)) {
+ s = vcs_conflict_marker(s + 5);
+ goto retry;
+ }
if (!PL_lex_allbrackets
&& PL_lex_fakeeof >= LEX_FAKEEOF_COMPARE)
{
@@ -6109,8 +6131,10 @@ Perl_yylex(pTHX)
if (s[1] != '<' && !strchr(s,'>'))
check_uni();
if (s[1] == '<' && s[2] != '>') {
- if ((s == PL_linestart || s[-1] == '\n') && strnEQ(s+2, "<<<<<", 5))
- Perl_croak(aTHX_ "Version control conflict marker '%.*s'", 7, s);
+ if ((s == PL_linestart || s[-1] == '\n') && strnEQ(s+2, "<<<<<", 5)) {
+ s = vcs_conflict_marker(s + 7);
+ goto retry;
+ }
s = scan_heredoc(s);
}
else
@@ -6122,8 +6146,10 @@ Perl_yylex(pTHX)
{
char tmp = *s++;
if (tmp == '<') {
- if ((s == PL_linestart+2 || s[-3] == '\n') && strnEQ(s, "<<<<<", 5))
- Perl_croak(aTHX_ "Version control conflict marker '%.*s'", 7, s - 2);
+ if ((s == PL_linestart+2 || s[-3] == '\n') && strnEQ(s, "<<<<<", 5)) {
+ s = vcs_conflict_marker(s + 5);
+ goto retry;
+ }
if (*s == '=' && !PL_lex_allbrackets
&& PL_lex_fakeeof >= LEX_FAKEEOF_ASSIGN)
{
@@ -6164,8 +6190,10 @@ Perl_yylex(pTHX)
{
const char tmp = *s++;
if (tmp == '>') {
- if ((s == PL_linestart+2 || s[-3] == '\n') && strnEQ(s, ">>>>>", 5))
- Perl_croak(aTHX_ "Version control conflict marker '%.*s'", 7, s - 2);
+ if ((s == PL_linestart+2 || s[-3] == '\n') && strnEQ(s, ">>>>>", 5)) {
+ s = vcs_conflict_marker(s + 5);
+ goto retry;
+ }
if (*s == '=' && !PL_lex_allbrackets
&& PL_lex_fakeeof >= LEX_FAKEEOF_ASSIGN)
{
@@ -11827,14 +11855,6 @@ Perl_parse_stmtseq(pTHX_ U32 flags)
return stmtseqop;
}
-#define lex_token_boundary() S_lex_token_boundary(aTHX)
-static void
-S_lex_token_boundary(pTHX)
-{
- PL_oldoldbufptr = PL_oldbufptr;
- PL_oldbufptr = PL_bufptr;
-}
-
#define parse_opt_lexvar() S_parse_opt_lexvar(aTHX)
static OP *
S_parse_opt_lexvar(pTHX)
--
2.8.3
|
From @cpansproutOn Sat Jun 04 04:08:48 2016, mauke- wrote:
It looks good to me, though I did look at it rather quickly.
I have no opinion on that. -- Father Chrysostomos |
From @tonycozOn Sat Jun 04 04:08:48 2016, mauke- wrote:
Up to you, it's going to be a lot rarer. I would have pushed your patch to blead but the git server is out of disk space. Tony |
From @tonycozOn Sun Jun 05 17:46:02 2016, tonyc wrote:
Thanks, applied as 9c88bb5. I also added a test for multiple markers in e2733f9. Tony |
From @epaThanks all for your work on this. |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release today of Perl 5.26.0, this and 210 other issues have been Perl 5.26.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#127993 (status was 'resolved')
Searchable as RT127993$
The text was updated successfully, but these errors were encountered: