Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 128464 - /usr/portage/eclass/linux-info.eclass bash script bug (function kernel_is)
Summary: /usr/portage/eclass/linux-info.eclass bash script bug (function kernel_is)
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-01 20:06 UTC by Sid Kode
Modified: 2006-04-01 20:54 UTC (History)
0 users

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


Attachments
patch for the bug (linux-info.eclass.patch,1012 bytes, patch)
2006-04-01 20:07 UTC, Sid Kode
Details | Diff
'emerge hal' fails incorrectly without the patch. (emerge_--verbose_--debug_hal.log,25.77 KB, text/plain)
2006-04-01 20:10 UTC, Sid Kode
Details
'emerge hal' fails correctly with the patch added. (emerge_--verbose_--debug_hal.log.corrected,30.66 KB, text/plain)
2006-04-01 20:12 UTC, Sid Kode
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sid Kode 2006-04-01 20:06:24 UTC
To reproduce this bug:
run 'emerge hal' with a Linux kernel 2.6.12 or lower

I don't have too much experience in bash scripting (so correct me if I'm wrong) but I think this is a syntax error in linux-info.eclass (in function kernel_is):
Basically add '$' in front of 'y'.  I have added a proposed patch here:

--- linux-info.eclass	2006-04-02 04:39:18.000000000 -0500
+++ linux-info.eclass.corrected	2006-04-02 04:40:33.000000000 -0500
@@ -178,16 +178,16 @@
 	esac
 
 	for x in ${@}; do
