]> arthur.barton.de Git - bup.git/commit
Fix utc_offset_str for fractional TZs
authorRob Browning <rlb@defaultvalue.org>
Sat, 5 Dec 2015 19:41:36 +0000 (13:41 -0600)
committerRob Browning <rlb@defaultvalue.org>
Sat, 12 Dec 2015 17:16:50 +0000 (11:16 -0600)
commitf25ef2e868f85ca19bfce314081c956ade9c10ef
treeeea170dcf3c9c03ef9e97d70e87b76a5cda6f486
parentc2e7b3e6dc868e96957170a93ce33b2798806702
Fix utc_offset_str for fractional TZs

Previously, for fractional offsets like TZ=FOO+3:3 (where the offset
is not an integer number of hours), utc_offset_str() would return a
large, incorrect integer value.  Adjust it to handle arbitrary
offsets, and document that it truncates any fractional seconds of the
offset.

Before this fix, whenever bup was operating with a fractional offset
(e.g. TZ=Australia/Adelaide), it wrote commits (i.e. saves) that it
won't be able to read.  Attempts to read them will fail with
"Exception: cannot parse commit".

Thanks to David Kettler for reporting the problem, and proposing an
alternate fix.

Reviewed-by: David Kettler <kettler@internode.on.net>
Tested-by: David Kettler <kettler@internode.on.net>
[rlb@defaultvalue.org: changed / to // for Python 3 compat]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/helpers.py
lib/bup/t/thelpers.py