automatic backup every day throws errors

Bug #1419466 reported by graysky
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Back In Time
Fix Released
High
Germar

Bug Description

I am running 1.1.2 on Arch. When I go to schedule a backup using the 'every day' option, and using the default of 00:00 in the dialog, bit throws this error and the crontab is not updated:

% backintime-qt4

Back In Time
Version: 1.1.2

Back In Time comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type `backintime-qt4 --license' for details.

Check snapshot folder: /mnt/data/snapshots
Clearing all Back In Time entries
Clearing system Back In Time entries
Profile: Main profile
Automatic backup: Every Day
"-":15: bad hour
errors in crontab file, can't install.

Revision history for this message
Germar (germar) wrote :

Looks like crontab from cronie doesn't know 'crontab -' to read from standard input but does the same with 'echo "#foo" | crontab'.

Changed in backintime:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Germar (germar)
Revision history for this message
Germar (germar) wrote :

Okay, looks like older versions (in Debian) also read from stdin without '-'. So I've changed it.

Changed in backintime:
status: Triaged → Fix Committed
Revision history for this message
graysky (graysky) wrote :

Rock on, thanks.

Germar (germar)
Changed in backintime:
milestone: none → 1.1.4
Revision history for this message
tarch (tarcisio-fedrizzi) wrote :

Hello,
I have encountered this bug too.
I've tried to apply your patch but it doens't work.

The problem happens instead because the hour is outputted as float so if, for example, I select 12:00 the cron line is:

0 12.0 * * * /usr/bin/nice -n 19 /usr/bin/ionice -c2 -n7 /usr/bin/backintime --backup-job >/dev/null 2>&1

To fix the problem the hour should be converted to int or you can use %i format string like here:

                elif self.CUSTOM_HOUR == backup_mode:
                    cron_line = 'echo "{msg}\n0 ' + self.get_custom_backup_time( profile_id ) + ' * * * {cmd}"'
                elif self.DAY == backup_mode:
                    cron_line = "echo \"{msg}\n%i %i * * * {cmd}\"" % (minute, hour) # <------------------
                elif self.REPEATEDLY == backup_mode:

Best regards,
Tarcisio Fedrizzi.

Revision history for this message
Germar (germar) wrote :

Hi Tarcisio,

I was already wondering about the float but didn't find the time to track down if there was any reason for this. I changed it as you suggested. Thanks for reporting.

Regards,
Germar

Revision history for this message
tarch (tarcisio-fedrizzi) wrote :

Hi Germar,
the problem arises because the default division operator has been changed in python3.

Here there is an example:

python2
---
+>>> 2 / 3
0
+>>> 2 // 3
0
-----
python3
---
+>>> 2 / 3
0.6666666666666666
+>>> 2 // 3
0

so when on this line:

hour = self.get_automatic_backup_time(profile_id) / 100;

you do the division this means two different things depending on which python you use.

This means that probably the best fix would be to change the row to:

hour = self.get_automatic_backup_time(profile_id) // 100;

Best regards,
Tarcisio.

Revision history for this message
Germar (germar) wrote :

Hi Tarcisio,

thanks for pointing this out.

Regards,
Germar

Germar (germar)
Changed in backintime:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.