Re: Something amiss in bacula-9.6.7: Possible race condition

Eric Bollengier via Bacula-devel <[email protected]>
Newsgroups gmane.comp.sysutils.backup.bacula.devel
Message-ID <[email protected]>
Hello Martin,

Very good detective work, this subtle issue was causing concurrent
database access even if the batch mode was disabled. I have pushed the
patch into the Branch-9.6 git repository.

Best Regards,
Eric

> What is the output of "show catalog" in bconsole?  My guess is that you will
> see db_driver=MySQ i.e. missing the final "L" of MySQL.  This will prevent it
> from reusing the BDB object, leading to unexpected concurrency.
> 
> The bug is caused by this change:
> 
> diff --git a/bacula/src/dird/dird.c b/bacula/src/dird/dird.c
> index fdb1d97bf9..11c4406ea7 100644
> --- a/bacula/src/dird/dird.c
> +++ b/bacula/src/dird/dird.c
> @@ -1265,7 +1265,7 @@ static bool check_catalog(cat_op mode)
>             /* To copy dbdriver field into "CAT" catalog resource class (local)
>              * from dbdriver in "BDB" catalog DB Interface class (global)
>              */
> -            strncpy(catalog->db_driver, BDB_db_driver, db_driver_len);
> +            bstrncpy(catalog->db_driver, BDB_db_driver, db_driver_len);
>           }
>        }
> 
> which was part of 9.6.4.
> 
> To fix it, replace db_driver_len with db_driver_len+1 in this call to
> bstrncpy.  This has been fixed in Bacula 11 because the seemingly minor
> problem with "status catalog" was reported in
> https://bugs.bacula.org/view.php?id=2551 but it looks like the significance of
> it wasn't realized.
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.