Skip to content

Commit fd95277

Browse files
committed
Fix bug with current rsync versions
Current rsync Versions changed the backup command creation minimally which means that they now don't contain parts of path that are only a dot.
1 parent 484abda commit fd95277

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/output_parser/commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def backup_start_line(self, retain_type: Optional[str]) -> str:
118118
if not retain_type:
119119
raise Exception("No retain type given")
120120
return "{} /mnt/Backup/{}.0/{}".format(
121-
self.source, retain_type, self.destination
121+
self.source, retain_type, self.destination.lstrip(".")
122122
)
123123

124124
@property

src/output_parser/parsed_output.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import sys
2-
from sys import stdin
32
from collections.abc import Sequence
43
from typing import Type, Optional
54
from datetime import datetime, timedelta
@@ -30,9 +29,14 @@ def _parse_backup_points(self) -> Sequence[RsnapshotCommand]:
3029
current_backup_point: int = -1
3130
current_backup_point_log: list[str] = []
3231
for line in self._log:
33-
if (current_backup_point + 1) < len(backup_points) and backup_points[
34-
current_backup_point + 1
35-
].backup_start_line(self.retain_type) in line:
32+
next_backup_point = current_backup_point + 1
33+
if (next_backup_point) >= len(backup_points):
34+
current_backup_point_log.append(line)
35+
continue
36+
if (
37+
backup_points[next_backup_point].backup_start_line(self.retain_type)
38+
in line
39+
):
3640
if current_backup_point >= 0:
3741
backup_points[current_backup_point].log = current_backup_point_log
3842
current_backup_point += 1
@@ -146,7 +150,7 @@ def changed_size(self) -> int:
146150
def _read_input() -> Sequence[str]:
147151
multiline_segment: str = ""
148152
processed_lines: list[str] = []
149-
for line in stdin:
153+
for line in sys.stdin:
150154
# Rsnapshot cuts long lines into multiple lines separated by "\"
151155
if multiline_segment:
152156
line = multiline_segment + line[4:]

0 commit comments

Comments
 (0)