Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 888085

Summary: app-backup/backuppc-4.4.0-r1: config.pl is mangled by the CGI interface (upstream patch available)
Product: Gentoo Linux Reporter: Stefan Bruda <bruda>
Component: Current packagesAssignee: Dennis Eisele <kernlpanic>
Status: RESOLVED FIXED    
Severity: major CC: bruda, kernlpanic, Nicolai.Beuermann, proxy-maint, sam
Priority: Normal Keywords: PATCH, PullRequest
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://github.com/backuppc/backuppc/issues/466
https://github.com/gentoo/gentoo/pull/36865
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Patch to ebuild
Github patch

Description Stefan Bruda 2022-12-23 14:25:24 UTC
The current Gentoo stable version of backuppc (4.4.0-r1) exhibits a nasty bug in that any change in the configuration initiated from the CGI interface mangles the configuration file by replacing many [...] and {...} with (...).  As a result the configuration becomes unusable and so backuppc crashes and/or the CGI interface becomes unusable.

The problem is caused by an incorrect second argument to Data::Dumper in a few places.  An upstream patch to correct the issue is available at https://github.com/backuppc/backuppc/commit/2c9270b9b849b2c86ae6301dd722c97757bc9256


Reproducible: Always

Steps to Reproduce:
1. Launch the backuppc CGI interface https://<host>/BackupPC_Admin
2. Go to any page that edits the configuration, such as
   https://<host>/BackupPC_Admin?action=editConfig&newMenu=hosts
   or
   https://<host>/BackupPC_Admin?action=editConfig
3. Edit something (such as adding a host) and save
Actual Results:  
In /etc/BackupPC/config.pl many [...] and {...} constructs are replaced by (...).  For example

$Conf{WakeupSchedule} = [
  23,
  0,
  1,
  2,
  3,
  4
];

becomes

$Conf{WakeupSchedule} = (
  23,
  0,
  1,
  2,
  3,
  4
);

As a result the backuppc process crashes with errors such as

Can't use string ("4") as an ARRAY ref while "strict refs" in use at /usr/bin/BackupPC line 868.

Expected Results:  
The new configuration is saved correctly and backuppc continues to operate normally.
Comment 1 Stefan Bruda 2024-05-27 11:47:12 UTC
Mote than one year and the bug is still there?  Just wanted to mention that I have been running for a long time and without any notable incident an -r2 version of BackupPC (see backuppc-4.4.0-r2.ebuild.diff) modified straightforwardly to include the Github patch (attached as backuppc-4.4.0-dumper.patch for convenience).
Comment 2 Stefan Bruda 2024-05-27 11:48:09 UTC
Created attachment 894511 [details, diff]
Patch to ebuild
Comment 3 Stefan Bruda 2024-05-27 11:48:33 UTC
Created attachment 894512 [details, diff]
Github patch
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-05-27 20:52:09 UTC
Dennis, still with us? I can fix it but I thought you were around.

Stefan, please ping if no movement on it in a week or two.
Comment 5 Dennis Eisele 2024-05-27 22:13:21 UTC
Hi Sam,

yes I am working on it. Sry that it took so long.
I prepared the fix already I was just waiting for my other PR to be accepted.
As thats the case now I will submit the PR for this Bug right away.
Comment 6 Larry the Git Cow gentoo-dev 2024-05-28 01:06:16 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04f58b0a6b8ab2e71139f20ecbd76cd7673b40d7

commit 04f58b0a6b8ab2e71139f20ecbd76cd7673b40d7
Author:     Dennis Eisele <kernlpanic@dennis-eisele.de>
AuthorDate: 2024-04-03 23:42:23 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-05-28 01:05:23 +0000

    app-backup/backuppc: add patch for erroneous config write
    
    Signed-off-by: Dennis Eisele <kernlpanic@dennis-eisele.de>
    Closes: https://bugs.gentoo.org/888085
    Closes: https://github.com/gentoo/gentoo/pull/36865
    Signed-off-by: Sam James <sam@gentoo.org>

 app-backup/backuppc/backuppc-4.4.0-r2.ebuild       | 195 +++++++++++++++++++++
 .../4.4.0/backuppc-4.4.0-fix-config-write.patch    |  48 +++++
 2 files changed, 243 insertions(+)