Created attachment 383504 [details, diff] Use email.utils.formatdate instead of time.strftime Since portage-2.2.11, the date header in build summary emails is formatted with the system's locale. Using email.utils.formatdate instead of strftime would produce a RFC-compliant date timestamp. |[florent] ~ $ emerge --info portage Portage 2.2.12 (python 3.3.5-final-0, default/linux/amd64/13.0/desktop/kde, gcc-4.7.3, glibc-2.19-r1, 3.12.21-gentoo-r1 x86_64) ================================================================= System Settings ================================================================= System uname: Linux-3.12.21-gentoo-r1-x86_64-Intel-R-_Core-TM-_i5_CPU_M_460_@_2.53GHz-with-gentoo-2.2 KiB Mem: 3911396 total, 865268 free KiB Swap: 2047996 total, 1988240 free Timestamp of tree: Sun, 24 Aug 2014 07:15:01 +0000 ld GNU ld (GNU Binutils) 2.23.2 distcc 3.1 x86_64-pc-linux-gnu [disabled] app-shells/bash: 4.2_p45 dev-java/java-config: 2.2.0 dev-lang/python: 2.7.7, 3.3.5-r1 dev-util/cmake: 2.8.12.2-r1 dev-util/pkgconfig: 0.28-r1 sys-apps/baselayout: 2.2 sys-apps/openrc: 0.12.4 sys-apps/sandbox: 2.6-r1 sys-devel/autoconf: 2.69 sys-devel/automake: 1.11.6, 1.12.6, 1.13.4 sys-devel/binutils: 2.23.2 sys-devel/gcc: 4.7.3-r1 sys-devel/gcc-config: 1.7.3 sys-devel/libtool: 2.4.2-r1 sys-devel/make: 3.82-r4 sys-kernel/linux-headers: 3.13 (virtual/os-headers) sys-libs/glibc: 2.19-r1 Repositories: gentoo sunrise steam-overlay mrueg local myspell ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="* -@EULA" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=native -O3 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0 /usr/share/themes/oxygen-gtk/gtk-3.0" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cli-php5.5/ext-active/ /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="-march=native -O3 -pipe" DISTDIR="/var/portage/distfiles" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync webrsync-gpg" FFLAGS="-march=native -O3 -pipe" GENTOO_MIRRORS="http://mirror.ovh.net/gentoo-distfiles/" LANG="fr_FR.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j4" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-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="/var/lib/layman/sunrise /var/lib/layman/steam /var/lib/layman/mrueg /usr/local/portage /usr/local/myspell-overlay" SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage" USE="X a52 aac acl acpi alsa amd64 apache2 bash-completion berkdb branding bzip2 cairo cdda cddb cdr cli consolekit cracklib crypt cryptsetup cups cxx dbus declarative djvu dri dts dvd dvdr emboss encode exif fam flac fortran gdbm gif git gpm gtk handbook iconv imlib ipv6 java java6 jpeg jpeg2k kde kipi lcms ldap libnotify mad matroska mmx mng modules mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf phonon plasma png policykit ppds qt3support qt4 raw readline samba sasl sdl semantic-desktop session spell sse sse2 ssl startup-notification subversion svg tcpd theora threads tiff truetype udev udisks unicode upower usb v4l vorbis wxwidgets x264 xcb xcomposite xinerama xml xscreensaver xv xvid zlib" ABI_X86="64" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd 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 author" CAMERAS="ptp2" 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 ublox ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="fr" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" QEMU_SOFTMMU_TARGETS="x86_64 i386 arm" QEMU_USER_TARGETS="x86_64 arm" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="vesa radeon r600" 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, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON ================================================================= Package Settings ================================================================= sys-apps/portage-2.2.12 was built with the following: USE="(ipc) (policykit) -build -doc -epydoc (-pypy) -python2 -python3 (-selinux) -xattr" ABI_X86="64" LINGUAS="-ru" PYTHON_TARGETS="python2_7 python3_3 (-pypy) -python3_2 -python3_4"
Yes, there was a change to make portage more localized for formatting. Thank you for the patch. We will look it over for inclusion in the next release.
This bug is very annoying. I confirm the patch works
A modified commit has been applied in Commit: 7204b87040edfcf0924f2d3647d5a00e1de7a170 Subject: portage/mail.py: Make email date, timestamp RFC-compliant Bug 520752 I also remved the no longer used time import, and wrapped the formatdate call with a _unicode_encode()
(In reply to Brian Dolbec from comment #3) > A modified commit has been applied in > > Commit: 7204b87040edfcf0924f2d3647d5a00e1de7a170 > Subject: portage/mail.py: Make email date, timestamp RFC-compliant Bug 520752 > > I also remved the no longer used time import, and wrapped the formatdate > call with a _unicode_encode() Hello, I'm trying this version with _unicode_encode and I'm getting an error. ==================================== Error in portage.process.run_exitfuncs File "/usr/lib64/portage/pym/portage/process.py", line 164, in run_exitfuncs func(*targs, **kargs) File "/usr/lib64/portage/pym/portage/elog/mod_mail_summary.py", line 47, in finalize _finalize(mysettings, items) File "/usr/lib64/portage/pym/portage/elog/mod_mail_summary.py", line 80, in _finalize portage.mail.send_mail(mysettings, mymessage) File "/usr/lib64/portage/pym/portage/mail.py", line 170, in send_mail message_str = _force_ascii_if_necessary(message.as_string()) File "/usr/lib64/python3.3/email/message.py", line 151, in as_string g.flatten(self, unixfrom=unixfrom) File "/usr/lib64/python3.3/email/generator.py", line 113, in flatten self._write(msg) File "/usr/lib64/python3.3/email/generator.py", line 193, in _write self._write_headers(msg) File "/usr/lib64/python3.3/email/generator.py", line 220, in _write_headers self.write(self.policy.fold(h, v)) File "/usr/lib64/python3.3/email/_policybase.py", line 314, in fold return self._fold(name, value, sanitize=True) File "/usr/lib64/python3.3/email/_policybase.py", line 352, in _fold parts.append(h.encode(linesep=self.linesep, 'bytes' object has no attribute 'encode' ==================================== $ emerge --version Portage 2.2.12 (python 3.3.5-final-0, default/linux/amd64/13.0/desktop/kde, gcc-4.7.3, glibc-2.19-r1, 3.14.14-gentoo x86_64)
It seems that the _unicode_encode call is unwanted here. All the other _unicode_encode calls in this function are conditional on sys.hexversion < 0x3000000, so that explains why it fails for you with python3. So, I conclude that the attached patch does the job perfectly.
It's fixed in git now: https://github.com/gentoo/portage/commit/a14d1493716ee0b026dc56ef6c6c1f24169fd880
Fixed in 2.2.13.