Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using --stdin always reports 0B #2136

Closed
TheLastProject opened this issue Jan 3, 2019 · 3 comments
Closed

Using --stdin always reports 0B #2136

TheLastProject opened this issue Jan 3, 2019 · 3 comments
Labels
state: need implementing cause/request established, need work/solution type: bug

Comments

@TheLastProject
Copy link

TheLastProject commented Jan 3, 2019

Output of restic version

restic 0.9.3 compiled with go1.11.1 on linux/amd64

How did you run restic exactly?

echo "test" | restic backup --stdin

What backend/server/service did you use to store the repository?

Azure

Expected behavior

Restic log shows "processed 1 file, 5 B in 0:00"

Actual behavior

Restic log shows "processed 1 file, 0 B in 0:00"

Do you have any idea what may have caused this?

The "filesize" seems to never be stored if the file is from stdin

Do you have an idea how to solve the issue?

Internally store processed filesize for stdin

@fd0
Copy link
Member

fd0 commented Jan 3, 2019

Oh, interesting, thanks for the report. Although your command line is slightly wrong, I suspect you meant echo test | restic backup --stdin?

@fd0 fd0 added type: bug state: need triaging need categorizing, labeling, next-step decision labels Jan 3, 2019
@TheLastProject
Copy link
Author

Oops, I edited the command, indeed meant restic backup

@fd0 fd0 added state: need implementing cause/request established, need work/solution and removed state: need triaging need categorizing, labeling, next-step decision labels Jan 6, 2019
fd0 added a commit that referenced this issue Jan 6, 2019
When restic reads the backup from stdin, the number of bytes processed
was always displayed as zero. The reason is that the UI for the archive
uses the total bytes as returned by the scanner, which is zero for
stdin. So instead we keep track of the real number of bytes processed
and print that at the end.

Closes #2136
@fd0
Copy link
Member

fd0 commented Jan 6, 2019

This was interesting. When restic saves a bunch of files, it first stats all of them and computes the sum of the file sizes to get the number of bytes that need to be processed. At the end of the run, that number is printed.

For backups read from stdin, restic does not know how many bytes will be read, so it just uses zero. That's what's printed at the end. #2138 will keep track of the number of bytes processed and print that at the end instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: need implementing cause/request established, need work/solution type: bug
Projects
None yet
Development

No branches or pull requests

2 participants