This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author TheRegRunner
Recipients TheRegRunner, docs@python, r.david.murray
Date 2015-10-29.19:26:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1446146797.06.0.358245124953.issue24778@psf.upfronthosting.co.za>
In-reply-to
Content
My patch for mailcap.py. Please check and apply my patch please.

1) I have removed the os.system() calls for security reasons.

2) New "findmtach_list()" function witch returns the commandline as a [list] witch can be passed to subprocess instead of passing it to os.system().

3) New run() function to execute the cmd_list with subprocess. 

4) The test() function now uses findmatch_list() and run() instead of the old findmatch() and os.system() calls.  

5) The subst() function is now shorter an does a quote(filename) when its replacing %s with a filename.

6) The "old" findmatch() function is still there if the user still likes to have the commandline as a "string". 
Attention ! With this old findmatch() function it's still possible that a shell command in the filename like '$(ls).txt' will be executed when the users passes the string to os.system() outside the mailcap script. Use findmatch() only for backwards compatibility.

7) Use the new findmatch_list() an run() for future projects.

8) Add 1)-7) to the docs

Thank you.
History
Date User Action Args
2015-10-29 19:26:37TheRegRunnersetrecipients: + TheRegRunner, r.david.murray, docs@python
2015-10-29 19:26:37TheRegRunnersetmessageid: <1446146797.06.0.358245124953.issue24778@psf.upfronthosting.co.za>
2015-10-29 19:26:37TheRegRunnerlinkissue24778 messages
2015-10-29 19:26:36TheRegRunnercreate