progress icon indicating copy to clipboard operation
progress copied to clipboard

doesn't show progress of running mv command

Open dhowe opened this issue 8 years ago • 23 comments

$ jobs
[3]+  Running                 sudo mv ~/Documents /Volumes/MEDIA/ &

$ sudo progress -c mv
$

OSX 14.5.0 Darwin Kernel Version 14.5.0 RELEASE_X86_64 x86_64

image

Same result if the process is in the foreground

dhowe avatar Jun 17 '17 12:06 dhowe

FYI, no such issue on my Linux system, will need help of OSX users.

Xfennec avatar Jun 19 '17 07:06 Xfennec

happy to help if I can...

dhowe avatar Jun 19 '17 07:06 dhowe

Are you able to do debug? (by changing source code and recompiling it or/and using a debugger for you platform)

Xfennec avatar Jun 19 '17 08:06 Xfennec

sure, I can compile and run lldb (gdb has issues on current osx)

dhowe avatar Jun 19 '17 10:06 dhowe

Cool, the first thing would be to check that progress is actually able to "detect" the running mv command, see find_pids_by_binary_name and check its return. If this part is OK, the next stop is find_fd_for_pid. This function should return something about the files you're currently moving.

Xfennec avatar Jun 19 '17 10:06 Xfennec

Can you run the following command ? readlink -f $(which mv)

I think you don't use real mv binary. Did you have install coreutils binaries with port or brew ?

BestPig avatar Jun 19 '17 10:06 BestPig

I've installed coreutils 8.27 with brew

$ greadlink -f /bin/mv /bin/mv

dhowe avatar Jun 19 '17 10:06 dhowe

the first thing would be to check that progress is actually able to "detect" the running mv command, see find_pids_by_binary_name and check its return

a good way to simulate a long-running mv ?

dhowe avatar Jun 19 '17 10:06 dhowe

I do see the pid for the 'mv' command in the debugger in 'find_pids_by_binary_name' But when I enable the the printf in the 'find_fd_for_pid',

printf("[debug] %s\n",vnodeInfo.pvip.vip_path);

a bunch of files are printed, but not those being moved:

screen shot 2017-06-19 at 7 03 19 pm

dhowe avatar Jun 19 '17 10:06 dhowe

If you use coreutils from brew your binary is probably gmv and not mv.

Have you tried to use progress -c gmv

BestPig avatar Jun 19 '17 11:06 BestPig

That doesn't help. Though two things I notice: 1) mv spawns two pids for a single 'mv', and 2) progress has a different output when looking for mv and gmv

$ ps aux | grep mv
dhowe           30359  16.8  0.0  2461436   1696 s003  U+    7:32PM   0:05.35 mv -PRp -- Music ../MEDIA/Music
dhowe           30358   0.0  0.0  2441972    564 s003  S+    7:32PM   0:00.00 mv Music ../MEDIA/
$ sudo progress -c gmv
No such command(s) running: gmv, or wrong permissions.
$ sudo progress -c mv
$

dhowe avatar Jun 19 '17 11:06 dhowe

It works if you use the PID of the process?

BestPig avatar Jun 19 '17 11:06 BestPig

No

$ ps aux | grep mv
dhowe           30698   5.5  0.0  2461436   1756 s003  U+    8:09PM   0:00.10 mv -PRp -- Ads ../MEDIA/Ads
dhowe           30697   0.0  0.0  2432756    540 s003  S+    8:09PM   0:00.00 mv Ads ../MEDIA/
$ progress -p 30697
$ progress -p 30698
$

dhowe avatar Jun 19 '17 12:06 dhowe

No problem with me on OS X 10.11.6. Are you using Sierra (10.12) ?

BestPig avatar Jun 19 '17 16:06 BestPig

Yosemite 10.10.5

dhowe avatar Jun 19 '17 17:06 dhowe

I just installed Yosemite 10.10.5 for testing. I face no problem to monitor cp/gcp/mv/gmv with name or using PID.

Can you run it with lldb ?

$ lldb progress
(lldb) target create "progress"
Current executable set to 'progress' (x86_64).
(lldb) r -c gcp -c cp

And write the output here?

BestPig avatar Jun 20 '17 18:06 BestPig

$ lldb ./progress
(lldb) target create "./progress"
Current executable set to './progress' (x86_64).
(lldb) r -c gcp -c cp
Process 15943 launched: './progress' (x86_64)
No such command(s) running: gcp, cp, or wrong permissions.
Process 15943 exited with status = 0 (0x00000000) 

dhowe avatar Jun 20 '17 18:06 dhowe

Launch a long cp command before doing it ;)

BestPig avatar Jun 20 '17 18:06 BestPig

Don't want to interfere, and my knowledge of the OSX world is close to nil, but can't the issue be related to the context of this particular copy? It may be interesting to create a controlled context that is known to works correctly. (create a test file in a specific way and move it to a specific destination)

(sparse file, unusual external device / network destination, too much files, unusually complex tree, ...)

Xfennec avatar Jun 20 '17 18:06 Xfennec

The above was with a long 'cp' (of a single file on a single partition) running. But yes, some reproducible simulation of a mv or cp would be useful (as suggested above)

dhowe avatar Jun 20 '17 19:06 dhowe

My bad, I give you a bad command if you use mv (as always). Run with r -c gmv -c mv in lldb

Personally I was running my test on a network share to have slow command, and it works perfectly well. I not sure there is a difference with the used media, the system always have a cursor on the file descriptor.

BestPig avatar Jun 20 '17 19:06 BestPig

Related: https://github.com/Xfennec/progress/issues/137

mcandre avatar Oct 13 '20 15:10 mcandre

I am still seeing the same issue on Catalina 10.15.7.

✦ ❯ ps aux | grep mv
vikas             5268   0.0  0.0  4276376    572 s000  U+    1:08am   0:00.00 mv -v *.jpg 20201225_032542000_iOS.MOV 20201225_032645000_iOS.MOV 20201226_025342000_iOS.MOV 20201226_030510000_iOS.MOV 20201227_084343000_iOS.MOV 20201227_090316000_iOS.MOV 20201229_015902000_iOS.MOV 20201229_040116000_iOS.MOV 20201230_060045000_iOS.MOV /Users/vikas027/Documents/PIX/JAN/

I have tried a few switches in vain.

✦ ❯ progress -w
~
✦ ❯
✦ ❯ progress -p 5268
~
✦ ❯ progress -p 5268 -w
~
✦ ❯
✦ ❯ progress -c mv
~
✦ ❯
✦ ❯ progress -p 5268 -c mv
~
✦ ❯

vikas027 avatar Dec 31 '20 14:12 vikas027