Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 336004 - games-emulation/sdlmame-0.139_p{2,3}: applying patch 0139u1.diff fails
Summary: games-emulation/sdlmame-0.139_p{2,3}: applying patch 0139u1.diff fails
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Games (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Games
URL:
Whiteboard:
Keywords:
: 336782 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-09-04 18:01 UTC by Frank Hellmuth
Modified: 2010-10-13 18:17 UTC (History)
9 users (show)

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


Attachments
log of failed patch (0139u1.diff.out.bz2,102.88 KB, application/octet-stream)
2010-09-04 18:04 UTC, Frank Hellmuth
Details
Fixed ebuild (sdlmame-0.139_p2.ebuild,3.55 KB, text/plain)
2010-09-05 08:04 UTC, Paul Hartman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Hellmuth 2010-09-04 18:01:04 UTC
Emerging games-emulation/sdlmame-0.139_p2 fails with

 * CPV:  games-emulation/sdlmame-0.139_p2
 * REPO: gentoo
 * USE:  amd64 elibc_glibc kernel_linux multilib opengl userland_GNU
>>> Unpacking source...
>>> Unpacking mame0139s.zip to /var/tmp/portage/games-emulation/sdlmame-0.139_p2/work
>>> Unpacking sdlmame0139u1_diff.zip to /var/tmp/portage/games-emulation/sdlmame-0.139_p2/work
>>> Unpacking sdlmame0139u2_diff.zip to /var/tmp/portage/games-emulation/sdlmame-0.139_p2/work
>>> Unpacking ./mame.zip to /var/tmp/portage/games-emulation/sdlmame-0.139_p2/work
>>> Source unpacked in /var/tmp/portage/games-emulation/sdlmame-0.139_p2/work
>>> Preparing source in /var/tmp/portage/games-emulation/sdlmame-0.139_p2/work ...
 * Patching release with source updates
 * Applying 0139u1.diff ...

 * Failed Patch: 0139u1.diff !
 *  ( 0139u1.diff )
 * 
 * Include in your bugreport the contents of:
 * 
 *   /var/tmp/portage/games-emulation/sdlmame-0.139_p2/temp/0139u1.diff.out

 * ERROR: games-emulation/sdlmame-0.139_p2 failed:
 *   Failed Patch: 0139u1.diff!


Reproducible: Always




# emerge --info
Portage 2.2_rc75 (default/linux/amd64/10.0/desktop, gcc-4.4.4, glibc-2.12.1-r1, 2.6.35-gentoo-r5-default x86_64)
=================================================================
System uname: Linux-2.6.35-gentoo-r5-default-x86_64-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_4200+-with-gentoo-2.0.1
Timestamp of tree: Sat, 04 Sep 2010 16:30:01 +0000
app-shells/bash:     4.1_p7
dev-java/java-config: 2.1.11
dev-lang/python:     2.6.5-r3, 3.1.2-r4
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.3
sys-apps/sandbox:    2.3-r1
sys-devel/autoconf:  2.13, 2.65-r1
sys-devel/automake:  1.8.5-r4, 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.4-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.35 (sys-kernel/linux-headers)
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/portage /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests distlocks fixlafiles fixpackages news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://mirror.gentoo.no/ http://trumpetti.atm.tut.fi/gentoo/ http://gentoo.blueyonder.co.uk http://www.mirrorservice.org/sites/www.ibiblio.org/gentoo/"
LANG="de_DE.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en de"
MAKEOPTS="-j3"
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"
PORTDIR_OVERLAY="/var/lib/layman/pro-audio /var/lib/layman/kde /usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow R X a52 aac aalib accessibility acl acpi akonadi alsa amazon amd64 apache2 autotrace avahi bash-completion berkdb bluetooth branding bzip2 cairo calendar cddb cdparanoia cdr cli consolekit cracklib crypt css cups cvs cxx dbus desktopglobe detex dia dirac djvu dri dssi dts dv dvb dvd dvdnav dvdr dvi2tty dvipdfm ebook eigen emacs emboss encode examples exif extras fbcon festival ffmpeg fftw firefox firefox3 flac fluidsynth fortran ftp gd gdbm gecko gif gimp ginac glut gmp gnome gnuplot gnutls gphoto2 gpm gps graphviz gsl gstreamer gtk hal iconv icq idn ieee1394 imagemagick imap inotify ipod jack jackmidi java java6 javascript jpeg kde kpathsea ladspa lame lapack lash latex latex3 lcms libcaca libnotify libsamplerate lirc lm_sensors luatex lv2 lzo mad midi mikmod mime mmx mmxext mng modules mozilla mp3 mp4 mpeg mplayer mudflap multilib multimedia music musicbrainz mysql mythtv ncurses nls nntp nptl nptlonly nsplugin ocrad offensive ogg openexr opengl openmp pam pango pcre pdf perl plasma player plotutils plugins-symlink png policykit posix postscript ppds pppd preview-latex pstoedit pstricks publishers python qt3support qt4 quicktime rar raw rdesktop readline redeyes reflection reiserfs rss samba scanner sdl semantic-desktop session slang smp sms sndfile snmp sockets sound sox spell spl sse sse2 ssh ssl startup-notification subversion svg sysfs syslog tcpd tex4ht theora threads tiff timidity truetype udev unicode usb v4l v4l2 vcd videos virtualbox vnc vorbis vst wav webcam webkit wifi winetriks wmf wxwindows x264 xcb xcomposite xemacs xetex xine xinerama xml xorg xosd xpm xscreensaver xulrunner xv xvid xvmc yahoo zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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 auth_digest authn_anon authn_dbd 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 dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so 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" LINGUAS="en de" LIRC_DEVICES="devinput" RUBY_TARGETS="ruby18" SANE_BACKENDS="hp" USERLAND="GNU" VIDEO_CARDS="nvidia vesa fbdev" 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, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Frank Hellmuth 2010-09-04 18:04:22 UTC
Created attachment 246021 [details]
log of failed patch
Comment 2 Paul Hartman 2010-09-05 08:04:48 UTC
Created attachment 246094 [details]
Fixed ebuild

The patch needs to be applied with the --binary option. I have attached an updated ebuild that includes this option.
Comment 3 Sebastian Pipping gentoo-dev 2010-09-09 15:56:17 UTC
(In reply to comment #2)
> The patch needs to be applied with the --binary option. I have attached an
> updated ebuild that includes this option.

Good finding, thanks you!

+  09 Sep 2010; Sebastian Pipping <sping@gentoo.org> sdlmame-0.139_p2.ebuild:
+  Append --binary to ${EPATCH_OPTS} for bug #336004
+

Closing.
Comment 4 Mr. Bones. (RETIRED) gentoo-dev 2010-09-09 16:02:53 UTC
Adding --binary doesn't make any sense.  This so far seems like a bug in patch.
Comment 5 Andrew Church 2010-09-10 01:25:42 UTC
According to patch-2.6 NEWS:

* The --binary option disables the heuristic for stripping CRs from
  line endings in patches.  This allows to preserve CRs even in mangled
  patches, or in patches generated on non-POSIX systems and without the
  --binary option.

So I think --binary is indeed the correct solution (though I could see an argument that the option is poorly designed in having non-obvious effects).
Comment 6 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-09-15 06:43:39 UTC
It seems to still be broken here though.
Comment 7 Mr. Bones. (RETIRED) gentoo-dev 2010-09-15 06:58:30 UTC
yes,  it fails with the latest patch version and I'm concerned that it's a regression in behavior between stable patch and the latest patch version.
Comment 8 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-09-15 07:10:59 UTC
Might be tied to http://blog.flameeyes.eu/2009/12/01/gentoo-service-announcement-keep-clear-of-gnu-patch-2-6
Comment 9 Andrew Church 2010-09-15 10:16:48 UTC
How is it failing?  The patch applies correctly for me with patch-2.6.1 and --binary (verified by comparing a diff -Nru against the original diff file).
Comment 10 Mr. Bones. (RETIRED) gentoo-dev 2010-09-15 18:32:32 UTC
Yes, the patches apply with --binary with patch-2.6.1, but they apply with no additional options with patch-2.5.9 (the current stable version).  It sounds like the change in behavior might be intentional with the current version but "works with the current version, doesn't work with the next version" seems like a regression to me.
Comment 11 Andrew Church 2010-09-15 19:07:48 UTC
Ah, I see what you're saying.  Yes, it's a fair point that if both diff and target files use CRLF newlines, patch shouldn't be stripping the CRs from the diff.

That said, if you're planning to report it as a regression in patch, perhaps sdlmame-0.139_p2 should be masked for the time being?  (Since it's known not to build on a standard ~arch system.)
Comment 12 Brendan Pike 2010-09-21 06:59:22 UTC
Latest _p3 is still broken, had to downgrade patch to get it to work.
Comment 13 Paul Hartman 2010-09-21 15:29:18 UTC
Summary of my trials of sdlmame-0.139_p3 ebuild:

Ebuild as-is:
Works with patch-2.5.9
Fails with patch-2.5.9-r1
Fails with patch-2.6.1

Ebuild with --binary in EPATCH_OPTS:
Works with patch-2.5.9
Fails with patch-2.5.9-r1
Works with patch-2.6.1

(seems maybe patch-2.5.9-r1 has problems of its own?)
Comment 14 Tristan Heaven (RETIRED) gentoo-dev 2010-09-23 10:30:36 UTC
*** Bug 336782 has been marked as a duplicate of this bug. ***
Comment 15 Sebastian Pipping gentoo-dev 2010-10-12 14:56:40 UTC
Paul, thanks for your summary.

How about requiring dos2unix and putting this at the very top of src_prepare:

	# Convert all patched files and patches from <CR><LF> to <LF>
	# (bug #336004)
	find . \( -name '*.h' \
			-o -name '*.c' \
			-o -name '*.mak' \
			-o -name '*.m' \
			-o -name '*.lay' \
			-o -name 'makefile' \
			-o -name '*.diff' \
			\) -print0 \
		| xargs --null dos2unix -o


Seems to work fine with GNU patch 2.6.1 and no --binary.
I have added that to 0.139_p3-r2 in the sping overlay.
Comment 16 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-10-12 15:00:46 UTC
No need to require dos2unix, we already have edos2unix in eutils.eclass.
Comment 17 Mr. Bones. (RETIRED) gentoo-dev 2010-10-12 18:50:00 UTC
fixed with edos2unix
Comment 18 Sebastian Pipping gentoo-dev 2010-10-13 11:40:21 UTC
> edos2unix $(find . -type f)

Bones, why do you prefer patching _all_ files?
Have you investigated the meaning of -DCRLF=2?
I haven't yet, but I chose to converted patch-affected files only, to prevent possible damage. I even considered converting back after patching...

If you worry, that the set of files involved may increase in the future, we could fetch the list of files to convert from the patches itself using diffstat as a safe and robust alternative.  What do you think?
Comment 19 Mr. Bones. (RETIRED) gentoo-dev 2010-10-13 15:06:26 UTC
I don't want to add any more deps just to work around a buggy version of patch.
I changed it to only do the edos2unix for the files mentioned in the patch and only in the case of a _p* ebuild.
Comment 20 Sebastian Pipping gentoo-dev 2010-10-13 18:12:13 UTC
Nice.  What's the

  2> /dev/null

in

  edos2unix $(grep +++ *diff | awk '{ print $2 }' | sort -u) *diff 2> /dev/null

for?
Comment 21 Mr. Bones. (RETIRED) gentoo-dev 2010-10-13 18:17:13 UTC
It avoids a stream of warnings from edos2unix about files that don't exist.