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

Bug#331532: [PROPOSAL] change §10.4 "set -e OR check return status" to AND or be rewritten



Package: debian-policy
Version: 3.6.2.1
Severity: minor

Hello,

the policy says for scripts (§10.4):

Shell scripts (sh and bash) should almost certainly start with set -e so
that errors are detected. Every script should use set -e or check the
exit status of every command. 

This implies that any of these techniques can be used or even worse,
either "set -e" or "check the exit status". 

This leads to serious problems like our X maintainer not checking the
return status in /etc/X11/Xsession and risking the failure of the whole
X startup mechanism just because some irrelevant 3rd party subscript
fails.  This behaviour is justified with §10.4 (everyone has to use set
-e and not return failures).

A quick solution for the misinterpretation of the last words in this
statement could be a change to: 
should use "set -e" and check the exit status of every command.

However, I propose to not force any problem handling technique. "set -e"
has always been a reason for time bombs, problems that are hidden on the
development system since everything works well but cause great problems
in the wild. Especially since such problems are hard to debug because of
not printing any useful output with "set -e". So I propose:

"Every script should should be implemented in the most problem tolerant
way. Exit status of every command should be checked and handled
appropriately if it can cause potential failure."

Eduard.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.14-rc2
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)

-- no debconf information



Reply to: