Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 38355 - gentoolkit pkg-size uses `grep total` but this string isn't "total" in all languages
Summary: gentoolkit pkg-size uses `grep total` but this string isn't "total" in all la...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-15 16:38 UTC by Priit Külaots
Modified: 2004-02-16 06:16 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Priit Külaots 2004-01-15 16:38:11 UTC
app-portage/gentoolkit
Latest version available: 0.1.38
Latest version installed: 0.1.38

This is really silly bug. pkg-size grep's total, but when i don't use english locale, then the word total might be translated and grep returns zero lines.
totals=`cat $file|grep "obj"|awk '{ print $2 }' | sed "s/ /\\ /" | xargs du -scb | grep total | cut -f 1`

Reproducible: Always
Steps to Reproduce:
1. LANG=et_EE pkg-size net-misc/openssh-3.7.1_p2-r1
Openssh is just example, bug occures with any package.
Actual Results:  
# LANG=et_EE pkg-size net-misc/openssh-3.7.1_p2-r1
net-misc/openssh-3.7.1_p2-r1 0 (0KB)
this is wrong, in Estonian locale it is "1456602 kokku" instead "1456602 total" 
expected

Expected Results:  
# LANG=C pkg-size net-misc/openssh-3.7.1_p2-r1
net-misc/openssh-3.7.1_p2-r1 1456602 (1422KB)


Solution:
Instead of `grep total` `tail -n 1` can be used as total is the last line of 
`du`

and is there real meaning in:
size=0
for i in $totals ; do
 size=$[size+i]
done

`cat $file` cat's one file and $totals is one number, so $size would be exactly 
the same as $totals, right?

This script can be improved, like when i do `pkg-size open` then the result 
would be:
dev-libs/openssl-0.9.7c 7254890 (7084KB)
net-misc/openssh-3.7.1_p2-r1 1456602 (1422KB)
now it returns only first matching package name.
Comment 1 Marius Mauch (RETIRED) gentoo-dev 2004-02-16 06:16:46 UTC
deprecated tool, use `equery size <package>` instead