Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 327211 - app-crypt/johntheripper fails to compile due to bad ebuild
Summary: app-crypt/johntheripper fails to compile due to bad ebuild
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Crypto team [DISABLED]
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-06 20:35 UTC by Samuli Suominen (RETIRED)
Modified: 2011-02-07 14:23 UTC (History)
5 users (show)

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


Attachments
build.log (build.log,19.93 KB, text/plain)
2010-07-06 20:36 UTC, Samuli Suominen (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Samuli Suominen (RETIRED) gentoo-dev 2010-07-06 20:35:53 UTC
path.c: In function 'path_init':
path.c:40: error: expected expression before '/' token
path.c:40: error: too few arguments to function 'strnzcpy'

[ .. ]

Portage 2.1.8.3 (default/linux/powerpc/ppc64/10.0/64bit-userland, gcc-4.3.4, glibc-2.10.1-r1, 2.6.21-gentoo-r4 ppc64)
=================================================================
System uname: Linux-2.6.21-gentoo-r4-ppc64-POWER5+_-gs-with-gentoo-1.12.13
Timestamp of tree: Tue, 06 Jul 2010 10:00:01 +0000
app-shells/bash:     4.0_p37
dev-lang/python:     2.6.4-r1
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.65
sys-devel/automake:  1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.3.4
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="ppc64"
ACCEPT_LICENSE="*"
CBUILD="powerpc64-unknown-linux-gnu"
CFLAGS="-O2 -pipe -mcpu=power5 -mtune=power5"
CHOST="powerpc64-unknown-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -mcpu=power5 -mtune=power5"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,--as-needed"
MAKEOPTS="-j8"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acl berkdb bzip2 cairo cli consolekit cracklib crypt cups cxx dbus dri extras fortran gdbm gnome gpm gtk ibm iconv ipv6 jpeg modules mudflap ncurses nls nptl nptlonly openmp pam pcre perl png policykit ppc64 pppd python qt3support qt4 readline reflection session spl sqlite ssl svg sysfs tcpd tk unicode xorg zlib" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev mach64 mga nv r128 radeon vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 1 Samuli Suominen (RETIRED) gentoo-dev 2010-07-06 20:36:08 UTC
Created attachment 237797 [details]
build.log
Comment 2 Samuli Suominen (RETIRED) gentoo-dev 2010-07-07 15:45:04 UTC
Also 1.7.4.2 will fail but if USE=altivec is enabled, it doesn't fail. 
I think altivec must be forced enabled for ppc* and is not really optional.
Comment 3 Samuli Suominen (RETIRED) gentoo-dev 2010-07-07 15:51:57 UTC
powerpc devs: Please test this, USE="-altivec" emerge johntheripper 
Comment 4 Mark Loeser (RETIRED) gentoo-dev 2010-11-06 21:36:39 UTC
Looks like 1.7.6 works only with -altivec now
Comment 5 Dane Smith (RETIRED) gentoo-dev 2011-01-05 18:22:54 UTC
I've filed a STABLEREQ for this as the current stable in the tree is ancient. PPC devs, how do we want to address this? Mask the altivec flag on ppc/ppc64 perhaps?
Comment 6 Samuli Suominen (RETIRED) gentoo-dev 2011-01-05 19:15:26 UTC
I've reverted johntheripper to ~arch for ppc and ppc64 until this is solved because this bug is half an year old.
Comment 7 Willard Dawson 2011-02-03 16:19:23 UTC
(In reply to comment #6)
> I've reverted johntheripper to ~arch for ppc and ppc64 until this is solved
> because this bug is half an year old.
> 

I get this same error on x86_64.  I tried setting -altivec in USE to no good effect.  Here's my emerge --info, if it is of any help:

Portage 2.1.9.25 (default/linux/amd64/10.0, gcc-4.4.4, glibc-2.11.2-r3, 2.6.36-gentoo-r5 x86_64)
=================================================================
                        System Settings
=================================================================
System uname: Linux-2.6.36-gentoo-r5-x86_64-Intel-R-_Core-TM-_i5_CPU_M_540_@_2.53GHz-with-gentoo-1.12.14
Timestamp of tree: Thu, 03 Feb 2011 01:45:01 +0000
app-shells/bash:     4.1_p9
dev-java/java-config: 2.1.11-r3
dev-lang/python:     2.6.6-r1, 3.1.2-r4
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 1.12.14-r1
sys-apps/sandbox:    2.4
sys-devel/autoconf:  2.13, 2.65-r1
sys-devel/automake:  1.9.6-r3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.4-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.30-r1 (sys-kernel/linux-headers)
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://mirror.mcs.anl.gov/pub/gentoo/ http://gentoo.chem.wisc.edu/gentoo/ http://mirrors.cs.wmich.edu/gentoo http://www.cyberuse.com/gentoo/ http://mirror.datapipe.net/gentoo http://gentoo.mirrors.easynews.com/linux/gentoo/ http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/ http://www.gtlib.gatech.edu/pub/gentoo http://gentoo.mirrors.hoobly.com/ http://distro.ibiblio.org/pub/linux/distributions/gentoo/ http://lug.mtu.edu/gentoo/ http://gentoo.netnitco.net http://gentoo.osuosl.org/ http://gentoo.mirrors.pair.com/ http://mirrors.rit.edu/gentoo/ http://mirror.iawnet.sandia.gov/gentoo/ http://gentoo.llarian.net/ http://gentoo.mirrors.tds.net/gentoo http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/ http://mirror.lug.udel.edu/pub/gentoo/ http://mirror.its.uidaho.edu/pub/gentoo/ http://gentoo.cites.uiuc.edu/pub/gentoo/ http://gentoo.cs.uni.edu/ http://mirror.usu.edu/mirrors/gentoo/"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
USE="acl alsa amd64 apic berkdb bzip2 cdr clflush cli cmov constant_tsc cracklib crypt cups cx8 cxx dbus de dri dvd fortran fpu fxsr gdbm gpm iconv ipv6 kde lahf_lm lm mca mce mmx modules monitor msr mtrr mudflap multilib ncurses nls nptl nptlonly nx openmp pae pam pat pcre perl pge phonon pni pppd pse pse36 python qt3support qt4 readline rep_good sep session sse sse2 ssl ssse3 syscall sysfs tcpd tsc unicode up vme xorg zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="virtualbox evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="virtualbox" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 8 Kevin F. Quinn 2011-02-06 11:36:29 UTC
I get the same as comment #7 with 1.7.6-r1, and it has nothing to do with altivec (it never did), rather it's an error in the ebuild script.

Line 40 giving rise to the error in path.c is:

        strnzcpy(john_home_path, JOHN_SYSTEMWIDE_HOME "/", PATH_BUFFER_SIZE);

prototype for strnzcpy is (from misc.h):

char *strnzcpy(char *dst, char *src, int size);

and the error is:

i686-pc-linux-gnu-gcc -c -Wall  -O2 -march=athlon-xp -pipe -fPIC -fPIE -DJOHN_SYSTEMWIDE -DJOHN_SYSTEMWIDE_HOME="/etc/john" -DJOHN_SYSTEMWIDE_EXEC="/usr/libexec/john" -fopenmp -DHAVE_CRYPT  path.c
path.c: In function 'path_init':
path.c:40: error: expected expression before '/' token
path.c:40: error: too few arguments to function 'strnzcpy'

The problem is that the definition on the command line leads to unquoted text in the source file, so once the macros are evaluated the source code looks like:

        strnzcpy(john_home_path, /etc/john "/", PATH_BUFFER_SIZE);

rather than:

        strnzcpy(john_home_path, "/etc/john" "/", PATH_BUFFER_SIZE);

I suspect the build should be doing:

i686-pc-linux-gnu-gcc -c -Wall  -O2 -march=athlon-xp -pipe -fPIC -fPIE -DJOHN_SYSTEMWIDE -DJOHN_SYSTEMWIDE_HOME="\"/etc/john\"" -DJOHN_SYSTEMWIDE_EXEC="/usr/libexec/john" -fopenmp -DHAVE_CRYPT  path.c

which is a simple fix to src_compile() to put the escaped quotes in.  I'm a little rusty on shell escape precedence, but I think the following is sufficient:

    append-flags -fPIC -fPIE \
        '-DJOHN_SYSTEMWIDE' \
        '-DJOHN_SYSTEMWIDE_HOME="\"/etc/john"\"' \
        '-DJOHN_SYSTEMWIDE_EXEC=\"/usr/libexec/john\"'

In addition, I notice the comments in params.h suggest setting JOHN_SYSTEMWIDE to 1, so you may want to do that as well, rather than just defining an empty macro, in case things change in the future and jtr starts depending on the value of JOHN_SYSTEMWIDE (I'm assuming it doesn't in practice at the moment).
Comment 9 Kevin F. Quinn 2011-02-06 11:37:44 UTC
oops - make that:

        '-DJOHN_SYSTEMWIDE_HOME="\"/etc/john\""' \
Comment 10 Dane Smith (RETIRED) gentoo-dev 2011-02-07 14:10:54 UTC
Well, this is interesting. First, thanks Willard for reporting, and Kevin for doing some digging.

Kevin: You were spot on with the issue. The fix however was \\\"/etc/john\\\" since just adding a quote in C won't change a string. "foo" == ""foo"" C wise. What we need is \"foo\" passed in.

This was the status of the ebuild when I committed it. It turns out that during stabilization, the escapes got changed a bit to clean them up.

smitdane@crypto ~/gentoo/repos/gentoo-x86/app-crypt/johntheripper $ cvs diff -u -r 1.5 -r 1.6 johntheripper-1.7.6-r1.ebuild 
Index: johntheripper-1.7.6-r1.ebuild
===================================================================
RCS file: /var/cvsroot/gentoo-x86/app-crypt/johntheripper/johntheripper-1.7.6-r1.ebuild,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -B -u -r1.5 -r1.6
--- johntheripper-1.7.6-r1.ebuild       29 Jan 2011 13:34:48 -0000      1.5
+++ johntheripper-1.7.6-r1.ebuild       2 Feb 2011 06:16:28 -0000       1.6
@@ -1,6 +1,6 @@
 # Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-crypt/johntheripper/johntheripper-1.7.6-r1.ebuild,v 1.5 2011/01/29 13:34:48 armin76 Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-crypt/johntheripper/johntheripper-1.7.6-r1.ebuild,v 1.6 2011/02/02 06:16:28 jer Exp $
 
 EAPI="2"
 
@@ -22,7 +22,7 @@
 LICENSE="GPL-2"
 SLOT="0"
 # This package can't be marked stable for ppc or ppc64 before bug 327211 is closed.
-KEYWORDS="alpha amd64 ~hppa ~mips ~ppc ~ppc64 sparc x86"
+KEYWORDS="alpha amd64 hppa ~mips ~ppc ~ppc64 sparc x86"
 IUSE="altivec custom-cflags -minimal mmx openmp sse2"
 #IUSE="altivec custom-cflags -minimal mmx -mpi sse2"
 
@@ -95,8 +95,8 @@
        use custom-cflags || strip-flags
        append-flags -fPIC -fPIE \
                '-DJOHN_SYSTEMWIDE' \
-               '-DJOHN_SYSTEMWIDE_HOME=\\\"/etc/john\\\"' \
-               '-DJOHN_SYSTEMWIDE_EXEC=\\\"/usr/libexec/john\\\"'
+               '-DJOHN_SYSTEMWIDE_HOME=\"/etc/john\"' \
+               '-DJOHN_SYSTEMWIDE_EXEC=\"/usr/libexec/john\"'
        gcc-specs-pie && append-ldflags -nopie
        use openmp && OMP="-fopenmp"

which is what led to the issue on x86_64 and x86 (and others probably).

I have re-fixed the escaping in CVS. Please test and confirm that it is back in a working state for me if you can.

As it turns out, the only thing more fun than strings in bash are strings going from Bash to the C preprocessor, to C!

PPC:
Can you test the current 1.7.6-r1 and let me know if it's working? I'm going to guess it isn't. If not, please post the log.

I'm going to leave this open in the mean time.

Thanks again to everyone.
Comment 11 Dane Smith (RETIRED) gentoo-dev 2011-02-07 14:23:35 UTC
Issues now persist with PPC/PPC64 with USE="altivec" as was the case in the past.

Closing this out. Fresh bug for those.