Opened 9 years ago
Last modified 7 years ago
#11846 closed enhancement
Prevent invalid file in Environment plugins directory from disabling Trac instance — at Version 5
Reported by: | Ryan J Ollos | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 1.2.3 |
Component: | general | Version: | |
Severity: | normal | Keywords: | plugins |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description (last modified by )
imp.load_source
can raise a SystemExit
exception when there is an invalid file in the Environment's plugins
directory. A common scenario seems to be that the user will select setup.py
with the plugin installation file picker on the Plugins admin panel.
The patch might be as simple as (needs more testing):
-
trac/loader.py
diff --git a/trac/loader.py b/trac/loader.py index df65356..444e78d 100644
a b def load_py_files(): 87 87 env.log.debug('Loading file plugin %s from %s', 88 88 plugin_name, plugin_file) 89 89 if plugin_name not in sys.modules: 90 module = imp.load_source(plugin_name, plugin_file) 90 try: 91 imp.load_source(plugin_name, plugin_file) 92 except SystemExit, e: 93 env.log.warn("Can't load file plugin %s: %s", 94 plugin_file, exception_to_unicode(e)) 91 95 if path == auto_enable: 92 96 _enable_plugin(env, plugin_name) 93 97 except Exception, e:
The issue has come up a few times recently:
Change History (5)
comment:1 by , 9 years ago
Reporter: | changed from | to
---|
comment:2 by , 9 years ago
comment:4 by , 9 years ago
Milestone: | next-stable-1.0.x → next-major-releases |
---|
comment:5 by , 9 years ago
Description: | modified (diff) |
---|
Note:
See TracTickets
for help on using tickets.
Here's a relevant TODO tags/trac-1.0.2/trac/admin/web_ui.py@:500#L466. Validating the upload sounds like a good idea in addition to protecting against an invalid file in the environment
plugins
directory.