[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#620870: debian-policy: Please add /run as FHS exception



Hello everyone (and happy new year!),

I read through all of the discussion of this bug and reviewed the latest
patches, and I had the following concerns.

1. A lot of the discussion of /run and /run/lock was in a non-normative
   footnote, but it was really normative text.  It didn't fit well wedged
   into the item about miscellaneous top-level file systems and deserved
   its own point.

2. We should say explicitly that /run and /run/lock must follow all the
   other FHS requirements for /var/run and /var/lock, since there are
   various other ones, such as file naming conventions and file format
   requirements.

3. The rule that packages can't include files in /run (or /var/run) was
   buried off in the init.d script section.  While init.d scripts are a
   common user of such files and are a good way to create them, the
   requirement is general and should be read by anyone using those
   directories, not just people writing init.d scripts.

Here is an updated patch that tries to remedy those concerns.  The
requirement for /run and /run/lock is a separate point in the FHS
exception list, and a new section under 9.1 has been added to spell out
explicitly, for everyone, the requirements on packages that make use of
those directories.  The init.d language has been streamlined somewhat and
a reference to that new section added.

Note that this version of the patch explicitly says that packages "should"
use /run and /run/lock in preference to /var/run and /var/lock.  My
understanding is that this is where we want to go, but if this is
premature, that paragraph can easily be removed for now without changing
the substance of the rest of this change.

Comments, objections, seconds?

diff --git a/policy.sgml b/policy.sgml
index 79281e9..0bdc891 100644
--- a/policy.sgml
+++ b/policy.sgml
@@ -6246,6 +6246,25 @@ install -m644 debian/shlibs.<var>package</var> debian/<var>package</var>/DEBIAN/
                   symlinked there, is relaxed to a recommendation.
                 </p>
               </item>
+	      <item>
+		<p>
+		  The additional directory <file>/run</file> in the root
+		  file system is allowed.  <file>/run</file>
+		  replaces <file>/var/run</file>, and the
+		  subdirectory <file>/run/lock</file>
+		  replaces <file>/var/lock</file>, with
+		  the <file>/var</file> directories replaced by symlinks
+		  for backwards compatibility.  <file>/run</file>
+		  and <file>/run/lock</file> must follow all of the
+		  requirements in the FHS for <file>/var/run</file>
+		  and <file>/var/lock</file>, respectively, such as file
+		  naming conventions, file format requirements, or the
+		  requirement that files be cleared during the boot
+		  process.  Files and directories residing
+		  in <file>/run</file> should be stored on a temporary
+		  file system.
+		</p>
+	      </item>
               <item>
                 <p>
                   The following directories in the root filesystem are
@@ -6388,6 +6407,35 @@ rmdir /usr/local/share/emacs 2>/dev/null || true
 	    though the spool may still be physically located there.
 	  </p>
 	</sect1>
+
+	<sect1 id="fhs-run">
+	  <heading><file>/run</file> and <file>/run/lock</file></heading>
+
+	  <p>
+	    The directory <file>/run</file> is cleared at boot, normally
+	    by being a mount point for a temporary file system.  Packages
+	    therefore must not assume that any files or directories
+	    under <file>/run</file> other than <file>/run/lock</file>
+	    exist unless the package has arranged to create those files or
+	    directories since the last reboot.  Normally, this is done by
+	    the package via an init script.  See <ref id="writing-init">
+	    for more information.
+	  </p>
+
+	  <p>
+	    Packages must not include files or directories
+	    under <file>/run</file>, or under the
+	    older <file>/var/run</file> and <file>/var/lock<file> paths.
+	    The latter paths will normally be symlinks or other
+	    redirections to <file>/run</file> for backwards compatibility.
+	  </p>
+
+	  <p>
+	    Packages should use <file>/run</file> in preference
+	    to <file>/var/run</file> and <file>/run/lock</file> in
+	    preference to <file>/var/lock</file>.
+	  </p>
+	</sect1>
       </sect>
 
       <sect>
@@ -6762,15 +6810,14 @@ test -f <var>program-executed-later-in-script</var> || exit 0
 	  </p>
 
 	  <p>
-	    <file>/var/run</file> and <file>/var/lock</file> may be mounted
-	    as temporary filesystems<footnote>
-		For example, using the <tt>RAMRUN</tt> and <tt>RAMLOCK</tt>
-		options in <file>/etc/default/rcS</file>.
-	    </footnote>, so the <file>init.d</file> scripts must handle this
-	    correctly. This will typically amount to creating any required
-	    subdirectories dynamically when the <file>init.d</file> script
-	    is run, rather than including them in the package and relying on
-	    <prgn>dpkg</prgn> to create them.
+            Files and directories under <file>/run</file>, including ones
+            referred to via the compatibility paths <file>/var/run</file>
+            and <file>/var/lock</file>, are normally stored on a temporary
+            filesystem and are normally not persistent across a reboot.
+            The <file>init.d</file> scripts must handle this correctly.
+            This will typically mean creating any required subdirectories
+            dynamically when the <file>init.d</file> script is run.
+            See <ref id="fhs-run"> for more information.
 	  </p>
 	</sect1>
 
-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>



Reply to: