Bacula-users

Re: [Bacula-users] Perl 5.20 upgrade breaks make_catalog_backup.pl?

2015-06-04 07:51:42
Subject: Re: [Bacula-users] Perl 5.20 upgrade breaks make_catalog_backup.pl?
From: dweimer <dweimer AT dweimer DOT net>
To: Eric Bollengier <eric.bollengier AT baculasystems DOT com>
Date: Thu, 04 Jun 2015 06:48:51 -0500
On 06/04/2015 2:01 am, Eric Bollengier wrote:
> Hello Doug,
> 
> On 06/02/2015 09:01 PM, Doug Sampson wrote:
>> Recently FreeBSD announced that its default Perl version is now 5.20 
>> and
>> urged all users to upgrade to that version. I did so. Now
>> make_catalog_backup.pl doesn’t run. The first indication was as 
>> follows:
>> 
>> 
>> 
>> 30-May 09:05 pisces-dir JobId 15770: shell command: run BeforeJob
>> "/usr/local/share/bacula/make_catalog_backup1.pl MyCatalog"
>> 
>> 30-May 09:05 pisces-dir JobId 15770: BeforeJob: Statement unlikely to 
>> be
>> reached at /usr/local/share/bacula/make_catalog_backup1.pl line 40.
>> 
>> 30-May 09:05 pisces-dir JobId 15770: BeforeJob:       (Maybe you meant
>> system() when you said exec()?)
> 
> This first warning message is a bit strange, the code is doing:
> 
> sub dump_pgsql
> {
>     my %args = @_;
>     setup_env_pgsql(%args);
>     exec("HOME='$wd' pg_dump -c > '$wd/$args{db_name}.sql'");
>     print "Error while executing postgres dump $!\n";
>     return 1;               # in case of error
> }
> 
> The code after the exec is supposed to handle the case where exec()
> doesn't work. Can you try to replace function by
> 
> sub dump_pgsql
> {
>     my %args = @_;
>     setup_env_pgsql(%args);
>     exec("HOME='$wd' pg_dump -c > '$wd/$args{db_name}.sql'")
>        or die "Error while executing postgres dump $!\n";
> }
> 
> to see if the warning is fixed.
> 
> 
>> 30-May 09:05 pisces-dir JobId 15770: BeforeJob: cannot create
>> /backup/bacula.sql: Permission denied
>> 
>> 30-May 09:05 pisces-dir JobId 15770: Error: Runscript: BeforeJob
>> returned non-zero status=2. ERR=Child exited with code 2
> 
> Here you have the real error
> "cannot create /backup/bacula.sql: Permission denied"
> 
> Maybe you can change permissions on /backup to allow "bacula" to create
> files.
> 
> 
> Best Regards,
> Eric

I have been running 5.20 for some time, it did break the script, but the 
fix was rather simple, probably should have posted something to a 
mailing list so that it was fixed by now.

in /usr/local/share/bacula/make_catalog_backup.pl I just changed the 
first line from:
#!/usr/bin/env perl

to:
#!/usr/bin/env /usr/local/bin/perl

-- 
Thanks,
    Dean E. Weimer
    http://www.dweimer.net/

------------------------------------------------------------------------------
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users