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

Incorrect status shown on macOS cat in some circumstances #180

Closed
danielhoherd opened this issue May 19, 2023 · 2 comments
Closed

Incorrect status shown on macOS cat in some circumstances #180

danielhoherd opened this issue May 19, 2023 · 2 comments

Comments

@danielhoherd
Copy link

Description

I haven't dug too much into this, but when testing this tool out on macOS I noticed that consecutive cats to the same file show 100%, and also lack the remaining time. The conditions to create this aren't well understood, and it's possible this happens with other tools and not only when consecutively cating onto a file.

Example reproduction

$ ls -lh
total 269G
-rw-r--r-- 1 danielh staff  68G 2023-05-19T10:18:24 foo.tmp
-rw-r--r-- 1 danielh staff 201G 2023-05-19T10:17:03 tmp.1
$ rm -f tmp.1
$ ls -lh
total 69G
-rw-r--r-- 1 danielh staff 68G 2023-05-19T10:18:24 foo.tmp
$ for _ in {1..10} ; do cat foo.tmp >> bar.tmp ; done &
[1] 12562
$ progress -w ; ls -lh ;
[12563] cat /Users/danielh/temp/2023-05-19/foo.tmp
	45.5% (30.9 GiB / 68.0 GiB) 2.0 GiB/s remaining 0:00:18

total 100G
-rw-r--r-- 1 danielh staff 32G 2023-05-19T10:19:08 bar.tmp
-rw-r--r-- 1 danielh staff 68G 2023-05-19T10:18:24 foo.tmp
$ progress -w ; ls -lh ;
[12563] cat /Users/danielh/temp/2023-05-19/foo.tmp
	94.8% (64.5 GiB / 68.0 GiB) 2.0 GiB/s remaining 0:00:01

total 133G
-rw-r--r-- 1 danielh staff 65G 2023-05-19T10:19:21 bar.tmp
-rw-r--r-- 1 danielh staff 68G 2023-05-19T10:18:24 foo.tmp
$ progress -w ; ls -lh ;
[12582] cat /Users/danielh/temp/2023-05-19/bar.tmp
	100.0% (85.2 GiB / 85.2 GiB) 2.0 GiB/s

total 154G
-rw-r--r-- 1 danielh staff 86G 2023-05-19T10:19:30 bar.tmp
-rw-r--r-- 1 danielh staff 68G 2023-05-19T10:18:24 foo.tmp
$ progress -w ; ls -lh ;
[12582] cat /Users/danielh/temp/2023-05-19/bar.tmp
	100.0% (102.4 GiB / 102.4 GiB) 2.0 GiB/s

total 171G
-rw-r--r-- 1 danielh staff 103G 2023-05-19T10:19:36 bar.tmp
-rw-r--r-- 1 danielh staff  68G 2023-05-19T10:18:24 foo.tmp
$ progress -w ; ls -lh ;
[12582] cat /Users/danielh/temp/2023-05-19/bar.tmp
	100.0% (118.9 GiB / 118.9 GiB) 2.0 GiB/s

total 187G
-rw-r--r-- 1 danielh staff 119G 2023-05-19T10:19:42 bar.tmp
-rw-r--r-- 1 danielh staff  68G 2023-05-19T10:18:24 foo.tmp

Notes

This could be related to #140

@BestPig
Copy link
Contributor

BestPig commented May 19, 2023

It's not really an issue with progress, I understand your point of view, but your example cannot works with the progress implementation.

In your case, you have a file opened by cat, and another by your shell (probably bash), so progress will look at files opened by cat, and it will see only ones, so it's not possible for progress to be aware about the two files (source and dest), so it's not possible to compute a progress and also the ETA.

It's not a bug, for progress to works, it requires that the source and destination files are opened by the same process.

@danielhoherd
Copy link
Author

I see, that mostly makes sense. I don't understand how the first cat src >> dst works though. I don't need to know though, understanding that it's a limitation is enough.

it requires that the source and destination files are opened by the same process by the same process

This would be a great bit of information to add to the README.md, if it is indeed accurate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants