Talk:Emerge/Watch emerge progress
From Gentoo Linux Wiki
Sometimes I get a divide by zero exception. I think this is when a package is unpacked, but before any code gets compiled. This could probably easily be avoided somehow, with a simple check for zero. Or adding 1 to the numerator and denominator.
This is fixed in the second script and/or the C++ program. I have also found out that the second script and the C++ programm give different results. That includes found ~C and ~O files.
Contents |
[edit] C++ App Bugs
I found out why your program shows stale compiles:
in the /var/tmp/portage directory (where all the work is done on the apps) portage neglects to delete the work folder underneath canceled compiles. After deleting all the work folders for stale compiles they all disappeared in your program. Hope this helps!
-ObsidianX
Actually portage doesn't neglect to remove it. The files are left there to be able to do an 'emerge --resume'.
[edit] eprogress.cpp error
Compiling eprogress.cpp ends up with an error:
eprogress2.cpp: In function `int main()': eprogress2.cpp:44: error: invalid initialization of reference of type 'int&' m expression of type 'unsigned int' eprogress2.cpp:14: error: in passing argument 2 of `int countfiles(char*, int int&)' eprogress2.cpp:51: error: invalid conversion from `const char*' to `char*' eprogress2.cpp: In function `int countfiles(char*, int&, int&)': eprogress2.cpp:90: error: `tmp' was not declared in this scope eprogress2.cpp:91: error: `tmp' was not declared in this scope
any ideas?
The program appears broken at the moment:
// We've found a file, increment the count
//the usage of "tmp" in the following 2 statements is the only remaining brokenness in this code ATM..
for (c=0; c<srccount;++c) if (strstr(tmp, src[c]) !=NULL) T++;
for (c=0; c<objcount;++c) if (strstr(tmp, obj[c]) !=NULL) D++;
The code needs looking at. I might do this after my exams. (BTW: has there ever been any word of a progress bar being officially implemented in emerge?)
[edit] Perl Wrapper
What do you mean with: "Here's a new script for those of you still using emerge."? What would be an alternative?
Meaning if one of the above solutions didn't work for you, or if someone is using porthole, etc. --GBob 16:38, 28 Apr 2005 (GMT)
I was just having a look at the code and have some minor suggestions
-- if($line =~ m/^yes$/i){
-- return 1;
-- }
-- if($line =~ m/^no$/i){
-- return 0;
-- }
-- if($line =~ m/^y$/i){
-- return 1;
-- }
-- if($line =~ m/^n$/i){
-- return 0;
-- }
-- return -1;
++ return 1 if ($line =~ /^(yes|y)$/i);
++ return 0 if ($line =~ /^no?$/i);
++ return -1;
-- my $TOT=`cat /tmp/emerge.cur.build | wc -l`;
++ my $TOT=`wc -l /tmp/emerge.cur.build`;
Also I'd suggest using something like Getopt::Std, Getopt::Long, Getopt::Mixed --Bin-doph 11:54, 19 August 2005 (GMT)
Someone reading this article is more likely interested in the final result not the whole log of the project. I think this is a nice topic, but should be cleaned up to always show the latest solution and not serve as revision history.
Do these many methods off much over 'tail -f /var/log/portage'?
[edit] Current C++ App (4.21) doesnt seem to work
Hi
Current C++ App (4.21) doesnt work for me. Simply shows nothing but its version. In the Wikis history i foun an old one (4.20) which works pretty good. Someone check that plz??
[edit] Security issue: overwrite any file writeable by user that runs "emake"
The "emake" script uses two temporary files with predicable names and these files are written in a world-writeable directory. This means:
- Anyone (any user) can mess with these files, making the progress information unreliable.
- Anyone can create a symlink with the name of one of those files, pointing to anywhere. This means the file will be overwritten by the user running "emake" command (usually root user or portage user, depending on FEATURES).
For example, if an angry user makes a symlink /tmp/emerge.$name.build or /tmp/emake.$name.edone pointing to any /etc file, the sysadmin will have big troubles. -- CrazyTerabyte 01:16, 10 January 2007 (UTC)
