Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 433716 - media-video/mplayer2-2.0_p20120828 failes with ord() expected string of length 1, but int found
Summary: media-video/mplayer2-2.0_p20120828 failes with ord() expected string of lengt...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Media-video project
URL:
Whiteboard:
Keywords:
: 433828 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-09-02 20:07 UTC by Kamen Dokov
Modified: 2012-09-05 08:01 UTC (History)
4 users (show)

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


Attachments
build.log (media-video:mplayer2-2.0_p20120902:20120902-194715.log.gz,7.69 KB, application/x-gzip)
2012-09-02 20:08 UTC, Kamen Dokov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kamen Dokov 2012-09-02 20:07:35 UTC
media-video/mplayer2-2.0_p20120902 failes with:

CC      bstr.o
./TOOLS/file2string.py etc/codecs.conf >codecs.conf.h
Traceback (most recent call last):
  File "./TOOLS/file2string.py", line 23, in <module>
    main(infile)
  File "./TOOLS/file2string.py", line 19, in main
    sys.stdout.write('"' + ''.join(conv[ord(c)] for c in line) + '"\n')
  File "./TOOLS/file2string.py", line 19, in <genexpr>
    sys.stdout.write('"' + ''.join(conv[ord(c)] for c in line) + '"\n')
TypeError: ord() expected string of length 1, but int found
make: *** [codecs.conf.h] Error 1
make: *** Deleting file `codecs.conf.h'


Reproducible: Always

Steps to Reproduce:
1.MAKEOPTS='-j1' emerge -1 --quiet-build=n media-video/mplayer2
2.
3.
Actual Results:  
CC      bstr.o
./TOOLS/file2string.py etc/codecs.conf >codecs.conf.h
Traceback (most recent call last):
  File "./TOOLS/file2string.py", line 23, in <module>
    main(infile)
  File "./TOOLS/file2string.py", line 19, in main
    sys.stdout.write('"' + ''.join(conv[ord(c)] for c in line) + '"\n')
  File "./TOOLS/file2string.py", line 19, in <genexpr>
    sys.stdout.write('"' + ''.join(conv[ord(c)] for c in line) + '"\n')
TypeError: ord() expected string of length 1, but int found
make: *** [codecs.conf.h] Error 1
make: *** Deleting file `codecs.conf.h'


Expected Results:  
To build and install fine!

