Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 48950 - econf should include || die in ebuilds
Summary: econf should include || die in ebuilds
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All All
: High minor (vote)
Assignee: Gentoo Quality Assurance Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-25 09:43 UTC by Aron Griffis (RETIRED)
Modified: 2007-03-26 07:00 UTC (History)
3 users (show)

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


Attachments
list of offending ebuilds (econf-no-die.txt,76.10 KB, text/plain)
2004-04-25 09:44 UTC, Aron Griffis (RETIRED)
Details
updated attachment to fix false hits (econf-no-die.txt,69.21 KB, text/plain)
2004-04-25 09:48 UTC, Aron Griffis (RETIRED)
Details
sorted list (econf-no-die.txt,71.45 KB, text/plain)
2004-04-25 09:55 UTC, Aron Griffis (RETIRED)
Details
remove more false positives (econf-no-die.txt,58.08 KB, text/plain)
2004-04-25 14:27 UTC, Aron Griffis (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aron Griffis (RETIRED) gentoo-dev 2004-04-25 09:43:47 UTC
resently the econf function in /usr/sbin/ebuild.sh calls die on its
own.  This is unfortunate, because die is designed to tell you at what
line, with a custom message, an ebuild failed.  When functions in
ebuild.sh call die directly, then both those features are thwarted.
The line number is useless (we don't _care_ where it died in
ebuild.sh) and the message is hard-coded.

It would be really good to (1) educate developers to never assume that
die() is called automatically from ebuild.sh, (2) fix the ebuilds to
call die when econf fails, (3) remove the automatic die from econf()
Comment 1 Aron Griffis (RETIRED) gentoo-dev 2004-04-25 09:44:46 UTC
Created attachment 30018 [details]
list of offending ebuilds
Comment 2 Aron Griffis (RETIRED) gentoo-dev 2004-04-25 09:48:25 UTC
Created attachment 30019 [details]
updated attachment to fix false hits

find . -name \*.ebuild | xargs perl -0777 -ne 's/\\\n/ /g; s/\n\s*assert\b/ ||
die/g; s/\beconf\b.*\bdie\b//g; s/#.*econf//g; /^.*\beconf\b.*$/m && print
"$ARGV: $&\n"' > econf-no-die.txt
Comment 3 Aron Griffis (RETIRED) gentoo-dev 2004-04-25 09:55:28 UTC
Created attachment 30021 [details]
sorted list

find . -name \*.ebuild | xargs perl -0777 -ne 's/\\\n/ /g; s/\n\s*assert\b/ ||
die/g; s/\beconf\b.*\bdie\b//g; s/#.*econf//g; while (/^.*\beconf\b.*$/mg) {
print "$ARGV: $&\n" }' | sort > econf-no-die.txt
Comment 4 Aron Griffis (RETIRED) gentoo-dev 2004-04-25 14:27:43 UTC
Created attachment 30039 [details]
remove more false positives

find . -name \*.ebuild | xargs perl -0777 -ne 's/\\\n/ /g; s/\n\s*assert\b/ ||
die/g; s/^.*\beconf\b.*\bdie\b.*//gm; s/#.*econf.*//g; while
(/^.*\beconf\b.*$/mg) { print "$ARGV: $&\n" }' | sort > econf-no-die.txt
Comment 5 Aron Griffis (RETIRED) gentoo-dev 2004-04-26 13:05:25 UTC
Ok, I finished #2, now for #1 and #3
Comment 6 Aron Griffis (RETIRED) gentoo-dev 2004-04-26 13:18:37 UTC
Here is what I did for #2, btw

$ sed -e 's/^..//; s|/[^/]*:.*||;' econf-no-die.txt | sort -u | while read p; do pushd $p; rm *.ebuild .#* ChangeLog; cvs up; echo "**** $p **************************************"; perl -0777 -i -pe 's/^[^#\n]*\beconf\b(?:.*?[^\\\n])*?(?=\n)/($t = $&) =~ m{\bdie\b} ? $t : $t . " || die \"econf failed\""/mges' *.ebuild; cvs diff || { read -p "Look good?" yesno </dev/tty; if [[ $yesno != [nN]* ]]; then echangelog "Add die following econf for bug 48950"; rc; else xterm; fi; }; popd; done

rc is a bash function that runs repoman commit with the most recent ChangeLog entry as the commit message.  This bash one-liner let me verify each cvs diff before hitting <enter> to make the commit.

I'm just posting this for interest's sake, and for future reference.
Comment 7 Mr. Bones. (RETIRED) gentoo-dev 2004-04-26 13:28:06 UTC
How about adding rc as an attachment for completion?
Comment 8 Aron Griffis (RETIRED) gentoo-dev 2004-04-26 13:53:56 UTC
I don't think it needs to be an attachment.  Here is rc() and er().  I didn't use er() in this exercise, but it is useful in other cases.  Most developers would need to modify the list of architectures in rc().  I develop for alpha, ia64 and x86, so I ignore repoman's complaining if it is made up of entirely other-architecture-specific problems.  Of course, this means that I refrain from using rc() in situations where I might have actually broken something related to another architecture.

# repoman commit with the message from the ChangeLog
rc ()  
{
  local msg=`perl <ChangeLog -00 -ne \
    's/^  \d{2} \w{3} \d{4};.*?:\n  //s and chomp, s/\s+/ /g, print($_), exit'`
  if [[ -z "$msg" ]]; then
      echo "no ChangeLog message found" 1>&2
      return 1
  fi  
  local out=`repoman commit -m "$msg" "$@" | tee /dev/tty`
  echo "$out" | grep -Eq 'CVS commit complete' && return 0
  echo "$out" | grep -Eq 'alpha|ia64|x86' && return 1
  repoman commit -m "$msg" --ignore-other-arches "$@"
}   
      
# echangelog and repoman combined
er() {
  rm -f ChangeLog
  cvs up ChangeLog || return 1
  echangelog "$*" || return 1
  rc
}
Comment 9 Aron Griffis (RETIRED) gentoo-dev 2004-05-25 12:10:01 UTC
testing bugzilla ... ignore this comment
Comment 10 Alec Warner (RETIRED) archtester gentoo-dev Security 2007-03-26 07:00:54 UTC
Can probably close this, die has supported tracebacks for nearly 12 months.  It should no longer matter if econf has || die after it or not.