-		for((y=0; y<$((3 - ${#x})); y++)); do value="${value}0"; done
+		for((y=0; $y<$((3 - ${#x})); y++)); do value="${value}0"; done
 		value="${value}${x}"
 		z=$((${z} + 1))
 
 		case ${z} in
-		  1) for((y=0; y<$((3 - ${#KV_MAJOR})); y++)); do test="${test}0"; done;
+		  1) for((y=0; $y<$((3 - ${#KV_MAJOR})); y++)); do test="${test}0"; done;
 		     test="${test}${KV_MAJOR}";;
-		  2) for((y=0; y<$((3 - ${#KV_MINOR})); y++)); do test="${test}0"; done;
+		  2) for((y=0; $y<$((3 - ${#KV_MINOR})); y++)); do test="${test}0"; done;
 		     test="${test}${KV_MINOR}";;
-		  3) for((y=0; y<$((3 - ${#KV_PATCH})); y++)); do test="${test}0"; done;
+		  3) for((y=0; $y<$((3 - ${#KV_PATCH})); y++)); do test="${test}0"; done;
 		     test="${test}${KV_PATCH}";;
 		  *) die "Error in kernel-2_kernel_is(): Too many parameters.";;
 		esac



output from my 'emerge --verbose --debug --info' is as follows:

-*- mode: compilation; default-directory: "~/home/workspace/install/emerge/update/10/" -*-
Compilation started at Sun Apr  2 04:26:39

emerge --verbose --debug --info
Portage 2.0.54 (default-linux/x86/2006.0, gcc-3.3.5-20050130, glibc-2.3.5-r1, 2.6.11-gentoo-r11 i686)
=================================================================
System uname: 2.6.11-gentoo-r11 i686 AMD Athlon(tm) XP Processor 2800+
Gentoo Base System version 1.6.14
dev-lang/python:     2.3.5, 2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE=""
ADA_INCLUDE_PATH="/usr/lib/ada/adainclude/gtkada"
ADA_OBJECTS_PATH="/usr/lib/ada/adalib/gtkada"
ALTERNATE_EDITOR="xemacs -vanilla"
ANT_HOME="/usr/share/ant-core"
ARCH="x86"
ASFLAGS="-Wa,--gen-debug -Wa,-K -Wa,--warn"
AUTOCLEAN="yes"
BASH_ENV="/etc/spork/is/not/valid/profile.env"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp	-pipe	-Wall -W	-ggdb3 -O0"
CHOST="i686-pc-linux-gnu"
CLASSPATH="."
CLEAN_DELAY="5"
COLUMNS="179"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CVSIGNORE="cscope.files cscope.out cscope.out.in cscope.out.po *.i *.ii gdb.txt"
CVSROOT="rip@sidkode.homelinux.net:/var/cvs/repos"
CVS_RSH="ssh"
CXXFLAGS="-march=athlon-xp	-pipe	-Wall -W	-ggdb3 -O0"
DISPLAY=":0.0"
DISTDIR="/usr/portage/distfiles"
EDITOR="emacs --background-color=black --foreground-color=white --directory=/home/rip/home/bin/emacs-lisp --no-windows --basic-display --quick"
ELIBC="glibc"
EMACS="t"
EMERGE_WARNING_DELAY="10"
FCEDIT="emacs --background-color=black --foreground-color=white --directory=/home/rip/home/bin/emacs-lisp --no-windows --basic-display --quick"
FEATURES="autoconfig distlocks noclean nostrip sandbox sfperms strict"
FETCHCOMMAND="/usr/bin/wget -t 5 --passive-ftp -P ${DISTDIR} ${URI}"
FLTK_DOCDIR="/usr/share/doc/fltk-1.1.6/html"
GCC_SPECS=""
GDK_USE_XFT="1"
GENTOO_MIRRORS="http://mirror.espri.arizona.edu/gentoo/ ftp://ftp.gtlib.cc.gatech.edu/pub/gentoo ftp://ftp.ndlug.nd.edu/pub/gentoo/ http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
GUILE_LOAD_PATH="/usr/share/guile/1.6"
G_BROKEN_FILENAMES="1"
HISTFILESIZE="100000"
HISTSIZE="100000"
HISTTIMEFORMAT="%c%t%t"
HOME="/root"
HOSTNAME="localhost"
INFOPATH="/usr/share/info:/usr/share/binutils-data/i686-pc-linux-gnu/2.15.92.0.2/info:/usr/share/gcc-data/i686-pc-linux-gnu/3.3.5-20050130/info:/usr/share/info/emacs-22.0.50:/usr/share/info/emacs-21"
JAVAC="/opt/blackdown-jdk-1.4.2.02/bin/javac"
JAVA_HOME="/opt/blackdown-jdk-1.4.2.02"
JDK_HOME="/opt/blackdown-jdk-1.4.2.02"
KDEDIRS="/usr"
KERNEL="linux"
LDFLAGS="-Wl,--warn-constructors,--warn-common,--warn-section-align,--warn-multiple-gp -Wl,--trace"
LESS="-R"
LESSOPEN="|lesspipe.sh %s"
LOGNAME="root"
MAIL="/var/mail/root"
MAILCHECK="3600"
MAKEOPTS="-w"
MANPATH="/usr/local/share/man:/usr/share/man:/usr/share/binutils-data/i686-pc-linux-gnu/2.15.92.0.2/man:/usr/share/gcc-data/i686-pc-linux-gnu/3.3.5-20050130/man::/opt/blackdown-jdk-1.4.2.02/man:/usr/qt/3/doc/man:/opt/insight/man"
MOZILLA_FIVE_HOME="/usr/lib/mozilla"
MY_ASFLAGS="--gen-debug -K --warn"
MY_BASE_CFLAGS="-pipe	-Wall -W -Winline -Wtraditional -Wunreachable-code -Wdisabled-optimization -Wstack-protector -Wformat=2 -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wbad-function-cast -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Waggregate-return -Wpadded -Wredundant-decls -Wnested-externs -Wlong-long -Wlarger-than-1024 -Wunknown-pragmas"
MY_BASE_CXXFLAGS=""
MY_BASE_DF_FLAGS="--human-readable --all --print-type"
MY_BASE_LDFLAGS="-Wl,--warn-constructors,--warn-common,--warn-section-align,--warn-multiple-gp -Wl,--trace,--verbose"
MY_BASE_LS_FLAGS="--all --format=verbose --human-readable --color=auto --quoting-style=escape --inode --size --sort=extension"
MY_BINARIES_DIRECTORY="/home/rip/home/bin"
MY_CFLAGS="-pipe	-Wall -W -Winline -Wtraditional -Wunreachable-code -Wdisabled-optimization -Wstack-protector -Wformat=2 -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wbad-function-cast -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Waggregate-return -Wpadded -Wredundant-decls -Wnested-externs -Wlong-long -Wlarger-than-1024 -Wunknown-pragmas -ggdb3 -O0"
MY_CLAMSCAN_LOG="/root/tmp/clamscan/clamscan.log"
MY_CPPFLAGS=""
MY_CXXFLAGS="-pipe	-Wall -W -Winline -Wtraditional -Wunreachable-code -Wdisabled-optimization -Wstack-protector -Wformat=2 -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wbad-function-cast -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Waggregate-return -Wpadded -Wredundant-decls -Wnested-externs -Wlong-long -Wlarger-than-1024 -Wunknown-pragmas -ggdb3 -O0"
MY_DU_DB="/root/tmp/du.log"
MY_EMACS_LISP_SCRIPTS_DIRECTORY="/home/rip/home/bin/emacs-lisp"
MY_ETHERNET_INTERFACE="eth0"
MY_FFLAGS="-pipe	-Wall -W -Winline -Wtraditional -Wunreachable-code -Wdisabled-optimization -Wstack-protector -Wformat=2 -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wbad-function-cast -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Waggregate-return -Wpadded -Wredundant-decls -Wnested-externs -Wlong-long -Wlarger-than-1024 -Wunknown-pragmas -ggdb3 -O0"
MY_FIND_DB="/root/tmp/find.log"
MY_GCOVFLAGS="--branch-counts --branch-probabilities --function-summaries"
MY_GNU_EMACS_BASE="emacs --background-color=black --foreground-color=white --directory=/home/rip/home/bin/emacs-lisp --no-windows --basic-display"
MY_GNU_EMACS_BASE_FLAGS="--background-color=black --foreground-color=white --directory=/home/rip/home/bin/emacs-lisp --no-windows --basic-display"
MY_GNU_EMACS_LITE="emacs --background-color=black --foreground-color=white --directory=/home/rip/home/bin/emacs-lisp --no-windows --basic-display --quick"
MY_GNU_EMACS_LITE_FLAGS="--background-color=black --foreground-color=white --directory=/home/rip/home/bin/emacs-lisp --no-windows --basic-display --quick"
MY_GPROFFLAGS=""
MY_GTK_CMD_OPTIONS="--g-fatal-warnings --sync --gtk-debug=all --gdk-debug=all"
MY_JFLAGS="-g"
MY_LDFLAGS="-Wl,--warn-constructors,--warn-common,--warn-section-align,--warn-multiple-gp -Wl,--trace,--verbose "
MY_LFLAGS="-d"
MY_LIBS=""
MY_LOCATE_PATH="/root/tmp/locatedb"
MY_LS_DB="/root/tmp/ls.log"
MY_MAKEOPTS="-w"
MY_OPTIMIZE_CFLAGS="-pipe	-Wall -W -Winline -Wtraditional -Wunreachable-code -Wdisabled-optimization -Wstack-protector -Wformat=2 -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wbad-function-cast -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Waggregate-return -Wpadded -Wredundant-decls -Wnested-externs -Wlong-long -Wlarger-than-1024 -Wunknown-pragmas -g0 -O3 -fomit-frame-pointer -fforce-addr -fgcse-sm -fgcse-las -fgcse-after-reload -finline-limit=99999 -fmerge-all-constants -fmodulo-sched -freschedule-modulo-scheduled-loops -ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fivopts -ftree-vectorize -ffast-math -ftracer -fsched-spec-load-dangerous -fprofile-generate -fprofile-use -fvisibility=hidden"
MY_OPTIMIZE_CXXFLAGS="-fno-implicit-templates -fvisibility-inlines-hidden"
MY_OPTIMIZE_LDFLAGS="-Wl,--warn-constructors,--warn-common,--warn-section-align,--warn-multiple-gp -Wl,--trace,--verbose -Wl,-O1 -Wl,--relax,--strip-all"
MY_QT4_STYLE="windows"
MY_REPOSITORY_SERVER="sidkode.homelinux.net"
MY_REPOSITORY_SERVER_USERNAME="rip"
MY_SERVER="sidkode.homelinux.net"
MY_TMP="/root/tmp"
MY_TMP_CLAMSCAN="/root/tmp/clamscan"
MY_TMP_EMACS="/root/tmp/emacs"
MY_TMP_EMACS_GNUS="/root/tmp/emacs/gnus"
MY_VC_HOME_DIRECTORY="/home/rip/home"
MY_WGET_FLAGS="--verbose --timestamping	--recursive --page-requisites --no-parent --convert-links --level=0 --dont-remove-listing --follow-ftp --span-hosts	--append-output=/root/tmp/wget.log"
MY_XEMACS_LITE="xemacs -vanilla"
MY_YFLAGS="--debug --verbose"
NNTPSERVER="ext-news.utexas.edu"
OPENGL_PROFILE="nvidia"
ORGANIZATION="GNU"
PAGER="/usr/bin/less"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/3.3.5-20050130:/usr/i386-pc-linux-gnu/gcc-bin/3.3.5:/opt/blackdown-jdk-1.4.2.02/bin:/opt/blackdown-jdk-1.4.2.02/jre/bin:/usr/qt/3/bin:/usr/kde/3.4/sbin:/usr/kde/3.4/bin:/root/home/bin:/opt/bin:/root/opt/bin"
PKGDIR="/usr/portage/packages"
PORTAGE_ARCHLIST="alpha amd64 arm hppa ia64 m68k mips ppc ppc64 ppc-macos s390 sh sparc x86"
PORTAGE_BINHOST_CHUNKSIZE="3000"
PORTAGE_CALLER="emerge"
PORTAGE_DEBUG="1"
PORTAGE_GID="250"
PORTAGE_MASTER_PID="13700"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORT_LOGDIR="/root/tmp/portage"
PRELINK_PATH=""
PRELINK_PATH_MASK="/usr/lib/gstreamer-0.8:/lib/modules:/usr/lib/locale:/usr/lib/wine:/usr/lib/valgrind:*.la:*.png:*.py:*.pl:*.pm:*.sh:*.xml:*.xslt:*.a:*.js"
PS4="	[ ${BASH_SOURCE[0]:-<stdin>}:${FUNCNAME[0]:-<global>}:${LINENO} ]		"
PS_PERSONALITY="linux"
PWD="/root/home/workspace/install/emerge/update/10"
PYTHONDOCS="/usr/share/doc/python-docs-2.4.2/html"
PYTHONPATH="/usr/lib/portage/pym"
QMAKESPEC="linux-g++"
QTDIR="/usr/qt/3"
RESUMECOMMAND="/usr/bin/wget -c -t 5 --passive-ftp -P ${DISTDIR} ${URI}"
RPMDIR="/usr/portage/rpm"
RSYNC_RETRIES="3"
RSYNC_TIMEOUT="180"
SANE_CONFIG_DIR="/etc/sane.d"
SAVEDIR="/root/tmp/emacs/gnus"
SHELL="/bin/bash"
SHLVL="2"
SVNROOT="svn+ssh://rip@sidkode.homelinux.net/var/svn/repos"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
TERM="dumb"
TERMCAP=""
TEXEDIT="emacs --background-color=black --foreground-color=white --directory=/home/rip/home/bin/emacs-lisp --no-windows --basic-display --quick"
USE="x86 3dnow 3dnowext X Xaw3d a52 aac aalib accessibility acl acpi adns afs alsa apache apache2 apm arts audiofile authdaemond avi bash-completion bashlogger berkdb bidi big-tables bitmap-fonts bl bonobo browserplugin bzip2 cairo canna cdda cddb cdio cdparanoia cdr cjk cli crypt cscope ctype cups curl dba dbus debug dga directfb divx4linux djvu doc dri dts dv dvb dvd dvdread dvi edl eds emacs emacs-w3 emboss encode enscript esd examples exif expat fam fastbuild fat fbcon ffmpeg firebird firefox flac foomaticdb force-cgi-redirect fortran freetds freetype ftp gb gcj gd gdbm ggi gif gimpprint glut gmp gnome gnustep gnutls gpm grammar gstreamer gtk gtk2 gtkhtml guile hal hardened hardenedphp hfs howl httpd idn ieee1394 imagemagick imlib ipv6 jack java javascript jfs joystick jpeg jpeg2k junit kde kerberos krb4 lcms ldap leim lesstif libcaca libg++ libgda libwww lirc live lzo mad mailwrapper math matroska matrox mbox memlimit mhash mikmod milter mmx mmxext mng mono motif mozcalendar mozdevelop mozilla mozsvg mozxmlterm mp3 mpeg msql mule musepack mysql mysqli mythtv nas nautilus ncurses neXt network nls nntp nptl nptlonly nsplugin ntfs numeric nvidia objc oci8 odbc ogg oggvorbis openexr opengl oss pam pcmcia pcre pda pdf pdflib perl php physfs pic plotutils png pnp posix postgres profile python qt quicktime readline real reiser4 reiserfs rtc ruby samba sasl scanner sdl session silc simplexml skey slp smartcard soap sockets socks5 source sox speex spell spl sqlite sqlite3 sse sse2 ssl stream subversion svg svga sybase t1lib tcltk tcpd test tetex tga theora thesaurus threads tiff tokenizer truetype truetype-fonts type1-fonts udev unicode usb v4l v4l2 vcd vlm vorbis wifi win32codecs wmf wordperfect wxgtk1 wxwidgets wxwindows xanim xface xforms xfs xim xine xinerama xml xml2 xmldoclet xmms xosd xpm xprint xsl xv xvid xvmc zeroconf zlib userland_GNU kernel_linux elibc_glibc"
USER="root"
USERLAND="GNU"
USE_EXPAND="FRITZCAPI_CARDS FCDSL_CARDS VIDEO_CARDS DVB_CARDS INPUT_DEVICES LINGUAS USERLAND KERNEL ELIBC"
XARGS="xargs -r"
XAUTHORITY="/root/.xauthFIOury"
XINITRC="/etc/X11/xinit/xinitrc"
XPSERVERLIST=""
_="/usr/bin/emerge"


Compilation finished at Sun Apr  2 04:26:42
Comment 1 Sid Kode 2006-04-01 20:07:53 UTC
Created attachment 83677 [details, diff]
patch for the bug

basically add '$' before 'y'
Comment 2 Sid Kode 2006-04-01 20:10:33 UTC
Created attachment 83678 [details]
'emerge hal' fails incorrectly without the patch.

the script fails due to bash syntax error.
Comment 3 Sid Kode 2006-04-01 20:12:04 UTC
Created attachment 83679 [details]
'emerge hal' fails correctly with the patch added.

The script should fail since the hal ebuild requires Linux kernel 2.6.13+ and I have Linux kernel 2.6.11
Comment 4 Sid Kode 2006-04-01 20:54:32 UTC
upon further reading, it seems that the two pieces of script - original and patch - are equivalent in bash.  I tend to do all compiles/emerges in GNU emacs 22 and it seems like emacs is not printing the last few lines of the standard error stream in the *compilation* buffer for whatever reason.  This seems weird since standard error is an unbufferred stream by default - and it does this _only_ with the original script and not the patched script.  So this is most likely a bug in GNU emacs compilation-mode and not in linux-info.eclass.