FS#11355 - cb_dl_progress returns always 0 on file_total
Attached to Project:
Pacman
Opened by Dario Freddi (drf) - Sunday, 31 August 2008, 18:33 GMT
Last edited by Dan McGee (toofishes) - Thursday, 04 September 2008, 15:38 GMT
Opened by Dario Freddi (drf) - Sunday, 31 August 2008, 18:33 GMT
Last edited by Dan McGee (toofishes) - Thursday, 04 September 2008, 15:38 GMT
|
Details
I have some problems with the new callback interface. In
fact in the following callback:
cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total) file_total is always 0 to me. Everything else works correctly. Everything I do is registering it by calling alpm_option_set_dlcb(cb_dl_progress); just as I did in the earlier version, since pacman handles this callback correctly, I wonder where I'm going wrong. This can be seen in Shaman latest SVN. Thanks Dario |
This task depends upon
Closed by Dan McGee (toofishes)
Thursday, 04 September 2008, 15:38 GMT
Reason for closing: Won't fix
Additional comments about closing: not a bug in alpm, feel free to re-open otherwise
Thursday, 04 September 2008, 15:38 GMT
Reason for closing: Won't fix
Additional comments about closing: not a bug in alpm, feel free to re-open otherwise
I built shaman and tried it for the first time (looks pretty cool btw, package browsing in a gui is nice), and I don't know, the download progress seemed to work.
So how could it work if file_total was not set correctly? I think it is fine here.
Or probably you need to explain how to reproduce the problem :)
Also, does pacman work for you?
Total progress works since I'm using the new totaldownload callback for it. What is wrong is the single file download.
If you try downloading a package, I always get 0KB as total size, that is exactly what file_total returns. I have attached a screenshot, where you can see what's the problem. Pacman seems to work correctly.
FS#11339?Have a look at the git commit log of the patch I posted there.
The totaldownload callback is not always called, it is only called when it is useful (when several files are downloaded in a row). So you should just handle the case where list_total == 0 just like the case where totaldownload is disabled (having a look at my patch will help there too).
There is still one thing not clear. totaldownload should always be set for the packages downloading of a -S operation. So what is exactly happening in the screenshot, is it a -S operation too, or something else?
Totaldownload works like a charm, and I use it for drawing the progress bar, hence the total percentage. The problem is that every file I download has a total size of 0, as you can see in the screenshot when you see "6000KB of 0KB". In the screenshot is happening the equivalent of an -Su operation.
I had to perform a small hack to make the progressbar behave correctly (you can have a look at callbacks.cpp) since I couldn't get the total file size of a single package, this is why it works.
Thanks for the quick help anyway!
Otherwise, the svn browser is not available here : http://shaman-arch.svn.sourceforge.net/viewvc/shaman-arch/
My suggestion would be to build your own copy of libalpm, where you can add debug statements, in the section where file_total is computed (ust.size which is set by libdownload), and just before the dlcb calls are made, in lib/libalpm/dload.c
We really need to figure out what is wrong here.
if ( last_file_xfered > file_xfered )
last_file_xfered = 0;
list_xfered += file_xfered - last_file_xfered;
last_file_xfered = file_xfered;
You're right, I'll try to do what you say and if something's wrong I'll send you a patch, thanks!