Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 70105 - emerge sync doesn't report error exit status
Summary: emerge sync doesn't report error exit status
Status: RESOLVED WONTFIX
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 120474
  Show dependency tree
 
Reported: 2004-11-04 15:56 UTC by Alessandro Zarrilli
Modified: 2006-02-01 22:22 UTC (History)
0 users

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


Attachments
patch for adding sys.exit(1) on deprecated profile (portage_deprecated_profile.patch,242 bytes, patch)
2004-11-07 17:03 UTC, Christopher Korn
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alessandro Zarrilli 2004-11-04 15:56:55 UTC
I use to run emerge sync on my servers in a simple nightly cron script: it launchs emerge sync and sends me an email in case it gets an exit status other than 0 (could happen because it can't connect any mirrors, for example). Today it happened that I manually launched emerge sync on a server and I got a message saying my profile has been deprecated. Then I tryed to echo $? but the result was surprisingly 0! So if I didn't manually run emerge sync I would never know my manual intervention was required to change profile. Wouldn't be better to have a not-0 exit status on any kind of "strage warning" emerge sync outputs? Here is the output I got:

[...cutted...]
deleting CVSROOT/commitinfo
deleting CVSROOT/checkoutlist
deleting directory CVSROOT
deleting .keep

Number of files: 99161
Number of files transferred: 1473
Total file size: 76908623 bytes
Total transferred file size: 2595837 bytes
Literal data: 2595837 bytes
Matched data: 0 bytes
File list size: 2232311
Total bytes written: 29641
Total bytes read: 4894978

wrote 29641 bytes  read 4894978 bytes  99487.25 bytes/sec
total size is 76908623  speedup is 15.62

>>> Updating Portage cache...  ...done!


!!! Your current profile is deprecated and not supported anymore.
!!! Please upgrade to the following profile if possible:
        default-linux/x86/2004.0

To upgrade do the following steps:
# emerge -n '>=sys-apps/portage-2.0.51'
# cd /etc/
# rm make.profile
# ln -s ../usr/portage/profiles/default-linux/x86/2004.0 make.profile




Performing Global Updates: /usr/portage/profiles/updates/4Q-2004
(Could take a couple of minutes if you have a lot of binary packages.)
  .='update pass'  *='binary update'  @='/var/db move'
  s='/var/db SLOT move' S='binary SLOT move' p='update /etc/portage/package.*'
...........................


Reproducible: Always
Steps to Reproduce:
emerge sync having a deprecated profile
Actual Results:  
0 exit status

Expected Results:  
1 (or something > 0) exit status
Comment 1 Christopher Korn 2004-11-07 17:03:42 UTC
Created attachment 43502 [details, diff]
patch for adding sys.exit(1) on deprecated profile

this should do it (i hope)
Comment 2 Marius Mauch (RETIRED) gentoo-dev 2004-11-08 13:23:20 UTC
The problem is that then you won't be able to update portage first (which pretty much is a requirement for cascading profiles).
Comment 3 Christopher Korn 2004-11-09 11:30:02 UTC
yes but for the future this would be nice :-)
Comment 4 Alec Warner (RETIRED) archtester gentoo-dev Security 2006-01-30 22:11:13 UTC
Not possible ( even now ) because you need to emerge a new version of portage.  Even setting your profile to the obsolete ones ( that don't have cascading ) you will still hit this.  Emerge cannot and should not exit here.
Comment 5 Alessandro Zarrilli 2006-01-31 08:26:02 UTC
(In reply to comment #4)
> Not possible ( even now ) because you need to emerge a new version of portage. 
> Even setting your profile to the obsolete ones ( that don't have cascading )
> you will still hit this.  Emerge cannot and should not exit here.

Maybe you got me wrong: I didn't want "emerge sync" to immediately sys.exit(1) whenever it finds a deprecated profile. I want "emerge sync" to do all its job until the end, exactly like it does in its actual version. I just would like "emerge sync" to finish with a sys.exit(1) (when if finished ALL of its job) if during its execution it found a deprecated profile.

What I aim to is to warn the administrator (by email) if the profile is deprecated and needs to be updated: as it is now, I need to grep all of the output of "emerge sync" looking for "current profile is deprecated". If "emerge sync" would finish its job with exit status 1, I would just check the exit status and my "emailing script" would be some way more "elegant" and safe too: what would happen if in future (due to a portage upgrade) the "current profile is deprecated" warning would change in "please upgrade your profile"? My script would wok no more!
Comment 6 Brian Harring (RETIRED) gentoo-dev 2006-01-31 10:01:41 UTC
(In reply to comment #5)
> (In reply to comment #4)
> Maybe you got me wrong: I didn't want "emerge sync" to immediately sys.exit(1)
> whenever it finds a deprecated profile. I want "emerge sync" to do all its job
> until the end, exactly like it does in its actual version. I just would like
> "emerge sync" to finish with a sys.exit(1) (when if finished ALL of its job) if
> during its execution it found a deprecated profile.
Won't happen.  This totally nukes the usefulness of exit codes for any users who are on a deprecated profile intentionally; folks will be just as pissed if their automated scripts suddenly start indicating failure due to this suggestion.

> What I aim to is to warn the administrator (by email) if the profile is
> deprecated and needs to be updated: as it is now, I need to grep all of the
> output of "emerge sync" looking for "current profile is deprecated". If "emerge
if ! emerge --sync; then do somethign with the exit_code
else if emerge --help 1> /dev/null 2>&1 | grep -i 'deprecated profile'; then do something with the match;
fi

Meanwhile... bugs resolution being invalid/wontfix doesn't strictly mean the idea/request is dead- just means in how we mark/track things, we are labelling it thus.  We still see the email when comments are made, so no need to be flipping resolution there (at least for a feature request).
Comment 7 Marius Mauch (RETIRED) gentoo-dev 2006-02-01 22:22:18 UTC
Actually it's sufficient to just check if /etc/make.profile/deprecated exists.