Project

General

Profile

Bug #2835

empty var.CWD

Added by mbeniamino 4 months ago. Updated 4 months ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
core
Target version:
Start date:
2017-10-27
Due date:
% Done:

100%

Estimated time:
Missing in 1.5.x:

Description

A recent update broke a certain instance of lighttpd I was using for local development with the error:

2017-10-27 10:09:55: (configfile.c.1470) a default document-root has to be set
2017-10-27 10:09:55: (server.c.1218) setting default values failed

I traced back the cause to the fact that now var.CWD is the empty string:

[mbeniamino@mbeniamino4 ~]$ lighttpd -f /dev/null -p
config {
    var.PID = 7703
    var.CWD = "" 

}

I don't think this is the intended behaviour, is it?

lighttpd version: lighttpd/1.4.47
OS: ArchLinux

Associated revisions

Revision b27f1c09 (diff)
Added by gstrauss 4 months ago

[core] fix var.CWD (regression in 1.4.46) (fixes #2835)

(broken in 86bb8be2)

x-ref:
"empty var.CWD"
https://redmine.lighttpd.net/issues/2835

History

#1

Updated by gstrauss 4 months ago

  • Status changed from New to Patch Pending
  • Target version changed from 1.4.x to 1.4.48

Broke in 86bb8be2c
Thanks for reporting. This fixes it:

--- a/src/configfile.c
+++ b/src/configfile.c
@@ -1355,7 +1355,7 @@ int config_read(server *srv, const char *fn) {
        dcwd = data_string_init();
        buffer_string_prepare_copy(dcwd->value, 1023);
        if (NULL != getcwd(dcwd->value->ptr, dcwd->value->size - 1)) {
-               buffer_commit(dcwd->value, buffer_string_length(dcwd->value));
+               buffer_commit(dcwd->value, strlen(dcwd->value->ptr));
                buffer_copy_string_len(dcwd->key, CONST_STR_LEN("var.CWD"));
                array_insert_unique(dc->value, (data_unset *)dcwd);
        } else {

#2

Updated by gstrauss 4 months ago

  • Category set to core
#3

Updated by gstrauss 4 months ago

  • Status changed from Patch Pending to Fixed
  • % Done changed from 0 to 100

Also available in: Atom