8000 Add semicolons to eval'd strings to hide a minor Perl behavioral change. · sqlparser/postgres@bb5a217 · GitHub
[go: up one dir, main page]

Skip to content

Commit bb5a217

Browse files
committed
Add semicolons to eval'd strings to hide a minor Perl behavioral change.
"eval q{foo}" used to complain that the error was on line 2 of the eval'd string, because eval internally tacked on "\n;" so that the end of the erroneous command was indeed on line 2. But as of Perl 5.18 it more sanely says that the error is on line 1. To avoid Perl-version-dependent regression test results, use "eval q{foo;}" instead in the two places where this matters. Per buildfarm. Since people might try to use newer Perl versions with older PG releases, back-patch as far as 9.0 where these test cases were added.
1 parent 805730d commit bb5a217

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/pl/plperl/expected/plperl.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,8 @@ DO $$ open my $fh, "</nonesuch"; $$ LANGUAGE plperl;
573573
ERROR: 'open' trapped by operation mask at line 1.
574574
CONTEXT: PL/Perl anonymous code block
575575
-- check that eval is allowed and eval'd restricted ops are caught
576-
DO $$ eval q{chdir '.'}; warn "Caught: $@"; $$ LANGUAGE plperl;
577-
WARNING: Caught: 'chdir' trapped by operation mask at line 2.
576+
DO $$ eval q{chdir '.';}; warn "Caught: $@"; $$ LANGUAGE plperl;
577+
WARNING: Caught: 'chdir' trapped by operation mask at line 1.
578578
CONTEXT: PL/Perl anonymous code block
579579
-- check that compiling do (dofile opcode) is allowed
580580
-- but that executing it for a file not already loaded (via require) dies
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
-- test plperl.on_plperl_init errors are fatal
22
-- Avoid need for custom_variable_classes = 'plperl'
33
LOAD 'plperl';
4-
SET SESSION plperl.on_plperl_init = ' system("/nonesuch") ';
4+
SET SESSION plperl.on_plperl_init = ' system("/nonesuch"); ';
55
SHOW plperl.on_plperl_init;
6-
plperl.on_plperl_init
7-
-----------------------
8-
system("/nonesuch")
6+
plperl.on_plperl_init
7+
------------------------
8+
system("/nonesuch");
99
(1 row)
1010

1111
DO $$ warn 42 $$ language plperl;
12-
ERROR: 'system' trapped by operation mask at line 2.
12+
ERROR: 'system' trapped by operation mask at line 1.
1313
CONTEXT: while executing plperl.on_plperl_init
1414
PL/Perl anonymous code block

src/pl/plperl/sql/plperl.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ DO $$ qx("/nonesuch"); $$ LANGUAGE plperl;
373373
DO $$ open my $fh, "</nonesuch"; $$ LANGUAGE plperl;
374374

375375
-- check that eval is allowed and eval'd restricted ops are caught
376-
DO $$ eval q{chdir '.'}; warn "Caught: $@"; $$ LANGUAGE plperl;
376+
DO $$ eval q{chdir '.';}; warn "Caught: $@"; $$ LANGUAGE plperl;
377377

378378
-- check that compiling do (dofile opcode) is allowed
379379
-- but that executing it for a file not already loaded (via require) dies

src/pl/plperl/sql/plperl_init.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
-- Avoid need for custom_variable_classes = 'plperl'
44
LOAD 'plperl';
55

6-
SET SESSION plperl.on_plperl_init = ' system("/nonesuch") ';
6+
SET SESSION plperl.on_plperl_init = ' system("/nonesuch"); ';
77

88
SHOW plperl.on_plperl_init;
99

0 commit comments

Comments
 (0)
0