mrrfv / open-android-backup

Back up your device without vendor lock-ins, using insecure software or root. Supports encryption and compression out of the box. Works cross-platform.
http://openandroidbackup.me/
GNU General Public License v3.0
751 stars 40 forks source link

Terminal prompts not correctly displayed in Putty (blank screen) #35

Closed pvint closed 1 year ago

pvint commented 1 year ago

Device info

Manufacturer: Samnsung Android version: 10 Custom ROM/rooted? No Model: Galaxy S9 SM-G970W

System info

Available disk space: 5+TB Operating system: Gentoo Linux / Windows 10


Describe the issue below. Just tried this out today and was rather confused for a while, as when I run it the terminal would clear and nothing would happen (blank screen). After some testing I determined that there was a prompt telling me that I had to hit enter to continue, but I had to scroll up to see it.

I have the phone connected to a Linux machine (Gentoo) and am connected to that via ssh using Putty in Windows 10. Note that everything is working, it was just confusing because I don't see the prompts.

Here's an example image while backup.sh is running: image If I scroll up I see the info/prompts: image

I played around a bit with a script, and it seems that tput init is causing this in the cecho function:


# "cecho" makes output messages yellow, if possible
function cecho() {
  if [ ! -v CI ]; then
    echo $(tput setaf 11)$1$(tput init)
  else
    echo $1
  fi
}

For reference, the text was not yellow, but if I change it to setaf 3 it is yellow (still not "scrolling" correctly). I have tried many different terminal sizes etc., and my $TERM variable shows as "xterm".

I'm wondering if there's an easy way to avoid this in the if [ ! -v CI ]; then on line 13, but unfortunately I'm not sure what CI is referring to.

pvint commented 1 year ago

Finally had another look at this, and simply removing the tput init on line 30 avoids the problem with the text being scrolled off the top of the screen:

Not working: echo $(tput setaf 11)$1$(tput init) Working: echo $(tput setaf 11)$1

In addition, I found my issue with the colours... it turns out that Putty (v0.78) was setting the terminal type to "xterm", which on my machine limited it to 8 colours. Changing the terminal type in "Connection->Data->Terminal type" to either xterm-256color or putty-256color resolves that.

image