Edgewall Software

Opened 14 months ago

Closed 14 months ago

Last modified 9 months ago

#13574 closed defect (fixed)

Missing import in deploy_trac.fcgi — at Version 5

Reported by: ebourg@… Owned by: Jun Omae
Priority: normal Milestone: 1.4.4
Component: general Version: 1.5.4
Severity: trivial Keywords:
Cc: Branch:
Release Notes:

Removed unnecessary exception handling from deploy_trac.fcgi template.

API Changes:
Internal Changes:

Description

deploy_trac.fcgi calls sys.stdout but doesn't import sys, the Apache error.log reports it:

NameError: name 'sys' is not defined: /var/www/projects/myproject/cgi-bin/trac.fcgi

Due to this stacktraces are displayed in the Apache log and not on the web page.

Change History (5)

comment:1 by Ryan J Ollos, 14 months ago

Good catch. Looks like it was overlooked in r17541 / #13403.

We should likely fix it before releasing 1.6.

comment:2 by Ryan J Ollos, 14 months ago

Milestone: 1.6

comment:3 by Jun Omae, 14 months ago

Owner: set to Jun Omae
Status: newassigned

The fastcgi script writes traceback of the exception which formatted "Content-Type: text/plain", however the output is received by the process that started the fascgi script (e.g. mod_fcgid), not the web client. So that I don't think the script needs to catch and format the exception.

  • trac/web/templates/deploy_trac.fcgi

    diff --git a/trac/web/templates/deploy_trac.fcgi b/trac/web/templates/deploy_trac.fcgi
    index be526b647..866635d9b 100644
    a b  
    1515{##}#
    1616{##}# Author: Jonas Borgström <jonas@edgewall.com>
    1717
    18 try:
     18def main():
    1919    import os
    2020    import pkg_resources
    2121    if 'TRAC_ENV' not in os.environ and \
    try:  
    3030        pkg_resources.set_extraction_path(egg_cache)
    3131    from trac.web import fcgi_frontend
    3232    fcgi_frontend.run()
    33 except SystemExit:
    34     raise
    35 except Exception as e:
    36     print("Content-Type: text/plain", end="\r\n")
    37     print("", end="\r\n")
    38     print("Oops...")
    39     print("")
    40     print("Trac detected an internal error:")
    41     print("")
    42     print(e)
    43     print("", flush=True)
    44     import traceback
    45     traceback.print_exc(file=sys.stdout)
     33
     34if __name__ == '__main__':
     35    main()

comment:4 by Jun Omae, 14 months ago

Milestone: 1.61.4.4
Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Fixed in [17688] and merged in [17689].

comment:5 by Ryan J Ollos, 9 months ago

Release Notes: modified (diff)
Note: See TracTickets for help on using tickets.