pgindent fails with perl 5.40

Поиск
Список
Период
Сортировка
Искать

pgindent fails with perl 5.40

От:
Erik Wienhold <ewie@ewie.name>
Дата:
I get this error when running pgindent with perl 5.40:

    Attempt to call undefined import method with arguments ("devnull") via package "File::Spec" (Perhaps you forgot to load the package?) at src/tools/pgindent/pgindent line 10.
    BEGIN failed--compilation aborted at src/tools/pgindent/pgindent line 10.

It definitely worked with perl 5.38 before.  Not sure if something's
wrong on my side.  Is anybody else already using 5.40?  For the moment,
I just changed the File::Spec import to make it work:

diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent
index 48d83bc434..028d057ea4 100755
--- a/src/tools/pgindent/pgindent
+++ b/src/tools/pgindent/pgindent
@@ -7,7 +7,7 @@ use warnings FATAL => 'all';

 use Cwd qw(abs_path getcwd);
 use File::Find;
-use File::Spec qw(devnull);
+use File::Spec;
 use File::Temp;
 use IO::Handle;
 use Getopt::Long;

-- 
Erik


Re: pgindent fails with perl 5.40

От:
Erik Wienhold <ewie@ewie.name>
Дата:
I wrote:
> I get this error when running pgindent with perl 5.40:
> 
>     Attempt to call undefined import method with arguments ("devnull") via package "File::Spec" (Perhaps you forgot to load the package?) at src/tools/pgindent/pgindent line 10.
>     BEGIN failed--compilation aborted at src/tools/pgindent/pgindent line 10.
> 
> It definitely worked with perl 5.38 before.  Not sure if something's
> wrong on my side.

Ah, it's intentional:
https://metacpan.org/release/HAARG/perl-5.40.0/view/pod/perldelta.pod#Calling-the-import-method-of-an-unknown-package-produces-a-warning

> Calling the import method of an unknown package produces a warning
> [...]
> It will also detect cases where a user passes an argument when using a
> package that does not provide its own import
> [...]

Because we use fatal warnings, pgindent fails.

-- 
Erik


Re: pgindent fails with perl 5.40

От:
Daniel Gustafsson <daniel@yesql.se>
Дата:
> On 8 Oct 2024, at 03:50, Erik Wienhold  wrote:

>> Calling the import method of an unknown package produces a warning
>> [...]
>> It will also detect cases where a user passes an argument when using a
>> package that does not provide its own import
>> [...]
> 
> Because we use fatal warnings, pgindent fails.

I'm far from fluent in Perl, but my reading of this is that File::Spec doesn't
provide an import() function so explicitly listing devnull does nothing here.
Your diff should thus be a safe fix.  The devnull function existed already in
3.00 which was released just a hair over 2 decades ago so I think we can safely
assume any File::Spec we use to have it.

--
Daniel Gustafsson



Re: pgindent fails with perl 5.40

От:
Andrew Dunstan <andrew@dunslane.net>
Дата:

On 2024-10-08 Tu 5:26 AM, Daniel Gustafsson wrote:
>> On 8 Oct 2024, at 03:50, Erik Wienhold  wrote:
>>> Calling the import method of an unknown package produces a warning
>>> [...]
>>> It will also detect cases where a user passes an argument when using a
>>> package that does not provide its own import
>>> [...]
>> Because we use fatal warnings, pgindent fails.
> I'm far from fluent in Perl, but my reading of this is that File::Spec doesn't
> provide an import() function so explicitly listing devnull does nothing here.
> Your diff should thus be a safe fix.  The devnull function existed already in
> 3.00 which was released just a hair over 2 decades ago so I think we can safely
> assume any File::Spec we use to have it.



The patch looks fine, and should be backpatched. Looks like this is a 12 
year old thinko. AFAICT File::Spec doesn't export anything.


cheers


andrew


--
Andrew Dunstan
EDB: https://www.enterprisedb.com



Re: pgindent fails with perl 5.40

От:
Daniel Gustafsson <daniel@yesql.se>
Дата:
> On 8 Oct 2024, at 22:24, Andrew Dunstan  wrote:
> 
> On 2024-10-08 Tu 5:26 AM, Daniel Gustafsson wrote:
>>> On 8 Oct 2024, at 03:50, Erik Wienhold  wrote:
>>>> Calling the import method of an unknown package produces a warning
>>>> [...]
>>>> It will also detect cases where a user passes an argument when using a
>>>> package that does not provide its own import
>>>> [...]
>>> Because we use fatal warnings, pgindent fails.
>> I'm far from fluent in Perl, but my reading of this is that File::Spec doesn't
>> provide an import() function so explicitly listing devnull does nothing here.
>> Your diff should thus be a safe fix.  The devnull function existed already in
>> 3.00 which was released just a hair over 2 decades ago so I think we can safely
>> assume any File::Spec we use to have it.
> 
> The patch looks fine, and should be backpatched. Looks like this is a 12 year old thinko. AFAICT File::Spec doesn't export anything.

Thanks for confirming, I'll go do that in the morning when I've had coffee
unless you beat me to it.

--
Daniel Gustafsson



Re: pgindent fails with perl 5.40

От:
Daniel Gustafsson <daniel@yesql.se>
Дата:
> On 8 Oct 2024, at 22:56, Daniel Gustafsson  wrote:
> 
>> On 8 Oct 2024, at 22:24, Andrew Dunstan  wrote:

>> The patch looks fine, and should be backpatched. Looks like this is a 12 year old thinko. AFAICT File::Spec doesn't export anything.
> 
> Thanks for confirming, I'll go do that in the morning when I've had coffee
> unless you beat me to it.

Done, thanks for the report!

--
Daniel Gustafsson



Re: pgindent fails with perl 5.40

От:
Erik Wienhold <ewie@ewie.name>
Дата:
On 2024-10-09 09:52 +0200, Daniel Gustafsson wrote:
> Done, thanks for the report!

Thanks for pushing!

-- 
Erik


FAQ