summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2026-11-22 21:15:17 +0100
committerSébastien Dailly <sebastien@dailly.me>2026-11-22 21:15:17 +0100
commitbbaa6afe687e28cd996a5e6a051561062513d565 (patch)
tree087a26752ad238e910e57985b2c30dc6c2af71e3
parentb3e549a2dbf1b74c3ea7b1e4321c20953fc2ce11 (diff)
Added birthday package from debianmain
-rw-r--r--package/birthday/birthday.hash1
-rw-r--r--package/birthday/birthday.mk16
-rw-r--r--patches/birthday/0001-deffname-fallback-to-HOME.patch34
3 files changed, 46 insertions, 5 deletions
diff --git a/package/birthday/birthday.hash b/package/birthday/birthday.hash
new file mode 100644
index 0000000..3668d73
--- /dev/null
+++ b/package/birthday/birthday.hash
@@ -0,0 +1 @@
+sha256 264ec3e6c9a63916e4bc5a32985622d83b3075de7c237a1fa8e26a539acbd2f6 birthday-debian-1.6.2-10.tar.gz
diff --git a/package/birthday/birthday.mk b/package/birthday/birthday.mk
index 09c379d..c3d086e 100644
--- a/package/birthday/birthday.mk
+++ b/package/birthday/birthday.mk
@@ -1,17 +1,23 @@
-BIRTHDAY_VERSION=1.6.2-7
+BIRTHDAY_VERSION = 1.6.2-10
BIRTHDAY_SITE = https://salsa.debian.org/salvage-team/birthday/-/archive/debian/${BIRTHDAY_VERSION}
BIRTHDAY_SOURCE = birthday-debian-${BIRTHDAY_VERSION}.tar.gz
BIRTHDAY_LICENCE =
BIRTHDAY_LICENCE_FILES =
+# NOTE: do not pass $(TARGET_CONFIGURE_OPTS) here: it sets CFLAGS on the make
+# command line, which overrides the package Makefile's own
+# "CFLAGS=-O2 -D$(OS) ..." and drops -DUNIX. Without -DUNIX, deffname() in
+# bdengine.c has no return statement -> undefined behaviour / segfault.
define BIRTHDAY_BUILD_CMDS
- (cd $(@D); \
- make )
+ $(MAKE) -C $(@D) \
+ CC="$(TARGET_CC)" \
+ CFLAGS="$(TARGET_CFLAGS) -DUNIX" \
+ LDFLAGS="$(TARGET_LDFLAGS)"
endef
define BIRTHDAY_INSTALL_TARGET_CMDS
- (cd $(@D); \
- make install DESTDIR=$(TARGET_DIR))
+ $(INSTALL) -d $(TARGET_DIR)/usr/bin
+ $(TARGET_STRIP) $(@D)/birthday -o $(TARGET_DIR)/usr/bin/birthday
endef
$(eval $(generic-package))
diff --git a/patches/birthday/0001-deffname-fallback-to-HOME.patch b/patches/birthday/0001-deffname-fallback-to-HOME.patch
new file mode 100644
index 0000000..02381d9
--- /dev/null
+++ b/patches/birthday/0001-deffname-fallback-to-HOME.patch
@@ -0,0 +1,34 @@
+deffname: do not segfault when getpwuid() has no entry for the current uid
+
+On a minimal target the user running birthday may have no entry in
+/etc/passwd, so getpwuid(getuid()) returns NULL and the old code
+dereferenced it (strcpy(buf, NULL->pw_dir)) => segmentation fault.
+
+Fall back to $HOME when there is no passwd entry, and exit with a clear
+error message when neither is available.
+
+--- a/bdengine.c
++++ b/bdengine.c
+@@ -309,9 +309,20 @@
+ {
+ #if defined(UNIX)
+ char buf[256];
++ struct passwd *pw;
++ const char *home;
+
+- strcpy(buf,getpwuid(getuid())->pw_dir);
+- strcat(buf, "/" DEFAULT_FILE);
++ /* getpwuid() may fail (e.g. no passwd entry for the current uid on a
++ minimal system): dereferencing the NULL result segfaults. Fall back
++ to $HOME in that case. */
++ pw = getpwuid(getuid());
++ if (pw != NULL && pw->pw_dir != NULL && pw->pw_dir[0] != '\0')
++ home = pw->pw_dir;
++ else if ((home = getenv("HOME")) == NULL || home[0] == '\0')
++ fatal("birthday: no passwd entry for uid %d and HOME is not set\n",
++ (int)getuid());
++
++ snprintf(buf, sizeof(buf), "%s/%s", home, DEFAULT_FILE);
+
+ return strdup(buf);
+ #elif defined(DOS)