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

Bug#224509: [PROPOSAL] Correct spurious promise regarding TTY availability



Package: debian-policy
Severity: wishlist

  Current policy says a controlling terminal is guaranteed to be
 available in the maintainer scripts.  This is simply not true, for
 dpkg will happily run without one - which makes all scripts that
 make explicit use of /dev/tty (as policy recommends) fail with
 the error message '/dev/tty: No such device or address'.

  The following patch should correct policy so it documents current
 practise instead of making incorrect guarantees:

--- policy.sgml	2003-08-19 14:32:23.000000000 +0200
+++ policy.sgml.new	2003-12-19 00:18:48.000000000 +0100
@@ -3229,8 +3229,8 @@
 	<heading>Controlling terminal for maintainer scripts</heading>
 
 	<p>
-	  The maintainer scripts are guaranteed to run with a
-	  controlling terminal and can interact with the user.
+	  The maintainer scripts might run with a controlling
+	  terminal and can in that case interact with the user.
 	  If they need to prompt for passwords, do full-screen
 	  interaction or something similar you should do these
 	  things to and from <file>/dev/tty</file>, since
@@ -3244,6 +3244,16 @@
 	  buffered.
 	</p>
 
+        <p>
+	  Availability of a controlling terminal is not guaranteed,
+	  so before making use of it you should take care to check for
+	  its availability.  If it is unavailable, you should ensure
+	  this is handled gracefully by assuming noninteractive
+	  behaviour.  Determining the availability of a controlling
+	  terminal can for example be done by inspecting the return
+	  code of the command <prgn>tty</prgn>.
+        </p>
+
 	<p>
 	  Each script should return a zero exit status for
 	  success, or a nonzero one for failure.
@@ -8709,8 +8719,8 @@
 	      </p>
 
 	      <p>
-		The maintainer scripts are guaranteed to run with a
-		controlling terminal and can interact with the user.
+		The maintainer scripts might run with a controlling
+		terminal and can in that case interact with the user.
 		See <ref id="controllingterminal">.
 	      </p>
 	    </item>
-- 
Tore Anderson

Reply to: