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) *  |
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) *  |
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) *  |
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)  |
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) *  |
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. |
|
|