1

I have a freshly installed server running Debian squeeze. I've installed Python 2.6.6 and Trac 1.0.1 using easy_install. Trac runs fine when started using tracd. Now I'm trying to configure lighttpd to run Trac using FastCGI. I'm using the following configuration for the FastCGI connection:

fastcgi.server = (
    "/project" => (
        (
            "socket" => "/tmp/trac-fastcgi-first.sock",
            "bin-path" => "/usr/local/lib/python2.6/dist-packages/Trac-1.0.1-py2.6.egg/trac/web/fcgi_frontend.py",
            "check-local" => "disable",
            "bin-environment" => ("TRAC_ENV" => "/var/trac/project")
        )
    )
)

When I start lighttpd using lighttpd -D -f /etc/lighttpd/lighttpd.conf, it just prints : No such file or directory and exits. I don't think it has anything to do with the configuration of lighttpd, if I run the backend script directly, using /usr/local/lib/python2.6/dist-packages/Trac-1.0.1-py2.6.egg/trac/web/fcgi_frontend.py, it prints just that : No such file or directory.

Has anyone had the same problem? And where do I even start looking for the problem?

Feuermurmel
  • 151
  • 1
  • 8
  • 1
    Does `fcgi_frontend.py` have a shebang specifying the interpreter (i.e. the `#!` on the first line). Does the specified interpreter exist? – mgorven Feb 19 '13 at 19:48
  • @mgorven Your comment brought me to a solution! The first line of that script says `#!/usr/bin/env python`. A symlink at `/usr/bin/python` is pointing to the installed Python 2.6 interpreter. But for some reason, the script is encoded using CRLF line endings. Removing all the CRs solves the problem. Who should I report this problem to? – Feuermurmel Feb 20 '13 at 09:36

1 Answers1

0

It seems that in the distribution of Trac installed using easy_install Trac=1.0.1, at least the FastCGI wrapper script file under /usr/local/lib/python2.6/dist-packages/Trac-1.0.1-py2.6.egg/trac/web/fcgi_frontend.py is encoded using CRLF line endings. This results in the shebang line not being read correctly be the kernel and results in the strange error message.

Removing all CR characters from the file fixes the problem:

$ cd /usr/local/lib/python2.6/dist-packages/Trac-1.0.1-py2.6.egg/trac/web/
$ tr -d '\r' < fcgi_frontend.py > fcgi_frontend.py~
$ mv fcgi_frontend.py~ fcgi_frontend.py
$ chmod a+x fcgi_frontend.py
Feuermurmel
  • 151
  • 1
  • 8