From 99ca59d7e662d17759f6fcc73d56effff49c481a Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Mon, 12 Jun 2023 16:06:04 +0200 Subject: [PATCH] main/lua-mosquitto: fix error handling, fix lua5.4 install Ensure that lua 5.4 module is installed in correct location. Fix error handling, for lookup errors. ref: https://github.com/flukso/lua-mosquitto/pull/37 --- ...handle-lookup-errors-when-connecting.patch | 49 +++++++++++++++++++ main/lua-mosquitto/APKBUILD | 13 +++-- 2 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 main/lua-mosquitto/0001-handle-lookup-errors-when-connecting.patch diff --git a/main/lua-mosquitto/0001-handle-lookup-errors-when-connecting.patch b/main/lua-mosquitto/0001-handle-lookup-errors-when-connecting.patch new file mode 100644 index 000000000000..775c163782d4 --- /dev/null +++ b/main/lua-mosquitto/0001-handle-lookup-errors-when-connecting.patch @@ -0,0 +1,49 @@ +From d1e530459cb45b4aace4a3e7258e83dbefff93bb Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Mon, 12 Jun 2023 15:54:59 +0200 +Subject: [PATCH] handle lookup errors when connecting + +Connect may result in lookup error, which was not handled. Solve this by +use a default error handler which returns whatever mosquitto reports. + +This prevents us from missing errors. +--- + lua-mosquitto.c | 15 +++++++-------- + 1 file changed, 7 insertions(+), 8 deletions(-) + +diff --git a/lua-mosquitto.c b/lua-mosquitto.c +index 7f298bd..bae378d 100644 +--- a/lua-mosquitto.c ++++ b/lua-mosquitto.c +@@ -99,21 +99,20 @@ static int mosq__pstatus(lua_State *L, int mosq_errno) { + return luaL_error(L, mosquitto_strerror(mosq_errno)); + break; + +- case MOSQ_ERR_NO_CONN: +- case MOSQ_ERR_CONN_LOST: +- case MOSQ_ERR_PAYLOAD_SIZE: ++ case MOSQ_ERR_ERRNO: + lua_pushnil(L); +- lua_pushinteger(L, mosq_errno); +- lua_pushstring(L, mosquitto_strerror(mosq_errno)); ++ lua_pushinteger(L, errno); ++ lua_pushstring(L, strerror(errno)); + return 3; + break; + +- case MOSQ_ERR_ERRNO: ++ default: + lua_pushnil(L); +- lua_pushinteger(L, errno); +- lua_pushstring(L, strerror(errno)); ++ lua_pushinteger(L, mosq_errno); ++ lua_pushstring(L, mosquitto_strerror(mosq_errno)); + return 3; + break; ++ + } + + return 0; +-- +2.41.0 + diff --git a/main/lua-mosquitto/APKBUILD b/main/lua-mosquitto/APKBUILD index 38361d333e50..08d71c50fd72 100644 --- a/main/lua-mosquitto/APKBUILD +++ b/main/lua-mosquitto/APKBUILD @@ -1,14 +1,16 @@ # Maintainer: Natanael Copa pkgname=lua-mosquitto pkgver=0.4.1 -pkgrel=1 +pkgrel=2 pkgdesc="Bindings to libmosquitto for Lua" url="https://github.com/flukso/lua-mosquitto" arch="all" license="MIT" makedepends="mosquitto-dev" source="lua-mosquitto-$pkgver.tar.gz::https://github.com/flukso/lua-mosquitto/archive/v$pkgver.tar.gz - checkinteger.patch" + checkinteger.patch + 0001-handle-lookup-errors-when-connecting.patch + " _luaversions="5.1 5.2 5.3 5.4" for _v in $_luaversions; do @@ -27,7 +29,7 @@ prepare() { build() { local lver; for lver in $_luaversions; do msg "Building for Lua $lver..." - make -C "$builddir-$lver" LUAPKGC=lua$lver + make -C "$builddir-$lver" LUAPKGC=lua$lver LUA_VERSION=$lver done } @@ -53,9 +55,11 @@ _package() { local rockdir="$subpkgdir/usr/lib/luarocks/rocks-$lver/$pkgname/$pkgver-1" cd "$builddir-$lver" + msg "installig Lua $lver" make install DESTDIR="$subpkgdir" \ LUA_LIBDIR=/usr/lib \ - LUAPKGC=lua$lver + LUAPKGC=lua$lver \ + LUA_VERSION=$lver mkdir -p "$rockdir" echo 'rock_manifest = {}' > "$rockdir"/rock_manifest @@ -64,4 +68,5 @@ _package() { sha512sums=" f94944d334142283006c3f079ced5284a1c41199fb9de7d7c4eb7c1a4fc412dc53f2f93cb5f08c54fec85c59fc8c2ee840111d4fbf0ff61a2254c8f83fa97e87 lua-mosquitto-0.4.1.tar.gz d564b6ffbc1ed79cdaeb53c8cb94db946d697fa97a9e36a68ef5300a3f7f53eeb5216ddb5941cf8610b31d9f29f8ca697790431284842e87d1d85be8637a519b checkinteger.patch +627ea37dfbfe2df93bfbd0d8918b1e0d0c8619c404b6009779dc2cf55dde519add76b0ca2320dfee7e1524b4ce89415523f8d327a97e7dceb575de2c92830793 0001-handle-lookup-errors-when-connecting.patch "