Bug#795269: TMPTIME not honored anymore

Josh Triplett josh at joshtriplett.org
Wed Aug 12 18:36:07 BST 2015


On Wed, 12 Aug 2015 15:00:22 +0200 Joey Schulze <joey at infodrom.org> wrote:
> Package: systemd
> Version: 215-17+deb8u1
> 
> /etc/default/rcS contains a line
> 
> # delete files in /tmp during boot older than x days.
> # '0' means always, -1 or 'infinite' disables the feature
> #TMPTIME=0
> TMPTIME=10
> 
> This setting is completely ignored by systemd during system boot.
> 
> I would consider this a bug and breaks functionality during an upgrade.

systemd's postinst does a one-time migration from TMPTIME in
/etc/default/rcS to /etc/tmpfiles.d/tmp.conf , if the former has tmp
wiping disabled.  That migration, however, doesn't handle the case of
TMPTIME set to a non-zero, non-infinite value.  It should be possible to
do so, by copying /usr/lib/tmpfiles.d/tmp.conf to
/etc/tmpfiles.d/tmp.conf by way of a sed that changes the '-' on the D
line to ${TMPTIME}d, assuming TMPTIME is numeric.  The following patch
to systemd.postinst *should* work (not tested).

--- /var/lib/dpkg/info/systemd.postinst	2015-08-01 05:20:45.000000000 -0700
+++ /tmp/systemd.postinst	2015-08-12 10:33:21.108381657 -0700
@@ -72,6 +72,15 @@
 # /etc/default/rcS where TMPTIME was set to infinite.
 EOF
                 ;;
+            0)
+                ;;
+            [0-9]*)
+                {
+                    echo "# Automatically generated to migrate TMPTIME=${TMPTIME} from /etc/default/rcS"
+                    echo
+                    sed -e "/^D /s/-\$/${TMPTIME%%[^0-9]*}d/" < /usr/lib/tmpfiles.d/tmp.conf
+                } > /etc/tmpfiles.d/tmp.conf
+                ;;
         esac
     fi
 fi




More information about the Pkg-systemd-maintainers mailing list