sm-commit AT lists.ibiblio.org
Subject: Source Mage code commit list
List archive
[[SM-Commit] ] GIT changes to master grimoire by Thomas Orgis (d57ca80264a21b1a2d37e61e8122f1ec4ae1869c)
- From: Thomas Orgis <scm AT sourcemage.org>
- To: sm-commit AT lists.ibiblio.org, sm-commit AT lists.sourcemage.org
- Subject: [[SM-Commit] ] GIT changes to master grimoire by Thomas Orgis (d57ca80264a21b1a2d37e61e8122f1ec4ae1869c)
- Date: Fri, 28 Feb 2025 10:36:06 +0000
GIT changes to master grimoire by Thomas Orgis <sobukus AT sourcemage.org>:
devel/llvm/BUILD | 4
devel/llvm/DETAILS | 1
devel/llvm/HISTORY | 5
smgl/simpleinit-msb/DETAILS | 2
smgl/simpleinit-msb/HISTORY | 5
smgl/simpleinit-msb/patches/0024-utmp-time_t-and-linelimit.patch | 154
++++++++++
6 files changed, 168 insertions(+), 3 deletions(-)
New commits:
commit d57ca80264a21b1a2d37e61e8122f1ec4ae1869c
Author: Thomas Orgis <sobukus AT sourcemage.org>
Commit: Thomas Orgis <sobukus AT sourcemage.org>
llvm: fix && chain in BUILD, fix build for non-existing llvm-spirv
The call to command -v llvm-spirv causes one if block to return false
if that command is not there. The whole call is there because of some
build system issue that I do not know to apply to us or not. Please
fix that more properly if you know;-)
The missing && caused the build to continue, but the configuration was
off. In my case it meant always building with gcc, not clang.
commit 130bb16163cb5b90fca123b4bd8cb2b0454fa6ff
Author: Thomas Orgis <sobukus AT sourcemage.org>
Commit: Thomas Orgis <sobukus AT sourcemage.org>
simpleinit-msb: fix for 64 bit time_t and safer strncat of utmp line
With GCC 14, the bad usage of time(&ut.ut_time) doesn't fly anymore with
64 bit time_t. This patch fixes that. Still, overflow of the 32 bit data
fields is not handled nicely (errors ignored in simpleinit-msb code).
Also, a strncat() from ut_line did not consider that this could be a
non-null-terminated string. GCC also warned about that.
We still got a use of tmpnam() that we maybe should replace. It is
for naming a fifo. So maybe doing that in a safe temporary directory
would be sensible.
diff --git a/devel/llvm/BUILD b/devel/llvm/BUILD
index b892aef..35a7b61 100755
--- a/devel/llvm/BUILD
+++ b/devel/llvm/BUILD
@@ -59,7 +59,7 @@ fi &&
# workaround for https://github.com/llvm/llvm-project/issues/109537
if [[ "$LLVM_WITH_LIBCLC" == y ]] ;then
- OPTS="$OPTS -DLLVM_SPIRV=$(command -v llvm-spirv)"
+ OPTS="$OPTS -DLLVM_SPIRV=$(command -v llvm-spirv || true)"
fi &&
if [[ "$LLVM_WITH_LLD" == y ]] ;then
@@ -135,7 +135,7 @@ if [ -n "$LLVM_TOOLCHAIN_COMPILER" ] ;then
OPTS="$OPTS -DCMAKE_CXX_COMPILER=g++"
;;
esac
-fi
+fi &&
if [ -n "$LLVM_TOOLCHAIN_LINKER" ] ;then
local linker="$LLVM_TOOLCHAIN_LINKER" &&
diff --git a/devel/llvm/DETAILS b/devel/llvm/DETAILS
index 737c0d5..6037d52 100755
--- a/devel/llvm/DETAILS
+++ b/devel/llvm/DETAILS
@@ -1,6 +1,7 @@
# Watch: https://github.com/llvm/llvm-project/releases
/llvmorg-([0-9.]+)[.]tar
SPELL=llvm
VERSION=19.1.7
+ PATCHLEVEL=1
SPELL_BUILD_SYSTEM=cmake
GITHUB_URI="https://github.com/llvm/llvm-project/releases/download/llvmorg-$VERSION"
SOURCE_DIRECTORY="${BUILD_DIRECTORY}/llvm-project"
diff --git a/devel/llvm/HISTORY b/devel/llvm/HISTORY
index 4907e4f..4573dd0 100644
--- a/devel/llvm/HISTORY
+++ b/devel/llvm/HISTORY
@@ -1,3 +1,8 @@
+2025-02-28 Thomas Orgis <sobukus AT sourcemage.org>
+ * BUILD: fix the && chain and make a non-existing llvm-spirv non-fatal
+ * DETAILS: ++PATCHLEVEL, as this changes the build (for example,
really
+ using clang for building)
+
2025-01-17 Justin Boffemmyer <flux AT sourcemage.org>
* BUILD: fix experimental targets, make clang-tools-extra build
explicit, support SPIR-V runner for MLIR, make utils install
diff --git a/smgl/simpleinit-msb/DETAILS b/smgl/simpleinit-msb/DETAILS
index e0e55f9..7dc7f63 100755
--- a/smgl/simpleinit-msb/DETAILS
+++ b/smgl/simpleinit-msb/DETAILS
@@ -1,6 +1,6 @@
SPELL=simpleinit-msb
VERSION=1.3
- PATCHLEVEL=2
+ PATCHLEVEL=3
SOURCE=$SPELL-$VERSION.tar.bz2
SOURCE_DIRECTORY="$BUILD_DIRECTORY/$SPELL-$VERSION"
SOURCE_URL[0]=http://ftp.sourcemage.us/mirror/$SOURCE
diff --git a/smgl/simpleinit-msb/HISTORY b/smgl/simpleinit-msb/HISTORY
index 81cb8e6..1228c79 100644
--- a/smgl/simpleinit-msb/HISTORY
+++ b/smgl/simpleinit-msb/HISTORY
@@ -1,3 +1,8 @@
+2025-02-28 Thomas Orgis <sobukus AT sourcemage.org>
+ * patches/0024-utmp-time_t-and-linelimit.patch: fix utmp usage with
+ 64 bit time_t and safer use of possibly non-null-terminated ut_line.
+ * DETAILS: ++PATCHLEVEL
+
2024-06-09 Ismael Luceno <ismael AT sourcemage.org>
* PRE_BUILD: added apply_patch_dir and removed manual application
* simpleinit.patch: normalised and split into
diff --git a/smgl/simpleinit-msb/patches/0024-utmp-time_t-and-linelimit.patch
b/smgl/simpleinit-msb/patches/0024-utmp-time_t-and-linelimit.patch
new file mode 100644
index 0000000..9cc3a2c
--- /dev/null
+++ b/smgl/simpleinit-msb/patches/0024-utmp-time_t-and-linelimit.patch
@@ -0,0 +1,154 @@
+diff -ruN simpleinit-msb-1.3/login-utils/shutdown.c
simpleinit-msb-1.3.utmplimit/login-utils/shutdown.c
+--- simpleinit-msb-1.3/login-utils/shutdown.c 2025-02-28 11:15:00.229663783
+0100
++++ simpleinit-msb-1.3.utmplimit/login-utils/shutdown.c 2025-02-28
11:08:04.528663832 +0100
+@@ -116,6 +116,7 @@
+ #include "pathnames.h"
+ #include "xstrncpy.h"
+ #include "nls.h"
++#include "../utmp_time.h"
+
+ static void usage(void), int_handler(int), write_user(struct utmp *);
+ static void wall(void), write_wtmp(void), unmount_disks(void);
+@@ -584,12 +585,16 @@
+ #define TERM_PREFIX "/dev/"
+ char term[40] = TERM_PREFIX;
+ char msg[266];
++ /* keep space for terminating 0, be prepared for non-terminated
ut_line */
++ size_t termlimit = sizeof(term) - sizeof(TERM_PREFIX) - 1;
++ if(termlimit > UT_LINESIZE)
++ termlimit = UT_LINESIZE;
+
+ minutes = timeout / 60;
+ hours = minutes / 60;
+ minutes %= 60;
+
+- strncat(term, ut->ut_line, sizeof(term) - sizeof(TERM_PREFIX));
++ strncat(term, ut->ut_line, termlimit);
+
+ /* try not to get stuck on a mangled ut_line entry... */
+ if((fd = open(term, O_WRONLY|O_NONBLOCK)) < 0)
+@@ -652,7 +657,7 @@
+ strcpy(ut.ut_line, "~");
+ strcpy(ut.ut_name, "shutdown");
+
+- time(&ut.ut_time);
++ utmp_time(&ut); /* communicate error? */
+ ut.ut_type = BOOT_TIME;
+
+ if((fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0644)) >= 0) {
+diff -ruN simpleinit-msb-1.3/login-utils/simpleinit.c
simpleinit-msb-1.3.utmplimit/login-utils/simpleinit.c
+--- simpleinit-msb-1.3/login-utils/simpleinit.c 2025-02-28
11:15:00.229663783 +0100
++++ simpleinit-msb-1.3.utmplimit/login-utils/simpleinit.c 2025-02-28
11:16:27.983663772 +0100
+@@ -229,6 +229,7 @@
+ #include "xstrncpy.h"
+ #include "nls.h"
+ #include "simpleinit.h"
++#include "../utmp_time.h"
+
+ #define MAXPARAMS 128 /* max num of args you can use with ctrlaltdel prog
*/
+ #define CMDSIZ 150 /* max size of a line in inittab */
+@@ -522,7 +523,7 @@
+ setutent();
+ while((ut = getutent())) {
+ if(ut->ut_pid == pid) {
+- time(&ut->ut_time);
++ utmp_time(ut); /* communicate error? */
+ memset(&ut->ut_user, 0, UT_NAMESIZE);
+ memset(&ut->ut_host, 0, sizeof(ut->ut_host));
+ ut->ut_type = DEAD_PROCESS;
+@@ -1064,7 +1065,7 @@
+ memset((char *)&ut, 0, sizeof(ut));
+ strcpy(ut.ut_line, "~");
+ memset(ut.ut_name, 0, sizeof(ut.ut_name));
+- time(&ut.ut_time);
++ utmp_time(&ut); /* communicate error? */
+ ut.ut_type = BOOT_TIME;
+ #ifdef HAVE_updwtmp
+ updwtmp(_path_wtmp,&ut);
+@@ -1118,7 +1119,7 @@
+ ut.ut_id[1]=(id/100)%10+'0';
+ ut.ut_id[0]=(id/1000)%10+'0';
+
+- time(&ut.ut_time);
++ utmp_time(&ut); /* communicate error? */
+ pututline(&ut);
+ endutent();
+ }
+diff -ruN simpleinit-msb-1.3/sysvtools/utmp.c
simpleinit-msb-1.3.utmplimit/sysvtools/utmp.c
+--- simpleinit-msb-1.3/sysvtools/utmp.c 2007-11-08 21:13:15.000000000
+0100
++++ simpleinit-msb-1.3.utmplimit/sysvtools/utmp.c 2025-02-28
10:46:22.246663988 +0100
+@@ -21,7 +21,7 @@
+ #include "init.h"
+ #include "initreq.h"
+ #include "paths.h"
+-
++#include "../utmp_time.h"
+
+ #if defined(__GLIBC__)
+ # if (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0) && defined(__powerpc__)
+@@ -78,7 +78,7 @@
+ #if defined(__GLIBC__)
+ gettimeofday(&utmp.ut_tv, NULL);
+ #else
+- time(&utmp.ut_time);
++ utmp_time(&utmp); /* communicate error? */
+ #endif
+ utmp.ut_pid = pid;
+ utmp.ut_type = type;
+@@ -143,11 +143,7 @@
+ utmp.ut_type = type;
+ utmp.ut_pid = pid;
+ strncpy(utmp.ut_id, id, sizeof(utmp.ut_id));
+-#if defined(__GLIBC__)
+- gettimeofday(&utmp.ut_tv, NULL);
+-#else
+- time(&utmp.ut_time);
+-#endif
++ utmp_time(&utmp); /* communicate error? */
+ strncpy(utmp.ut_user, user, UT_NAMESIZE);
+ if (line) strncpy(utmp.ut_line, line, UT_LINESIZE);
+
+diff -ruN simpleinit-msb-1.3/sysvtools/wall.c
simpleinit-msb-1.3.utmplimit/sysvtools/wall.c
+--- simpleinit-msb-1.3/sysvtools/wall.c 2007-11-08 21:13:16.000000000
+0100
++++ simpleinit-msb-1.3.utmplimit/sysvtools/wall.c 2025-02-28
11:09:08.442663825 +0100
+@@ -101,7 +101,7 @@
+ }
+
+ openlog("wall", LOG_PID, LOG_USER);
+- syslog(LOG_INFO, "wall: user %s broadcasted %d lines (%d chars)",
++ syslog(LOG_INFO, "wall: user %s broadcasted %d lines (%zu chars)",
+ whoami, i, strlen(buf));
+ closelog();
+
+diff -ruN simpleinit-msb-1.3/utmp_time.h
simpleinit-msb-1.3.utmplimit/utmp_time.h
+--- simpleinit-msb-1.3/utmp_time.h 1970-01-01 01:00:00.000000000 +0100
++++ simpleinit-msb-1.3.utmplimit/utmp_time.h 2025-02-28 11:13:02.972663797
+0100
+@@ -0,0 +1,28 @@
++#ifndef UTMP_TIME_H
++#define UTMP_TIME_H
++
++#include <utmp.h>
++#include <sys/time.h>
++#include <errno.h>
++
++static int utmp_time(struct utmp *ut)
++{
++ struct timeval tv;
++ int ret = 0;
++ ret = gettimeofday(&tv, NULL);
++ if(!ret)
++ {
++ /* Better handling of overflow here? This could be 64 bit
time_t to
++ 32 bit (unsigned) integer. */
++ ut->ut_tv.tv_sec = tv.tv_sec;
++ ut->ut_tv.tv_usec = tv.tv_usec;
++ if(ut->ut_tv.tv_sec != tv.tv_sec || ut->ut_tv.tv_usec !=
tv.tv_usec)
++ {
++ ret = -1;
++ errno = EOVERFLOW;
++ }
++ }
++ return ret;
++}
++
++#endif
- [[SM-Commit] ] GIT changes to master grimoire by Thomas Orgis (d57ca80264a21b1a2d37e61e8122f1ec4ae1869c), Thomas Orgis, 02/28/2025
Archive powered by MHonArc 2.6.24.