Verified Commit 40b85dab authored by Jan Pavlinec's avatar Jan Pavlinec Committed by Josef Schlehofer
Browse files

knot-resolver: update to version 5.2.1

Changes:
- rebase fix-prefix patch
- drop fix-map-for-32bit-platforms patch which is part of 5.2.1
parent 77655c0d
#
# Copyright (C) 2015-2020 CZ.NIC, z. s. p. o. (https://www.nic.cz/)
# Copyright (C) 2015-2021 CZ.NIC, z. s. p. o. (https://www.nic.cz/)
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
......@@ -10,12 +10,12 @@ PKG_RELRO_FULL:=0
include $(TOPDIR)/rules.mk
PKG_NAME:=knot-resolver
PKG_VERSION:=5.2.0
PKG_VERSION:=5.2.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://secure.nic.cz/files/knot-resolver
PKG_HASH:=8824267ca3331fa06d418c1351b68c648da0af121bcbc84c6e08f5b1e28d9433
PKG_HASH:=aa37b744c400f437acba7a54aebcbdbe722ece743d342cbc39f2dd8087f05826
PKG_MAINTAINER:=Knot DNS <knot-dns@labs.nic.cz>
PKG_LICENSE:=GPL-3.0-later
......
......@@ -19,30 +19,30 @@ which is now not propagated in OpenWrt meson host package.
-prefix = get_option('prefix')
+## prefix = get_option('prefix')
+prefix = '/usr'
data_dir = join_paths(prefix, get_option('datadir'), 'knot-resolver')
doc_dir = join_paths(prefix, get_option('datadir'), 'doc', 'knot-resolver')
info_dir = join_paths(prefix, get_option('datadir'), 'info')
examples_dir = join_paths(doc_dir, 'examples')
-etc_dir = join_paths(prefix, get_option('sysconfdir'), 'knot-resolver')
-lib_dir = join_paths(prefix, get_option('libdir'), 'knot-resolver')
+## etc_dir = join_paths(prefix, get_option('sysconfdir'), 'knot-resolver')
+## lib_dir = join_paths(prefix, get_option('libdir'), 'knot-resolver')
data_dir = prefix / get_option('datadir') / 'knot-resolver'
doc_dir = prefix / get_option('datadir') / 'doc' / 'knot-resolver'
info_dir = prefix / get_option('datadir') / 'info'
examples_dir = doc_dir / 'examples'
-etc_dir = prefix / get_option('sysconfdir') / 'knot-resolver'
-lib_dir = prefix / get_option('libdir') / 'knot-resolver'
+## etc_dir = prefix / get_option('sysconfdir') / 'knot-resolver'
+## lib_dir = prefix / get_option('libdir') / 'knot-resolver'
+etc_dir = '/etc/kresd'
+lib_dir = '/usr/lib'
modules_dir = join_paths(lib_dir, 'kres_modules')
-sbin_dir = join_paths(prefix, get_option('sbindir'))
+## sbin_dir = join_paths(prefix, get_option('sbindir'))
modules_dir = lib_dir / 'kres_modules'
-sbin_dir = prefix / get_option('sbindir')
+## sbin_dir = prefix / get_option('sbindir')
+sbin_dir = '/usr/bin'
run_dir = join_paths('/run', 'knot-resolver')
systemd_work_dir = join_paths(prefix, get_option('localstatedir'), 'lib', 'knot-resolver')
systemd_cache_dir = join_paths(prefix, get_option('localstatedir'), 'cache', 'knot-resolver')
run_dir = '/run' / 'knot-resolver'
systemd_work_dir = prefix / get_option('localstatedir') / 'lib' / 'knot-resolver'
systemd_cache_dir = prefix / get_option('localstatedir') / 'cache' / 'knot-resolver'
@@ -63,7 +67,8 @@ mod_inc_dir = include_directories('.', '
## Trust anchors
managed_ta = get_option('managed_ta') == 'enabled'
-keyfile_default = join_paths(etc_dir, get_option('keyfile_default'))
+## keyfile_default = join_paths(etc_dir, get_option('keyfile_default'))
-keyfile_default = etc_dir / get_option('keyfile_default')
+## keyfile_default = etc_dir / get_option('keyfile_default')
+keyfile_default = '/etc/root.keys'
if keyfile_default == join_paths(etc_dir, 'root.keys')
if keyfile_default == etc_dir / 'root.keys'
managed_ta = managed_ta or get_option('managed_ta') == 'auto'
endif
From e01979620025666633250b3e2d545fe59c629f73 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= <vladimir.cunat@nic.cz>
Date: Fri, 13 Nov 2020 14:16:32 +0100
Subject: [PATCH] fix map() command on 32-bit platforms; regressed in 5.2.0
LuaJIT FFI was using opendir() (etc.) variants with 32-bit inodes
but the C parts was using them as 64-bit inode variants.
Consequently the `struct dirent` layout didn't match and we were getting
filenames shifted by eight bytes.
Now the whole dir-listing lua function is written in C.
---
.luacheckrc | 1 +
NEWS | 4 ++++
daemon/bindings/impl.c | 27 +++++++++++++++++++++++++++
daemon/lua/kluautil.lua | 31 +------------------------------
4 files changed, 33 insertions(+), 30 deletions(-)
diff --git a/.luacheckrc b/.luacheckrc
index 0cf0b884a..67bc18f6b 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -20,6 +20,7 @@ new_read_globals = {
'user',
'verbose',
'worker',
+ 'kluautil_list_dir',
-- Sandbox declarations
'kB',
'MB',
diff --git a/NEWS b/NEWS
index 2eae30824..9d8cde991 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,10 @@
Knot Resolver X.Y.X (yyyy-mm-dd)
================================
+Bugfixes
+--------
+- fix map() command on 32-bit platforms; regressed in 5.2.0 (!1093)
+
Knot Resolver 5.2.0 (2020-11-11)
================================
diff --git a/daemon/bindings/impl.c b/daemon/bindings/impl.c
index d10f45257..d9ad0774f 100644
--- a/daemon/bindings/impl.c
+++ b/daemon/bindings/impl.c
@@ -2,6 +2,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
+#include <dirent.h>
#include <lua.h>
#include <lauxlib.h>
#include <string.h>
@@ -29,6 +30,29 @@ const char * lua_table_checkindices(lua_State *L, const char *keys[])
return NULL;
}
+/** Return table listing filenames in a given directory (ls -A). */
+static int kluautil_list_dir(lua_State *L)
+{
+ lua_newtable(L); // empty table even on errors
+
+ const char *path = lua_tolstring(L, 1, NULL);
+ if (!path) return 1;
+ DIR *dir = opendir(path);
+ if (!dir) return 1;
+
+ struct dirent *entry;
+ int lua_i = 1;
+ while ((entry = readdir(dir)) != NULL) {
+ if (strcmp(entry->d_name, ".") && strcmp(entry->d_name, "..")) {
+ lua_pushstring(L, entry->d_name);
+ lua_rawseti(L, -2, lua_i++);
+ }
+ }
+
+ closedir(dir);
+ return 1;
+}
+
/* Each of these just creates the correspondingly named lua table of functions. */
int kr_bindings_cache (lua_State *L); /* ./cache.c */
@@ -44,6 +68,9 @@ void kr_bindings_register(lua_State *L)
kr_bindings_modules(L);
kr_bindings_net(L);
kr_bindings_worker(L);
+
+ /* Finally some lua utils *written in C*, not really a binding. */
+ lua_register(L, "kluautil_list_dir", kluautil_list_dir);
}
void lua_error_p(lua_State *L, const char *fmt, ...)
diff --git a/daemon/lua/kluautil.lua b/daemon/lua/kluautil.lua
index 57912e7ba..e73e952cf 100644
--- a/daemon/lua/kluautil.lua
+++ b/daemon/lua/kluautil.lua
@@ -1,6 +1,5 @@
-- SPDX-License-Identifier: GPL-3.0-or-later
-local ffi = require('ffi')
local kluautil = {}
-- Get length of table
@@ -28,14 +27,6 @@ function kluautil.kr_table_unpack(tab)
return unpack(tab, 1, tab.n)
end
-ffi.cdef([[
- typedef struct __dirstream DIR;
- DIR *opendir(const char *name);
- struct dirent *readdir(DIR *dirp);
- int closedir(DIR *dirp);
- char *strerror(int errnum);
-]])
-
-- Fetch over HTTPS
function kluautil.kr_https_fetch(url, out_file, ca_file)
local http_ok, http_request = pcall(require, 'http.request')
@@ -88,26 +79,6 @@ function kluautil.kr_https_fetch(url, out_file, ca_file)
return true
end
--- List directory
-function kluautil.list_dir (path)
- local results = {}
- local dir = ffi.C.opendir(path)
- if dir == nil then
- return results
- end
-
- local entry = ffi.C.readdir(dir)
- while entry ~= nil do
- local entry_name = ffi.string(ffi.C.kr_dirent_name(entry))
- if entry_name ~= '.' and entry_name ~= '..' then
- table.insert(results, entry_name)
- end
- entry = ffi.C.readdir(dir)
- end
-
- ffi.C.closedir(dir)
-
- return results
-end
+kluautil.list_dir = kluautil_list_dir
return kluautil
--
GitLab
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment