aboutsummaryrefslogtreecommitdiff
path: root/sbrun
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-09-24 04:55:53 -0400
committerB. Watson <urchlay@slackware.uk>2026-09-24 04:55:53 -0400
commitc87f5b78866da17f0794d1abd78fe6810cfbbe36 (patch)
treed6abf63073c56ae10f64a620b4e6eb524ac772ad /sbrun
parent1ed5bcbd7fc0d93001a86e24bf578db1ea5ac66d (diff)
downloadsbostuff-c87f5b78866da17f0794d1abd78fe6810cfbbe36.tar.gz
sbrun: fix -s option (restore strace.out).
Diffstat (limited to 'sbrun')
-rwxr-xr-xsbrun29
1 files changed, 18 insertions, 11 deletions
diff --git a/sbrun b/sbrun
index 5ac327b..3b5b8c7 100755
--- a/sbrun
+++ b/sbrun
@@ -166,7 +166,7 @@ unless the -l option is used. With -l, the exit status is that
of sbopkglint.
Note: the current directory needs to be writable, since the log and
-(with -s/-S) strace output are written there.
+(with -s) strace output are written there.
======================================================================
The rest of this help message is a long-winded discussion that doesn't
@@ -472,11 +472,6 @@ fi
# harm done (it was already killed by SIGINT), just irritating.
trap signal_handler INT TERM
-
-if [ "$STRACE" != "" ]; then
- PRECMD="strace $STRACE"
-fi
-
# Used to do this, but it doesn't allow for cases where the directory
# has been renamed (foo.SlackBuild in a dir called foo.testing or foo.old).
#SCRIPT="./$( pwd | sed 's,.*/,,' ).SlackBuild"
@@ -526,6 +521,10 @@ FAKEROOT=$PRIVDIR/fake_root
mkdir -p $UPPERDIR $WORKDIR $FAKEROOT
echo "Private dir for overlay FS: $PRIVDIR" | tee -a $BUILDLOG
+if [ "$STRACE" != "" ]; then
+ PRECMD="strace -o $PRIVDIR/strace.out $STRACE"
+fi
+
# Force-load the module
modprobe overlay &> /dev/null
mount -t overlay overlay \
@@ -553,6 +552,10 @@ echo "$SCRIPT exit status: $RET" | tee -a $BUILDLOG
cleanup_nonet
+# This file contains a list of files that were written during
+# the build (and are left over in the upperdir).
+TURDS=$TMP/sbrun.turds.$$
+
### 20260923 bkw:
# Anything in $UPPERDIR after umount was written there by the
# SlackBuild. Not everything there is worth bitching about.
@@ -583,17 +586,21 @@ cleanup_nonet
\! -path dev/shm \
\! -path $TMP \
\! -path $OUTPUT \
- -print0 | xargs -r0 ls -bld > $TMP/sbrun.turds.$$
+ -print0 | xargs -r0 ls -bld > $TURDS
) 2>/dev/null
+if [ -f $PRIVDIR/strace.out ]; then
+ mv $PRIVDIR/strace.out .
+ chown --reference=$SCRIPT strace.out
+fi
+
cleanup_privdir
-if [ -s $TMP/sbrun.turds.$$ ]; then
+if [ -s $TURDS ]; then
warn "WARNING: files altered outside the sandbox:"
- cat $TMP/sbrun.turds.$$ 1>&2
- cat $TMP/sbrun.turds.$$ >> $BUILDLOG
+ tee -a $BUILDLOG < $TURDS
fi
-rm -f $TMP/sbrun.turds.$$
+rm -f $TURDS
# If linting + installation were both requested, don't install
# the package if it fails to lint.