community/growlight: use upstream patch to fix implicit basename

This commit is contained in:
Celeste 2024-08-30 07:28:33 +00:00
parent f04eac12a5
commit 20f0cb9ef6
2 changed files with 46 additions and 10 deletions

View File

@ -2,7 +2,7 @@
# Maintainer: Nick Black <dankamongmen@gmail.com>
pkgname=growlight
pkgver=1.2.38
pkgrel=2
pkgrel=3
pkgdesc="Block device manager"
url="https://nick-black.com/dankwiki/index.php/Growlight"
arch="all"
@ -40,5 +40,5 @@ package() {
sha512sums="
93e47dee8fc95fd59f196e7f4330d1b97acc5699f830aa604fbee9f08777a23dfa26a98dc3711c3c1bb7e4ccb636e06b6c04b45d9083db016bd8f2bee10e5fd4 growlight-1.2.38.tar.gz
c2481b93210e1d90b3653b6446f8d2b7fac1511d77bbe6e44fb89a78e2eb03d67851434ba3b22765dc4dc5b95b813700a06a6b9851c2d14e8e16d91e88db0a96 gcc14.patch
0a17f7cd4030f48d9cfa2e62c9486df72d67f755de45b955fbed243dd2d01be9aa6dec464944b159f19d18a973e859ac9a01f78ca89036f11ad02cb22987fc7e gcc14.patch
"

View File

@ -1,12 +1,48 @@
Patch-Source: https://github.com/dankamongmen/growlight/commit/aa4b53cf6ecdd52dfa425a5a6165f9bc66efdd0f
--
From aa4b53cf6ecdd52dfa425a5a6165f9bc66efdd0f Mon Sep 17 00:00:00 2001
From: nick black <dankamongmen@gmail.com>
Date: Fri, 30 Aug 2024 03:23:31 -0400
Subject: [PATCH] drop all uses of basename(2)
the POSIX variant of basename(2) can freely write
to the string it is passed. in all call sites, we
were passing a const char* ultimately sourced
from argv[0], to which we must not write. the GNU
variant doesn't have this behavior, but we can't
assume that variant on e.g. musl.
so just drop the basename() calls entirely. they
didn't add much, and arguably lost information.
thanks to znley and celeste of alpine for bringing
this to my attention in
https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/71142
alpine linux: always kicking ass
---
src/growlight.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/growlight.c b/src/growlight.c
index 283e6a2..44648d8 100644
index 283e6a2..9ebc901 100644
--- a/src/growlight.c
+++ b/src/growlight.c
@@ -28,6 +28,7 @@
#include <sys/timerfd.h>
#include <sys/inotify.h>
#include <libdevmapper.h>
+#include <libgen.h>
#include <sys/capability.h>
@@ -1501,14 +1501,14 @@ watch_dir(int fd, const char *dfp, eventfxn fxn, int *wd, int timeout){
#include "fs.h"
static void
version(const char *name){
- diag("%s version %s\n", basename(name), VERSION);
+ diag("%s version %s\n", name, VERSION);
}
static void
usage(const char *name, int disphelp){
diag("usage: %s [ -h|--help ] [ -v|--verbose ] [ -V|--version ]\n"
"\t[ -t|--target=path ] [ --notroot ] [ -i|--import ]%s\n",
- basename(name), disphelp ? " [ --disphelp ]" : "");
+ name, disphelp ? " [ --disphelp ]" : "");
}
static int