emerge --info '=media-video/mplayer2-2.0_p20120902'          
Portage 2.2.0_alpha110_p31 (default/linux/amd64/10.0/desktop/kde, gcc-4.6.3, glibc-2.15-r2, 3.3.8-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.3.8-gentoo-x86_64-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_6000+-with-gentoo-2.2
Timestamp of tree: Sun, 02 Sep 2012 19:30:01 +0000
app-shells/bash:          4.2_p37
dev-java/java-config:     2.1.12
dev-lang/python:          2.7.3-r2, 3.1.5, 3.2.3-r1
dev-util/cmake:           2.8.9
dev-util/pkgconfig:       0.27.1
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.10.5
sys-apps/sandbox:         2.6
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.11.6, 1.12.3
sys-devel/binutils:       2.22.90
sys-devel/gcc:            4.5.4, 4.6.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 3.5 (virtual/os-headers)
sys-libs/glibc:           2.15-r2
Repositories: gentoo kollin_local
Installed sets: @kde-4.8, @kde-telepathy
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer -ftree-vectorize"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/env.d /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config /usr/share/config/kdm/ /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe -fomit-frame-pointer -ftree-vectorize -fvisibility-inlines-hidden"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS=" --quiet-build=y"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs candy clean-logs compress-build-logs config-protect-if-modified distlocks ebuild-locks fail-clean fixlafiles news parallel-fetch parallel-install parse-eapi-ebuild-head preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://gentoo.osuosl.org http://ftp.gentoo.bg/ ftp://mirrors.telepoint.bg/gentoo/"
LANG="en_GB.UTF-8"
LC_ALL="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--enable-new-dtags"
LINGUAS="en"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_COMPRESS="bzip2"
PORTAGE_COMPRESS_FLAGS="-9"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp/"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X a52 aac acl acpi alsa amd64 berkdb bluetooth branding btrfs bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus declarative dri dts dvd dvdr egl emboss encode exif fam firefox flac fortran g3dvl gdbm gif gles gles1 gles2 gpm gtk handbook iconv ipv6 jpeg kde kipi lcms ldap libnotify mad mmx mmxext mng modules mp3 mp4 mpeg mudflap multilib nautilus ncurses nls nptl ogg opengl openmp openvg pam pango pcre pdf phonon plasma png policykit ppds pppd pulseaudio qt3support qt4 readline sdl semantic-desktop session spell sse sse2 ssl startup-notification svg tcpd tiff truetype udev udisks unicode upower usb vaapi vdpau vorbis wxwidgets x264 xcb xcomposite xml xscreensaver xv xvid zlib" ALSA_CARDS="hda-nvidia" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter 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" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2 canon" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="aivdm ashtech clientdebug earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 navcom nmea ntrip oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar timing tnt tripmate tsip ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="nvidia" 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, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON


emerge -pqv '=media-video/mplayer2-2.0_p20120902'
[ebuild     U ] media-video/mplayer2-2.0_p20120902 [2.0_p20120309] USE="3dnow 3dnowext X a52 alsa cdio dts dv dvd dvdnav enca faad gif iconv ipv6 jpeg libass mad mmx mmxext mng mp3 network opengl png pulseaudio quicktime rar rtc sdl shm speex sse sse2 theora truetype unicode vdpau vorbis xscreensaver xv xvid -aalib (-altivec) (-aqua) -bidi -bindist -bl -bluray -bs2b -cddb -cpudetection -debug -directfb (-doc) -dvb -dxr3 -fbcon -ftp -ggi -jack -joystick -ladspa -libcaca -lirc -md5sum -nas -nut -oss -pnm -portaudio% -postproc% -pvr -radio (-real) -samba -ssse3 -symlink -tga -v4l (-win32codecs) -xanim -xinerama (-cdparanoia%) (-custom-cpuopts%)" VIDEO_CARDS="-mga -s3virge -tdfx (-vesa%)"
Comment 1 Kamen Dokov 2012-09-02 20:08:10 UTC
Created attachment 322776 [details]
build.log
Comment 2 Alex Barker 2012-09-02 20:38:44 UTC
Setting python to 2.7 via eselect worked around the problem form me.
Comment 3 Kamen Dokov 2012-09-02 20:42:20 UTC
(In reply to comment #2)
> Setting python to 2.7 via eselect worked around the problem form me.

Hmm may be ebuild needs to explicitly request python2 ?
Comment 4 Alex Barker 2012-09-03 06:16:15 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > Setting python to 2.7 via eselect worked around the problem form me.
> 
> Hmm may be ebuild needs to explicitly request python2 ?

Apparently accept keywords * works with python3.2
Comment 5 Tomáš Chvátal (RETIRED) gentoo-dev 2012-09-03 08:16:15 UTC
I think it is in the py2 patch I wrote.


-        sys.stdout.write('"' + ''.join(conv[c] for c in line) + '"\n')
+        sys.stdout.write('"' + ''.join(conv[ord(c)] for c in line) + '"\n')

As in py3 the strings are already array of integers the ord is ambious there. So
any ideas how to make this work for both py2 and py3?
Comment 6 Kamen Dokov 2012-09-03 11:23:58 UTC
(In reply to comment #5)
> I think it is in the py2 patch I wrote.
> 
> 
> -        sys.stdout.write('"' + ''.join(conv[c] for c in line) + '"\n')
> +        sys.stdout.write('"' + ''.join(conv[ord(c)] for c in line) + '"\n')
> 
> As in py3 the strings are already array of integers the ord is ambious
> there. So
> any ideas how to make this work for both py2 and py3?


May be with conditional: if python3 system wide is detected then python3 variant, if not, then python2 variant ?
Comment 7 Tomáš Chvátal (RETIRED) gentoo-dev 2012-09-03 16:02:21 UTC
(In reply to comment #6)

> May be with conditional: if python3 system wide is detected then python3
> variant, if not, then python2 variant ?

Nope, conditional patches are wrong, and you cant detect the py version properly from ebuilds unless raping the code a lot.

So we just need to do it right. Feel free to hack on it, in a bit I will hopefully have time to fix it.
Comment 8 Tomáš Chvátal (RETIRED) gentoo-dev 2012-09-03 16:38:46 UTC
Updating the summary as the version in tree was changed to reflect upstream. No change for this bug tho, so do not try if you have it.
Comment 9 Alex Barker 2012-09-03 17:13:54 UTC
(In reply to comment #7)
> (In reply to comment #6)
> 
> > May be with conditional: if python3 system wide is detected then python3
> > variant, if not, then python2 variant ?
> 
> Nope, conditional patches are wrong, and you cant detect the py version
> properly from ebuilds unless raping the code a lot.
> 
> So we just need to do it right. Feel free to hack on it, in a bit I will
> hopefully have time to fix it.

I did a little digging around and basically got this answer: "writing code that is supposed to run on both unmodified is rarely a good idea"  With that said we should probably just force python3 with the original code or python2 with the patch.
Comment 10 Tomáš Chvátal (RETIRED) gentoo-dev 2012-09-03 17:29:01 UTC
Well it is not that hard to do conditionals where needed.

Try this file:
http://dev.gentooexperimental.org/~scarabeus/0001-Add-py2-compat.-Now-scripts-work-under-both-py3-and-.patch

And replace the current patch in files/ dir to see if it works with it.
Comment 11 Tomáš Chvátal (RETIRED) gentoo-dev 2012-09-04 17:25:14 UTC
*** Bug 433828 has been marked as a duplicate of this bug. ***
Comment 12 Vasco Gervasi 2012-09-04 19:27:41 UTC
(In reply to comment #10)
> Well it is not that hard to do conditionals where needed.
> 
> Try this file:
> http://dev.gentooexperimental.org/~scarabeus/0001-Add-py2-compat.-Now-
> scripts-work-under-both-py3-and-.patch
> 
> And replace the current patch in files/ dir to see if it works with it.

I have just tried this patch but I get this error:

/TOOLS/file2string.py etc/codecs.conf >codecs.conf.h
  File "./TOOLS/file2string.py", line 21
    catch TypeError:
                   ^
TabError: inconsistent use of tabs and spaces in indentation
make: *** [codecs.conf.h] Errore 1
make: *** Eliminazione del file «codecs.conf.h»
make: *** Attesa dei processi non terminati....
Comment 13 Alex Barker 2012-09-05 02:12:02 UTC
> I have just tried this patch but I get this error:
> 
> /TOOLS/file2string.py etc/codecs.conf >codecs.conf.h
>   File "./TOOLS/file2string.py", line 21
>     catch TypeError:
>                    ^
> TabError: inconsistent use of tabs and spaces in indentation
> make: *** [codecs.conf.h] Errore 1
> make: *** Eliminazione del file «codecs.conf.h»
> make: *** Attesa dei processi non terminati....

I am no python expert but it sounds like you used a tab instead of 4 spaces or vice versa.  Just make sure your spacing is consistent.
Comment 14 Tomáš Chvátal (RETIRED) gentoo-dev 2012-09-05 06:21:32 UTC
(In reply to comment #13)
> 
> I am no python expert but it sounds like you used a tab instead of 4 spaces
> or vice versa.  Just make sure your spacing is consistent.

Yes yes, I have vim to use tabs by default, but didn't notice the code is space aligned.

Updated the patch in the url, so now it should not fail like this, please try again.
Comment 15 Vasco Gervasi 2012-09-05 07:08:07 UTC
Perfect, the new patch work for me.

Thanks
Comment 16 Tomáš Chvátal (RETIRED) gentoo-dev 2012-09-05 08:01:07 UTC
Fixed in cvs.

Thanks for the testing.