]> arthur.barton.de Git - bup.git/commitdiff
main: fix output string truncation
authorJohannes Berg <johannes@sipsolutions.net>
Mon, 22 Nov 2021 20:34:29 +0000 (21:34 +0100)
committerRob Browning <rlb@defaultvalue.org>
Sun, 5 Dec 2021 20:26:53 +0000 (14:26 -0600)
There's a bug here that causes output to be cut off if it's
if the line was too long, in that case 'width' chars would
be removed at the beginning, rather than actually showing
'width' chars. Fix that.

Reported-by: Nix <nix@esperi.org.uk>
Fixes: 00fb1f1b2a53 ("Clean subprocess output without newliner")
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/main.py

index 746fce451b532ef7e8122dcf6fe8e451917793eb..dcab41b59eab18cf17b42df4d14a950c74f6e498 100755 (executable)
@@ -219,7 +219,7 @@ def print_clean_line(dest, content, width, sep=None):
         assert not sep_rx.match(x)
     content = b''.join(content)
     if sep == b'\r' and len(content) > width:
-        content = content[width:]
+        content = content[:width]
     os.write(dest, content)
     if len(content) < width:
         os.write(dest, b' ' * (width - len(content)))