From e26a7b5ef1fe42a66a3c91fe878da93c7cf83737 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 18 Jul 2022 20:36:58 +0100 Subject: gentoo auto-resync : 18:07:2022 - 20:36:57 --- media-libs/libinsane/Manifest | 3 +- .../libinsane/files/libinsane-1.0.9-musl.patch | 238 +++++++++++++++++++++ media-libs/libinsane/libinsane-1.0.9.ebuild | 6 +- 3 files changed, 244 insertions(+), 3 deletions(-) create mode 100644 media-libs/libinsane/files/libinsane-1.0.9-musl.patch (limited to 'media-libs/libinsane') diff --git a/media-libs/libinsane/Manifest b/media-libs/libinsane/Manifest index 2964faefe12a..37d12803b3c3 100644 --- a/media-libs/libinsane/Manifest +++ b/media-libs/libinsane/Manifest @@ -1,4 +1,5 @@ AUX libinsane-1.0.1-meson_options.patch 2038 BLAKE2B b14ba254604f214c2cd1a15e705ea361b635bac7faae4995811477456ea8a8d8bf969fefb4330b3b6f05cd498cd2f01b8b065c2f8f3c88e21e62ea6ef204de15 SHA512 c0d5d3ce5d763d04327ea500229c9f26d989aa8072dec569adb3766c70e0cab9e00629e3099c5ab8bd4e3c84b86925ad108fe78eeae9066164de1302e2226572 +AUX libinsane-1.0.9-musl.patch 8877 BLAKE2B 00a344cc995342ee4d8025be142a277ecb031e39a7a9d415d98ac0e45e0cbf4ee234f55473bbd1bb1fbe24d24ab2245027085f63841438f04db3b71e83c18652 SHA512 97660a9f1a074bdefcddebed21603dad89c39a1138a48571ddf360953c12d9369b63efaaeb21c750de11b1260fb87a1cc2041604e01f57d14c142ed3abae6787 DIST libinsane-1.0.9.tar.gz 965461 BLAKE2B ee464d8b3328e8205dbc04d779c8c55133c3bab8b5483ab151870c22311f5d5c000a535baba95ea6362d130f57b6f185e9391017f808dec4bf23a93109546337 SHA512 a3d5ef16363454956c39767968515db76d1c279035e3a4c6a7db77a3e99e409b77cdacd27ccfba0fe80f5bf36d8c37d700aed551645b6038f3b770b2eaec10e2 -EBUILD libinsane-1.0.9.ebuild 960 BLAKE2B 2a1a06eb5298f55876733c54b44429ae5b725fde3d58107be717d6b66f6b7b536eb3dc7f3bbbeb9605e1143075dd5d3f787c698254298df1a2a98a9085e4af0a SHA512 a5b1eb340dbeaadd6874e3dd4feef06c115bd6c0bae62fa95dd0288ffd85b45c2745a8095283f150b32bf5f8bded24755075937ebcc1d6caf3dae0bf3219144c +EBUILD libinsane-1.0.9.ebuild 992 BLAKE2B 0cbcca0c7c505512b16692fd3d0ded8b2d4d1d42850f26fb1c2eec5366ac6640e051d23fa7f5cbf6a138da68595382e2717e3b71c11b5dba9cce38adb785a54c SHA512 f5df12a6e92428fb62ec42f1ea9f4d680a83c5eed8c12e0958d487853174e05632993ecbd7cad20b25e66d8735beadd633f4ea4cb63e80709d2afa6e4baebba3 MISC metadata.xml 1016 BLAKE2B a332e663ae5b286f57990c4e48d0c3767a54b6e5f6059986367783b75618dabbd13c2118de34e8c750765f3bed207cc40a8eaeca02e2fb8b5d2557799457d5b5 SHA512 b8870c17184ef366edf70710deb5f40e16819301870478c8902471bf09820fb08c9cfd85ae14d844c2a0b8ad3ba1f99cf6c84a7d47c5029a40de5584ab73efa7 diff --git a/media-libs/libinsane/files/libinsane-1.0.9-musl.patch b/media-libs/libinsane/files/libinsane-1.0.9-musl.patch new file mode 100644 index 000000000000..319c1473c29b --- /dev/null +++ b/media-libs/libinsane/files/libinsane-1.0.9-musl.patch @@ -0,0 +1,238 @@ +From 43bde093ca66f430ae9c78204fcf02e6edf28833 Mon Sep 17 00:00:00 2001 +From: Bernard Cafarelli +Date: Fri, 15 Jul 2022 17:38:43 +0200 +Subject: [PATCH 1/2] dedicated_process: only enable backtrace when GLIBC is + used + +This is a GNU-specific extension so will not compile (and execinfo.h not +found) with other libc like MUSL +--- + .../libinsane/src/workarounds/dedicated_process/worker.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/subprojects/libinsane/src/workarounds/dedicated_process/worker.c b/subprojects/libinsane/src/workarounds/dedicated_process/worker.c +index 51a9209..826ae8a 100644 +--- a/subprojects/libinsane/src/workarounds/dedicated_process/worker.c ++++ b/subprojects/libinsane/src/workarounds/dedicated_process/worker.c +@@ -1,5 +1,7 @@ + #include ++#ifdef __GLIBC__ + #include ++#endif + #include + #include + #include +@@ -144,8 +146,10 @@ static void worker_log_callback(enum lis_log_level lvl, const char *msg) + #ifndef DISABLE_CRASH_HANDLER + static void crash_handler(int sig) { + pid_t mypid; ++#ifdef __GLIBC__ + void *stack[16]; + size_t size; ++#endif + unsigned int i; + + mypid = getpid(); +@@ -165,6 +169,7 @@ static void crash_handler(int sig) { + ); + } + ++#ifdef __GLIBC__ + fprintf(stderr, "======== START OF BACKTRACE ========\n"); + + // get void*'s for all entries on the stack +@@ -175,6 +180,7 @@ static void crash_handler(int sig) { + + fsync(STDERR_FILENO); + fprintf(stderr, "======== END OF BACKTRACE ========\n"); ++#endif + + if (kill(mypid, sig) < 0) { + fprintf(stderr, "KILL FAILED\n"); +-- +GitLab + + +From 4a9eeb0df231668fd3760761f6fbe99c4e81d3ab Mon Sep 17 00:00:00 2001 +From: Bernard Cafarelli +Date: Fri, 15 Jul 2022 18:10:48 +0200 +Subject: [PATCH 2/2] dedicated_process: rename stderr communication pipes + +On some systems, stdin, stdout, and stderr are macros that you cannot +assign to in the normal way [1]. This uses std_err instead + +[1] https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html +--- + .../workarounds/dedicated_process/master.c | 10 ++--- + .../workarounds/dedicated_process/protocol.c | 42 +++++++++---------- + .../workarounds/dedicated_process/protocol.h | 4 +- + .../workarounds/dedicated_process/worker.c | 4 +- + 4 files changed, 30 insertions(+), 30 deletions(-) + +diff --git a/subprojects/libinsane/src/workarounds/dedicated_process/master.c b/subprojects/libinsane/src/workarounds/dedicated_process/master.c +index a48098a..be7f3f5 100644 +--- a/subprojects/libinsane/src/workarounds/dedicated_process/master.c ++++ b/subprojects/libinsane/src/workarounds/dedicated_process/master.c +@@ -183,7 +183,7 @@ static void *log_thread(void *_pipes) + ); + lis_log_debug( + "Stderr pipe: Read: %d - Write: %d", +- pipes->sorted.stderr[0], pipes->sorted.stderr[1] ++ pipes->sorted.std_err[0], pipes->sorted.std_err[1] + ); + + lis_log_info("Log thread started"); +@@ -1158,8 +1158,8 @@ enum lis_error lis_api_workaround_dedicated_process( + private->pipes.sorted.msgs_w2m[0] = -1; + close(private->pipes.sorted.logs[0]); + private->pipes.sorted.logs[0] = -1; +- close(private->pipes.sorted.stderr[0]); +- private->pipes.sorted.stderr[0] = -1; ++ close(private->pipes.sorted.std_err[0]); ++ private->pipes.sorted.std_err[0] = -1; + + lis_worker_main(to_wrap, &private->pipes); + abort(); // lis_worker_main() must never return +@@ -1172,8 +1172,8 @@ enum lis_error lis_api_workaround_dedicated_process( + private->pipes.sorted.msgs_w2m[1] = -1; + close(private->pipes.sorted.logs[1]); + private->pipes.sorted.logs[1] = -1; +- close(private->pipes.sorted.stderr[1]); +- private->pipes.sorted.stderr[1] = -1; ++ close(private->pipes.sorted.std_err[1]); ++ private->pipes.sorted.std_err[1] = -1; + + lis_log_info("Child process PID: %u", (int)private->worker); + +diff --git a/subprojects/libinsane/src/workarounds/dedicated_process/protocol.c b/subprojects/libinsane/src/workarounds/dedicated_process/protocol.c +index 58c3b2d..813eaaa 100644 +--- a/subprojects/libinsane/src/workarounds/dedicated_process/protocol.c ++++ b/subprojects/libinsane/src/workarounds/dedicated_process/protocol.c +@@ -214,38 +214,38 @@ static enum lis_error read_stderr(struct lis_pipes *pipes, enum lis_log_level *l + { + *lvl = LIS_LOG_LVL_INFO; + +- if (pipes->sorted.stderr[0] < 0) { ++ if (pipes->sorted.std_err[0] < 0) { + // pipe has been closed on purpose + return LIS_ERR_IO_ERROR; + } + +- if (pipes->stderr.total <= 0) { +- pipes->stderr.current = 0; +- memset(pipes->stderr.buf, 0, sizeof(pipes->stderr.buf)); +- pipes->stderr.total = read(pipes->sorted.stderr[0], pipes->stderr.buf, sizeof(pipes->stderr.buf) - 1); +- if (pipes->stderr.total < 0) { ++ if (pipes->std_err.total <= 0) { ++ pipes->std_err.current = 0; ++ memset(pipes->std_err.buf, 0, sizeof(pipes->std_err.buf)); ++ pipes->std_err.total = read(pipes->sorted.std_err[0], pipes->std_err.buf, sizeof(pipes->std_err.buf) - 1); ++ if (pipes->std_err.total < 0) { + lis_log_error("read() failed: %d, %s", errno, strerror(errno)); + return LIS_ERR_IO_ERROR; + } +- if (pipes->stderr.total == 0) { ++ if (pipes->std_err.total == 0) { + *msg = NULL; + return LIS_OK; + } + } + +- *msg = pipes->stderr.buf + pipes->stderr.current; ++ *msg = pipes->std_err.buf + pipes->std_err.current; + +- for ( ; pipes->stderr.current < pipes->stderr.total ; pipes->stderr.current++) { +- if (pipes->stderr.buf[pipes->stderr.current] == '\n') { +- pipes->stderr.buf[pipes->stderr.current] = '\0'; +- pipes->stderr.current += 1; ++ for ( ; pipes->std_err.current < pipes->std_err.total ; pipes->std_err.current++) { ++ if (pipes->std_err.buf[pipes->std_err.current] == '\n') { ++ pipes->std_err.buf[pipes->std_err.current] = '\0'; ++ pipes->std_err.current += 1; + return LIS_OK; +- } else if (pipes->stderr.buf[pipes->stderr.current] == '\0') { ++ } else if (pipes->std_err.buf[pipes->std_err.current] == '\0') { + break; + } + } +- pipes->stderr.current = 0; +- pipes->stderr.total = 0; ++ pipes->std_err.current = 0; ++ pipes->std_err.total = 0; + + if ((*msg)[0] == '\0') { + *msg = NULL; +@@ -265,7 +265,7 @@ enum lis_error lis_protocol_log_read(struct lis_pipes *pipes, enum lis_log_level + .revents = 0, + }, + { +- .fd = pipes->sorted.stderr[0], ++ .fd = pipes->sorted.std_err[0], + .events = POLLIN, + .revents = 0, + }, +@@ -275,7 +275,7 @@ enum lis_error lis_protocol_log_read(struct lis_pipes *pipes, enum lis_log_level + + *msg = NULL; + +- if (pipes->stderr.total > 0) { ++ if (pipes->std_err.total > 0) { + return read_stderr(pipes, lvl, msg); + } + +@@ -320,11 +320,11 @@ enum lis_error lis_protocol_log_read(struct lis_pipes *pipes, enum lis_log_level + close(pipes->sorted.logs[0]); + pipes->sorted.logs[0] = -1; + } +- if (fds[i].fd == pipes->sorted.stderr[0]) { +- close(pipes->sorted.stderr[0]); +- pipes->sorted.stderr[0] = -1; ++ if (fds[i].fd == pipes->sorted.std_err[0]) { ++ close(pipes->sorted.std_err[0]); ++ pipes->sorted.std_err[0] = -1; + } +- if (pipes->sorted.logs[0] < 0 && pipes->sorted.stderr[0] < 0) { ++ if (pipes->sorted.logs[0] < 0 && pipes->sorted.std_err[0] < 0) { + return LIS_ERR_IO_ERROR; + } + return LIS_OK; +diff --git a/subprojects/libinsane/src/workarounds/dedicated_process/protocol.h b/subprojects/libinsane/src/workarounds/dedicated_process/protocol.h +index 82b8d3d..40bc47a 100644 +--- a/subprojects/libinsane/src/workarounds/dedicated_process/protocol.h ++++ b/subprojects/libinsane/src/workarounds/dedicated_process/protocol.h +@@ -61,7 +61,7 @@ struct lis_pipes + int msgs_m2w[2]; /* messages ; query (master -> worker) */ + int msgs_w2m[2]; /* messages ; reply (worker -> master) */ + int logs[2]; /* worker to master only ; prefixed by log level + msg len */ +- int stderr[2]; /* worker to master only */ ++ int std_err[2]; /* worker to master only */ + } sorted; + int all[4][2]; + }; +@@ -72,7 +72,7 @@ struct lis_pipes + char buf[1024]; // to avoid a malloc() on each stderr line + ssize_t current; + ssize_t total; +- } stderr; ++ } std_err; + }; + + +diff --git a/subprojects/libinsane/src/workarounds/dedicated_process/worker.c b/subprojects/libinsane/src/workarounds/dedicated_process/worker.c +index 826ae8a..b85df09 100644 +--- a/subprojects/libinsane/src/workarounds/dedicated_process/worker.c ++++ b/subprojects/libinsane/src/workarounds/dedicated_process/worker.c +@@ -767,8 +767,8 @@ void lis_worker_main(struct lis_api *to_wrap, struct lis_pipes *pipes) + #endif + + #ifndef DISABLE_REDIRECT_STDERR +- if (dup2(pipes->sorted.stderr[1], STDOUT_FILENO) < 0 +- || dup2(pipes->sorted.stderr[1], STDERR_FILENO) < 0) { ++ if (dup2(pipes->sorted.std_err[1], STDOUT_FILENO) < 0 ++ || dup2(pipes->sorted.std_err[1], STDERR_FILENO) < 0) { + lis_log_warning( + "Failed to redirect stderr and stdout: %d, %s", errno, strerror(errno) + ); +-- +GitLab + diff --git a/media-libs/libinsane/libinsane-1.0.9.ebuild b/media-libs/libinsane/libinsane-1.0.9.ebuild index 56d97e6d53c0..5210a84e8534 100644 --- a/media-libs/libinsane/libinsane-1.0.9.ebuild +++ b/media-libs/libinsane/libinsane-1.0.9.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 @@ -33,7 +33,9 @@ BDEPEND="dev-util/glib-utils # https://wiki.gentoo.org/wiki/Debugging RESTRICT="test" -PATCHES=( "${FILESDIR}"/${PN}-1.0.1-meson_options.patch ) +PATCHES=( "${FILESDIR}"/${PN}-1.0.1-meson_options.patch + "${FILESDIR}"/${P}-musl.patch + ) src_prepare() { vala_src_prepare -- cgit v1.2.3