Modify

Opened 9 years ago

Last modified 5 years ago

#12678 new enhancement

Error message when diagram image cannot be written

Reported by: Ryan J Ollos Owned by: Jun Omae
Priority: normal Component: TracWorkflowAdminPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description

I just took over maintenance of a server and saw the following error after running the TracAdmin deploy command.

Here is the traceback from the logs:

2016-02-22 02:06:16,740 Trac[main] ERROR: Internal Server Error: 
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/Trac-1.0.2-py2.6.egg/trac/web/main.py", line 512, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.6/site-packages/Trac-1.0.2-py2.6.egg/trac/web/main.py", line 221, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.6/site-packages/Trac-1.0.2-py2.6.egg/trac/admin/web_ui.py", line 120, in process_request
    path_info)
  File "build/bdist.linux-x86_64/egg/tracworkflowadmin/web_ui.py", line 137, in render_admin_panel
    self._parse_request(req)
  File "build/bdist.linux-x86_64/egg/tracworkflowadmin/web_ui.py", line 700, in _parse_request
    self._update_diagram(req, params) # not return
  File "build/bdist.linux-x86_64/egg/tracworkflowadmin/web_ui.py", line 455, in _update_diagram
    self._create_diagram_image(path, dir, script, errors)
  File "build/bdist.linux-x86_64/egg/tracworkflowadmin/web_ui.py", line 462, in _create_diagram_image
    fd, tmp = mkstemp(suffix='.png', dir=dir)
  File "/usr/lib64/python2.6/tempfile.py", line 293, in mkstemp
    return _mkstemp_inner(dir, prefix, suffix, flags)
  File "/usr/lib64/python2.6/tempfile.py", line 228, in _mkstemp_inner
    fd = _os.open(file, flags, 0600)
OSError: [Errno 13] Permission denied: '<path/to>/htdocs/tracworkflowadmin/tmp7GtMK8.png'

The error was due to the following ownership permissions:

$ ls -ald htdocs/tracworkflowadmin
drwxr-xr-x 5 root apache 4096 Feb 22 02:13 htdocs/tracworkflowadmin

The fix was straightforward after looking at the code to see what it was doing.

$ ls -ald htdocs/tracworkflowadmin
drwxr-xr-x 5 apache apache 4096 Feb 22 02:13 htdocs/tracworkflowadmin

I was just thinking that this scenario is probably not all that uncommon, and it might be nice to provide an error message to guide the user to a solution in this case.

Attachments (2)

Screen Shot 2016-02-21 at 23.22.15.png (27.2 KB) - added by Ryan J Ollos 9 years ago.
t12678.diff (2.4 KB) - added by Ryan J Ollos 5 years ago.

Download all attachments as: .zip

Change History (9)

Changed 9 years ago by Ryan J Ollos

comment:1 Changed 9 years ago by Jun Omae

Indeed. Another thinking, after Trac 1.0, the plugin could use $ENV/files/tracworkflowadmin directory rather than $ENV/htdocs/tracworkflowadmin. The $ENV/files directory normally is writable to web server.

comment:2 Changed 9 years ago by Ryan J Ollos

Saving to $ENV/files/tracworkflowadmin sounds like a good idea.

comment:3 in reply to:  1 Changed 9 years ago by Ryan J Ollos

Replying to jun66j5:

Indeed. Another thinking, after Trac 1.0, the plugin could use $ENV/files/tracworkflowadmin directory rather than $ENV/htdocs/tracworkflowadmin. The $ENV/files directory normally is writable to web server.

What do you think about using $ENV/files/tracworkflowadmin for Trac 0.12+ and adding an installation step that tells the user to create the directory in Trac 0.12? I haven't checked whether the Trac 1.0 upgrade step that creates files would complain if the directory already exists.

comment:4 Changed 9 years ago by Ryan J Ollos

#11102 closed as a duplicate.

comment:5 Changed 8 years ago by komar@…

I have such problem

  File "/usr/lib/python2.7/dist-packages/tracworkflowadmin/web_ui.py", line 428, in _image_path_setup
    os.mkdir(dir)
OSError: [Errno 13] Permission denied: '/var/lib/trac/evologics/htdocs/tracworkflowadmin'

And error message was alert popup with message like "[Object..]500[Object]

Changed 5 years ago by Ryan J Ollos

Attachment: t12678.diff added

comment:6 Changed 5 years ago by Ryan J Ollos

t12678.diff uses $env/files/tracworkflowadmin for Trac >= 1.0. The patch from #13745 is included.

comment:7 Changed 5 years ago by Ryan J Ollos

trac:#13247 is related.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Jun Omae.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.