When doing a restic backup, the status line (which shows the % complete, size, # of files, etc.) sometimes doesn’t show the whole line - the part of the ETA gets cut off.
My command window is plenty wide.
Is there an inherent limit to the length of the status line?
There isn’t. Which OS and terminal emulator do you use? restic tries to find out how wide the window currently is and cuts off the status line accordingly. Can you reproduce the issue?
I’ve seen some weird display bugs (with restic and rclone) when the command prompt window was resized. Can you try changing the default size of the command prompt and not resizing it after its creation?
More information:
When I am running in the Cygwin window, I also never see the following messages:
repository b94e8466 opened successfully, password is correct
found 3 old cache directories in C:\Users\XXXX\AppData\Local\restic, pass --cleanup-cache to remove them
Looking at the restic source, both of those messages are conditioned by restic checking if the output is a TTY.
Apparently Cygwin is interfering with that check as well. Makes sense, since both the stdoutIsTerminal and stdoutTerminalWidth functions refer to the “golang.org/x/crypto/ssh/terminal” import.
But you may ask what’s your terminal?
I run restic with docker + k8s with tty: true
This might add just a spice of complexity, that’s why I made an extra effort debugging, but I haven’t been able to pinpint the issue.
Hm, interesting. Restic uses the ioctlTIOCGWINSZ on the file descriptor (here)
// GetSize returns the dimensions of the given terminal.
func GetSize(fd int) (width, height int, err error) {
ws, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ)
if err != nil {
return -1, -1, err
}
return int(ws.Col), int(ws.Row), nil
}
It looks like this call returned either 0, 0 or an error, in which case -1 is returned and then converted to 0 by restic here:
// only truncate interactive status output
var width int
if t.canUpdateStatus {
var err error
width, _, err = terminal.GetSize(int(t.fd))
if err != nil || width <= 0 {
// use 80 columns by default
width = 80
}
}
I don’t know why the ioctl failed, you could try to run this gist (via git clone https://gist.github.com/7a11999c5d0670287517527099e20879.git):
git clone https://gist.github.com/7a11999c5d0670287517527099e20879.git
cd 7a11999c5d0670287517527099e20879
go build
./termsizewidthtest
Make sure to run it in the same way as restic. I’ve also included a binary for Linux/amd64.
So we can see that the problem is on the go side and not on restic (or in my setup).
But:
Restic should update to the new golang.org/x/term
If the width of the terminal is 0, I it is not reasonable to trim the output - this is a bug
When piped or TERM="dumb" restic hides the progress logs even with --verbose is it intentional? Why?
Lots of things in internal/ui/termstatus/ seem, quote, “not well-written” and “complex”
So, @fd0, what is your vision on the terminal status and how it should work?
Why is it so hard to have a simple output where restic spits out line by line of what it is doing?