Issue 9923: mailcap module may not work on non-POSIX platforms if MAILCAPS env variable is set (original) (raw)

Issue9923

Created on 2010-09-23 03:03 by gnofi, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
mailcap_trunk.py gnofi,2010-09-23 03:03 trunk patch
mailcap_py3k.py gnofi,2010-09-23 03:04 py3k branch patch
Messages (10)
msg117163 - (view) Author: Gregory Nofi (gnofi) Date: 2010-09-23 03:03
mailcap.getcaps() has a call to mailcap.listmailcapfiles(), which returns a list of all mailcap files found on the system. listmailcapfiles() first looks for the MAILCAPS environment variable. If it exists, it converts the string value into a list by splitting it on ":". This will not work on platforms that use other path separators, like Windows (";"). Attached are patches that use os.pathsep instead. For more information about the MAILCAPS variable, see Appendix A in RFC 1524 (http://tools.ietf.org/html/rfc1524.html).
msg117164 - (view) Author: Gregory Nofi (gnofi) Date: 2010-09-23 03:06
Fixing typo in title
msg117326 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2010-09-24 19:15
Thanks for the patches. Can you also add a test case to Lib/test/mailcap.py to cover this problem?
msg117395 - (view) Author: Gregory Nofi (gnofi) Date: 2010-09-25 22:38
I'm also creating a test for mailcap (Issue 6484), which is how I found this bug. I'll have an update to that test submitted soon once I implement r.david.murray's helpful suggestions.
msg117939 - (view) Author: Gregory Nofi (gnofi) Date: 2010-10-04 01:44
I just submitted new versions of test_mailcap.py in case 6484.
msg135470 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-05-07 15:29
BTW, is there a real use case that lead you to open this report, or is it just theoretical? I’m not even sure mailcap is used on non-UNIX (and even there, I think it’s not used by recent tools).
msg135557 - (view) Author: Gregory Nofi (gnofi) Date: 2011-05-09 02:24
It's just theoretical. A web search shows that a few Windows programs, like PC Pine, can use $MAILCAPS. But none of those tools look recent, like you said.
msg135593 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-05-09 14:40
Okay. Nonetheless, splitting on os.sep doesn’t cost us anything and is IMO a good practice to follow.
msg143067 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-08-27 14:17
New changeset 7b83d2c1aad9 by Nick Coghlan in branch 'default': Fix #9923: mailcap now uses the OS path separator for the MAILCAP envvar. Not backported, since it could break cases where people worked around the old POSIX-specific behaviour on non-POSIX platforms. http://hg.python.org/cpython/rev/7b83d2c1aad9
msg143069 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2011-08-27 14:32
As noted in the commit message, I didn't backport this, since it didn't seem worth risking breaking even the unlikely case that someone actually *was* using the MAILCAP environment variable on Windows.
History
Date User Action Args
2022-04-11 14:57:06 admin set github: 54132
2011-08-27 14:32:06 ncoghlan set status: open -> closedversions: - Python 2.7, Python 3.2messages: + resolution: fixedstage: patch review -> resolved
2011-08-27 14:17:44 python-dev set nosy: + python-devmessages: +
2011-08-23 14:02:27 ncoghlan set stage: test needed -> patch reviewversions: + Python 3.2, Python 3.3, - Python 3.1
2011-08-23 14:01:41 ncoghlan set assignee: ncoghlannosy: + ncoghlan
2011-05-09 14:40:37 eric.araujo set messages: +
2011-05-09 02:24:29 gnofi set messages: +
2011-05-07 15:29:10 eric.araujo set nosy: + eric.araujomessages: +
2011-05-07 15:27:49 eric.araujo set dependencies: + No unit test for mailcap module
2010-10-04 01:44:58 gnofi set messages: +
2010-09-25 22:38:37 gnofi set messages: +
2010-09-24 19:15:28 ned.deily set nosy: + ned.deilymessages: + stage: test needed
2010-09-24 15:05:27 ronaldoussoren set assignee: ronaldoussoren -> (no value)components: - macOSnosy: - ronaldoussoren
2010-09-23 03:06:20 gnofi set messages: + title: mailcap module may will not work on non-POSIX platforms if MAILCAPS env variable is set -> mailcap module may not work on non-POSIX platforms if MAILCAPS env variable is set
2010-09-23 03:04:32 gnofi set files: + mailcap_py3k.py
2010-09-23 03:03:55 gnofi create