Project

General

Profile

Bug #9397

'when' parameter parsed incorrectly for day of month < 10

Added by ngaur over 2 years ago. Updated over 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
05/13/2015
Due date:
% Done:

0%

QA Check:

Description

I've got a backup which is supposed to run on the first of the month, but which has not been doing so. I've tracked it down to a bug in `function isnow()` in src/backupninja.in. The date function used to calculate `nowday` gives a zero-padded 2 digit day number, while the mechanism for calculating `whenday` does not do the zero-padding, so the comparison fails.

I've attached a diff, which I think is correct, but I've yet to test it fully, as I'm not yet sure how to do that without waiting for the date to roll around. Stepping through line by line in bash, and assuming the SED substitution behaves as I expect, it looks fine.

backupninja.in.diff View (467 Bytes) ngaur, 05/13/2015 03:27 PM

History

#1 Updated by ngaur over 2 years ago

I'm having a hard time believing that a bug like this could sit around for years without being noticed. Maybe there's something specific to my system?

It's debian wheezy. Not sure what other details are important, but happy to answer any questions.

In case it's not clear, an example of a `when spec that fails is "when = 1st at 18:00".

#2 Updated by ngaur over 1 year ago

The diff here has been in production use for some time now. Consider it tested.

#3 Updated by timewulf over 1 year ago

ngaur wrote:

The diff here has been in production use for some time now. Consider it tested.

I had the same problem on three debian production servers today. I patched backupninja manually this way, tried again and the error is gone.

#4 Updated by timewulf over 1 year ago

As this bug is critical for monthly backup schedules (This appears in my case ...): May we create a new version build so the different distributions may update there packages?

Also available in: Atom PDF