Fossil Forum

fossil cgi error
Login

fossil cgi error

fossil cgi error

(1) By ET. on 2022-05-05 15:34:05 [link] [source]

$ fossil cgi
no such file: cgi

I was expecting the help text but got a no such file: cgi error.

I'm guessing it's an off by one error.

(2) By Stephan Beal (stephan) on 2022-05-05 15:55:06 in reply to 1 [link] [source]

I was expecting the help text but got a no such file: cgi error.

i'll look into it later this evening.

For future reference, fossil never outputs its help text without being told to via the help command. Some commands will output a one-line usage text when passed incorrect arguments, but never the help text.

(3) By Stephan Beal (stephan) on 2022-05-05 16:33:02 in reply to 1 [source]

I was expecting the help text but got a no such file: cgi error.

It turns out that resolving this is not quite straightforward because it's actually working as designed.

When fossil is run under a CGI environment without a command name, it treats its first argument as a CGI wrapper file and runs the "cgi" command, passing on that file name as its first argument. When that command is explicitly run, as in this thread's first posrt, the first argument is "cgi".

It's not clear how to fix this without causing further confusion or risking breaking any internal use of the CGI command for cases where it's proxied by another command (if there are any such cases - that's not clear and it's difficult to determine because fossil sometimes calls back into itself as a new process via system(), as opposed to calling the C function associated with the feature its recursing into).

There is one "quick fix" but it leads to the command generating its error message in CGI-compatible form, which isn't terribly useful for manual invocation:

[stephan@nuc:~/fossil/fossil]$ ./fossil cgi
Status: 500 Internal Server Error
Cache-control: no-cache
X-Frame-Options: SAMEORIGIN
Content-Type: text/html; charset=utf-8
Content-Length: 83

<html><body><h1>Internal Server Error</h1>
<plaintext>No CGI control file specified

So... i'm going to leave this as is and recommend either not calling the cgi command manually or always passing the config file name as the next argument.