Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 134488 - portage-utils-0.1.17: fix for qdepend being "such a fatty"
Summary: portage-utils-0.1.17: fix for qdepend being "such a fatty"
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: solar (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-27 02:53 UTC by TGL
Modified: 2006-07-09 22:36 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
qdepends-0.1.17-bigger-eat_file-buffers.patch (qdepends-0.1.17-bigger-eat_file-buffers.patch,1.05 KB, patch)
2006-05-27 02:54 UTC, TGL
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description TGL 2006-05-27 02:53:35 UTC
qdepend has an 8 KB limit on the *DEPEND files it can eat. But this is not enough with a few packages:

% q depends -a -Q foo/bar
 * DEPEND
depends: i'm such a fatty, could not eat_file(/var/db/pkg/dev-lang/php-5.1.4/DEPEND)
depends: i'm such a fatty, could not eat_file(/var/db/pkg/x11-base/xorg-x11-7.0-r1/DEPEND)
 * RDEPEND
depends: i'm such a fatty, could not eat_file(/var/db/pkg/dev-lang/php-5.1.4/RDEPEND)
depends: i'm such a fatty, could not eat_file(/var/db/pkg/x11-base/xorg-x11-7.0-r1/RDEPEND)
 * PDEPEND
depends: i'm such a fatty, could not eat_file(/var/db/pkg/x11-base/xorg-server-1.1.0/PDEPEND)

On my system, the biggest *DEPEND files in vdb are rather around 10 KB:

% find /var/db/pkg/ -type f -name "*DEPEND" -printf "%s %p\n" | sort -n | tail
1716 /var/db/pkg/media-video/mplayer-1.0.20060415/RDEPEND
1752 /var/db/pkg/x11-base/xorg-server-1.1.0/DEPEND
1896 /var/db/pkg/x11-libs/wxGTK-2.6.3.2/DEPEND
2291 /var/db/pkg/media-video/mplayer-1.0.20060415/DEPEND
2785 /var/db/pkg/gnome-base/gnome-2.14.1/RDEPEND
8186 /var/db/pkg/dev-lang/php-5.1.4/RDEPEND
8319 /var/db/pkg/dev-lang/php-5.1.4/DEPEND
10216 /var/db/pkg/x11-base/xorg-x11-7.0-r1/RDEPEND
10248 /var/db/pkg/x11-base/xorg-x11-7.0-r1/DEPEND
11436 /var/db/pkg/x11-base/xorg-server-1.1.0/PDEPEND

The attached patch changes this limit to 16 KB (in functions "qdepends_vdb_deep()" and "qdepends_main_vdb()").  Btw, you may want to go with something even bigger, like 32 KB, just to be safe: this buffers are allocated 3 times at most (when using the "-a" option), so it should not have any significant performance inpact.

Also, in "qdepends_main_vdb()", my patch decreases the filename buffer size ("buf") from 8KB to whatever _Q_PATH_MAX is (4KB here i think), like it was already done in "qdepends_vdb_deep()".

And finally, it fixes two wrong calls to "eat_file()", which were using the filename buffer size as the max file size limit, instead of using the target buffer size (happened to work before, since both were 8 KB, but would have break with the above changes).
Comment 1 TGL 2006-05-27 02:54:07 UTC
Created attachment 87623 [details, diff]
qdepends-0.1.17-bigger-eat_file-buffers.patch
Comment 2 TGL 2006-06-04 23:32:29 UTC
Ping.

From what i see on cvsweb [1], only half this issue has been fixed in portage-utils-0.1.18:  qdepends_main_vdb() is still using an 8KB buffer, and is still calling eat_file with a wrong buffer size argument.  
Also, i think increasing the "buf" size to "Q_PATH_MAX*2" was useless: it's a file path, and won't be usable anyway if longer than Q_PATH_MAX. As for increasing the "use" buffer size, although it can't hurt, it doesn't sound much useful neither (there is currently only ~2KB of global flags in use.desc). 

[1] http://www.gentoo.org/cgi-bin/viewcvs.cgi/portage-utils/qdepends.c?r1=1.36&r2=1.37&root=gentoo-projects
Comment 3 solar (RETIRED) gentoo-dev 2006-06-05 04:45:46 UTC
Thanks. Fixed in CVS revision 1.38 
.18 will be short lived so this chnage should hopefully not take 
long to hit the tree.
Comment 4 TGL 2006-07-09 22:36:56 UTC
Closing since this is fixed in 0.1.19.