Project

General

Profile

Actions

Bug #2154

closed

Right-hand slash and similar aliases

Added by aderouineau over 14 years ago. Updated about 14 years ago.

Status:
Invalid
Priority:
Normal
Category:
mod_alias
Target version:
-
ASK QUESTIONS IN Forums:

Description

The following makes the server crash (without any explicit errors by the way [see END]):

alias.url = (
   "/onelink" => "/var/www/onelink/",
   "/link0"   => "/var/www/link0/",
   "/link1"   => "/var/www/link1/" 
)

However, the following does not:

alias.url = (
   "/onelink" => "/var/www/onelink/",
   "/link0/"   => "/var/www/link0/",
   "/link1/"   => "/var/www/link1/" 
)

All versions seem to be affected.

[END]
These are the only two lines given when the server crashes under these circumstances:

2010-01-17 23:06:05: (log.c.75) server started
2010-01-17 23:06:05: (server.c.908) Configuration of plugins failed. Going down.
Actions #1

Updated by aderouineau over 14 years ago

For some reason it did not accept my trying to make the slashes bold, so here's the second text:

alias.url = (
"/onelink" => "/var/www/onelink/",
"/link0/" => "/var/www/link0/",
"/link1/" => "/var/www/link1/"
)

Actions #2

Updated by stbuehler over 14 years ago

  • Status changed from New to Need Feedback
  • Priority changed from High to Normal

A crash on startup is not a high priority in my eyes; apart from that it just works for me without a problem.

Perhaps you have a alias.url += ( "/link00" => "..." ) later? mod_alias rejects such configs, as the second alias never matches.
Since version 1.4.21 this gets logged properly, before 1.4.21 it was printed on stderr (if that wasn't closed before).

Btw: I see a difference between "crash" and "rejects config"...

Actions #3

Updated by stbuehler over 14 years ago

  • Status changed from Need Feedback to Invalid

Ah, just saw your discussion on irc.

As i said, if you have aliases like alias.url = ( "/a" => "..", "/aa" => ".." ) the second alias doesn't do anything; either the first matches and is used, or the second cannot match.

In the version you have been using (1.4.19) this wasn't logged proplery. spaam just didn't read the error.log...

Actions #4

Updated by aderouineau over 14 years ago

  • Status changed from Invalid to Reopened

"
Btw: I see a difference between "crash" and "rejects config"...
"

it is indeed a crash since the init.d script reports the server as started (unlike when it can't load a module or there's a syntax error) and lighttpd does not directly report anything either.

How come the second alias would not get matched? And why does the documentation say that aliases without the right-hand slash should be used generally?

On a sidenote, it seems that independently of the presence of a right-hand slash, i have to type in the slash on my client or else I get a 404. What gives?

Actions #5

Updated by stbuehler over 14 years ago

  • Status changed from Reopened to Invalid

I told you we fixed the logging. And please THINK about it: if an url doesn't start with "/a" it cannot start with "/aa". To debug other problems just use the DebugVariables.

And it is not a crash, lighttpd just decides to not accept a broken config - nothing wrong with that.

Actions #6

Updated by aderouineau about 14 years ago

  • Status changed from Invalid to Reopened

If I have the longer of the two first, it works:

alias.url = (
"/onelink" => "/var/www/onelink/",
"/link2" => "/var/www/link2/",
"/link" => "/var/www/link/"
)

Why can't lighttpd automatically load all mappings and detect the longer ones to put them in the right order? That would thus seem like a bug for me...

Since spaam had told me lighttpd had "crashed" for him, that means he did not get an error message from the init script (you can get one if there's a syntax error or if a plugin is missing [aka it was misspelled in the config]). And even if in the error file you log the problem, but nothing is given to the admin when executing the init script (aka he sees it has started and does not bother to check), it is then a "crash".

Actions #7

Updated by stbuehler about 14 years ago

  • Status changed from Reopened to Invalid

No magic to fix broken configs. The modules see the config after the daemonize (for various reasons like fork()s), so we cannot report it before it.

Actions #8

Updated by aderouineau about 14 years ago

How is having /link before /link2 a broken config???? There's not even any documentation on that!!

This is what I get when I mistype a module name:

Stopping web server: lighttpd.
Starting web server: lighttpd2010-01-24 13:06:37: (plugin.c.165) dlopen() failed for: /usr/lib/lighttpd/mod_scgis.so /usr/lib/lighttpd/mod_scgis.so: cannot open shared object file: No such file or directory
2010-01-24 13:06:37: (server.c.621) loading plugins finally failed
failed!

Does it say that for newer versions of lighttpd when it comes to aliases?

Actions #9

Updated by aderouineau about 14 years ago

  • Status changed from Invalid to Reopened
Actions #10

Updated by stbuehler about 14 years ago

  • Status changed from Reopened to Invalid

That is enough now. I have better things to do.

Actions #11

Updated by Olaf-van-der-Spek about 14 years ago

stbuehler wrote:

The modules see the config after the daemonize (for various reasons like fork()s), so we cannot report it before it.

It would actually be nice to move to the background as late as possible...

Actions #12

Updated by stbuehler about 14 years ago

Yes, sure. But i don't want to change the config system into "config verification" (checking alias, ...) and "config activation" (fork()) in 1.4.x - for the same reason as always: it is the "stable" version.

So we have only one stage for modules to check and "activate" the config, and this includes doing fork()s, which should imho be after the daemonize().

There is also the question when to drop privileges and so on :)

Actions #13

Updated by Olaf-van-der-Spek about 14 years ago

Why should fork be done after daemon?

Actions

Also available in: Atom