Summary: | sys-apps portage-2.2.12 date header in elog mail is localized | ||
---|---|---|---|
Product: | Portage Development | Reporter: | Florent Bondoux <f.bondoux> |
Component: | Unclassified | Assignee: | Portage team <dev-portage> |
Status: | RESOLVED FIXED | ||
Severity: | normal | Keywords: | InVCS |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 484436 | ||
Attachments: | Use email.utils.formatdate instead of time.strftime |
Description
Florent Bondoux
2014-08-24 09:40:23 UTC
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. |