-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: flukso/lua-mosquitto#37
- Loading branch information
1 parent
f6cb711
commit f65e84d
Showing
2 changed files
with
58 additions
and
4 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
main/lua-mosquitto/0001-handle-lookup-errors-when-connecting.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
From d1e530459cb45b4aace4a3e7258e83dbefff93bb Mon Sep 17 00:00:00 2001 | ||
From: Natanael Copa <[email protected]> | ||
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
# Maintainer: Natanael Copa <[email protected]> | ||
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 | ||
" |