]> arthur.barton.de Git - bup.git/commit
ssh: don't pass through bad BUP_TTY_WIDTH
authorJohannes Berg <johannes@sipsolutions.net>
Mon, 21 Dec 2020 20:45:55 +0000 (21:45 +0100)
committerRob Browning <rlb@defaultvalue.org>
Thu, 24 Dec 2020 01:16:56 +0000 (19:16 -0600)
commitd55be20f5d1efdfbc7bac80bcb1a5f4825872f62
tree61bdd5189813ec2a0aa3772ddc0ef994be0b5151
parent8b7129a1147ad50a3df5c069e86a1d2f06add8a8
ssh: don't pass through bad BUP_TTY_WIDTH

If there's no BUP_TTY_WIDTH variable already, then environ.get()
will result in None, which cannot be converted to an integer so
we get 0. Then we pass 0 to the other side in the BUP_TTY_WIDTH
environment variable.

Unfortunately, 0 is a really bad default, since textwrap cannot
work with a width of 0, causing tracebacks such as the one Mark
J Hewitt reported:
https://groups.google.com/g/bup-list/c/rfIw3STN2EY/m/C5Y3UrMIAgAJ

Fix this by not passing it through if there's no good value.

Reported-by: Mark J Hewitt <mjh@idnet.com>
Reported-by: Alexander Barton <alex@barton.de>
Fixes: cd3647c81a25 ("bup: pass TTY width through to sub-command and remote")
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/ssh.py