Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
INSTALL="zypper -n refresh && zypper -n install gcc make autoconf automake"
;;
emerge)
INSTALL="emerge --sync 2>/dev/null; emerge -q sys-devel/gcc sys-devel/autoconf sys-devel/automake"
INSTALL="emerge --sync 2>/dev/null; emerge -q1 sys-apps/portage 2>/dev/null; emerge -q sys-devel/gcc sys-devel/autoconf sys-devel/automake"
;;
esac

Expand Down
12 changes: 12 additions & 0 deletions build-test/check-errors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
cd /tmp/sudosh2
docker run --rm -v "$PWD:/src:ro" ubuntu:24.04 bash <<'DOCKER'
apt-get update -qq > /dev/null 2>&1
apt-get install -y -qq gcc make autoconf automake libtool > /dev/null 2>&1
cp -r /src /tmp/b
cd /tmp/b
autoreconf -fi 2>&1 | tail -1
./configure --prefix=/usr --sysconfdir=/etc > /dev/null 2>&1
make CFLAGS='-Wall -Werror -pedantic' 2>&1 | grep -E 'error:|warning:|Error' | head -20
echo "---EXIT:$?---"
DOCKER
14 changes: 14 additions & 0 deletions build-test/check-strict.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
cd /tmp/sudosh2
echo "=== Strict gcc-15 simulation ==="
docker run --rm -v "$PWD:/src:ro" ubuntu:24.04 bash -c '
apt-get update -qq > /dev/null 2>&1
apt-get install -y -qq gcc make autoconf automake libtool > /dev/null 2>&1
cp -r /src /tmp/b
cd /tmp/b
autoreconf -fi 2>&1 | tail -1
./configure --prefix=/usr --sysconfdir=/etc > /dev/null 2>&1
echo "--- MAKE OUTPUT ---"
make CFLAGS="-Werror=implicit-function-declaration -Werror=int-conversion -std=c17 -O2" 2>&1
echo "--- EXIT: $? ---"
'
34 changes: 34 additions & 0 deletions build-test/run-quick.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
set -euo pipefail
cd /tmp/sudosh2

test_distro() {
local image="$1"
local pkg_cmd="$2"
local name="$3"
echo "=== Testing: $name ==="
docker run --rm -v "$PWD:/src:ro" "$image" bash -c "
set -e
$pkg_cmd > /dev/null 2>&1
cp -r /src /tmp/b && cd /tmp/b
autoreconf -fi 2>&1 | tail -1
./configure --prefix=/usr --sysconfdir=/etc > /dev/null 2>&1
make CFLAGS='-Wall -Werror -pedantic' 2>&1 | tail -3
echo BUILD_SUCCESS
" 2>&1 | tail -5
echo ""
}

# Test strict mode (Gentoo sim)
echo "=== Testing: Gentoo sim (strict flags) ==="
docker run --rm -v "$PWD:/src:ro" ubuntu:24.04 bash -c "
set -e
apt-get update -qq > /dev/null 2>&1
apt-get install -y -qq gcc make autoconf automake libtool > /dev/null 2>&1
cp -r /src /tmp/b && cd /tmp/b
autoreconf -fi 2>&1 | tail -1
./configure --prefix=/usr --sysconfdir=/etc > /dev/null 2>&1
make CFLAGS='-Wall -Werror -pedantic -Werror=implicit-function-declaration -Werror=int-conversion -std=c17 -O2' 2>&1 | tail -5
echo BUILD_SUCCESS
" 2>&1 | tail -8
echo ""
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ AC_CHECK_HEADERS(sgtty.h pty.h signal.h time.h sys/time.h fcntl.h stropts.h)
AC_CHECK_HEADERS(util.h termios.h sys/termios.h sys/types.h libutil.h)
AC_CHECK_HEADERS(features.h sys/ioctl.h pwd.h syslog.h usersec.h)
AC_CHECK_HEADERS(limits.h sys/stat.h sys/param.h dirent.h ctype.h strings.h)
AC_CHECK_HEADERS([linux/fs.h], [], [], [#include <sys/ioctl.h>])

AC_CHECK_FUNCS(openpty, openpty=1, openpty=0)
AC_CHECK_FUNCS([getusershell gettimeofday])
Expand Down
14 changes: 14 additions & 0 deletions src/sudosh.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,21 @@ PURPOSE. See the Open Software License for details.
#include "struct.h"
#include "super.h"
#ifdef __linux__
#include <sys/ioctl.h>
#ifdef HAVE_LINUX_FS_H
#include <linux/fs.h>
#else
/* Fallback definitions for systems without <linux/fs.h> (e.g., musl libc) */
#ifndef FS_IOC_GETFLAGS
#define FS_IOC_GETFLAGS _IOR('f', 1, long)
#endif
#ifndef FS_IOC_SETFLAGS
#define FS_IOC_SETFLAGS _IOW('f', 2, long)
#endif
#ifndef FS_APPEND_FL
#define FS_APPEND_FL 0x00000020
#endif
#endif
#endif

#ifndef SIGCHLD
Expand Down
Loading