Project

General

Profile

Bug #2877

lighty.stat failure

Added by zeroval 6 months ago. Updated 6 months ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
mod_magnet
Target version:
Start date:
2018-03-16
Due date:
% Done:

100%

Estimated time:
Missing in 1.5.x:

Description

I just upgraded to lighttpd 1.4.49 on Arch, and I started having this issue.

The issue is that `lighty.stat` causes my scripts to crash or otherwise stop executing.

I've tried, but I've had no luck getting a relevant backtrace. I'll continue working on it.

I can easily reproduce the issue by adding `lighty.stat('/an/invalid/path')` to any `mod_magnet` script and navigating to a relevant path in my browser.

drupal.conf (118 Bytes) drupal.conf relevant configuration zeroval, 2018-03-16 06:11
drupal.lua (507 Bytes) drupal.lua relevant script zeroval, 2018-03-16 06:11
lighttpd.conf (3.79 KB) lighttpd.conf zeroval, 2018-03-16 06:11

Associated revisions

Revision 86f64a02 (diff)
Added by gstrauss 6 months ago

[mod_magnet] fix regression in lighty.stat (fixes #2877)

fix regression in mod_magnet lighty.stat introduced in lighttpd 1.4.49
in commit b1df38ab

x-ref:
"lighty.stat failure"
https://redmine.lighttpd.net/issues/2877

History

#1

Updated by gstrauss 6 months ago

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

Yes, that's a regression from 1.4.48. :( Looks like it was introduced in commit b1df38ab

This may fix it. I'll have time to test later this evening:

--- a/src/mod_magnet.c
+++ b/src/mod_magnet.c
@@ -334,14 +334,16 @@ static int magnet_stat(lua_State *L) {
        handler_t res;

        res = stat_cache_get_entry(srv, con, sb, &sce);
-       stat_cache_content_type_get(srv, con, sb, sce);
-       buffer_free(sb);

        if (HANDLER_GO_ON != res) {
+               buffer_free(sb);
                lua_pushnil(L);
                return 1;
        }

+       stat_cache_content_type_get(srv, con, sb, sce);
+       buffer_free(sb);
+
        lua_newtable(L); // return value

        lua_pushboolean(L, S_ISREG(sce->st.st_mode));

#2

Updated by zeroval 6 months ago

I've tried your patch, and it seems to have worked.

#3

Updated by gstrauss 6 months ago

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

Also available in: Atom