Package: debian-policy Version: 3.7.3.0 Severity: normal Tags: patch The "scripts" section of chapter 10 is somewhat ambiguous about whether declaring multiple local variables is acceptable or not:
file:///usr/share/doc/debian-policy/policy.html/ch-files.html#s-scripts For example, is the following function compliant with policy in a /bin/sh script? The arguments to local are no more complex than simple variables: func () { local a b a=foo b=bar # ... } Two patches below describe the more conservative interpretation (that only a single variable may be locally scoped in policy-compliant /bin/sh scripts), and the more liberal interpretation (multiple variables can be listed in a single local declaration). Obviously, only one of these should be applied! Thanks for maintaining debian policy, --dkg [0 [EMAIL PROTECTED] debian-policy-3.7.3.0]$ diff -u policy.sgml{,.conservative} --- policy.sgml 2008-03-27 14:52:16.000000000 -0400 +++ policy.sgml.conservative 2008-03-27 14:55:37.000000000 -0400 @@ -6793,11 +6793,11 @@ <item><tt>test</tt>, if implemented as a shell built-in, must support <tt>-a</tt> and <tt>-o</tt> as binary logical operators.</item> - <item><tt>local</tt> to create a scoped variable must be - supported; however, <tt>local</tt> may or may not preserve - the variable value from an outer scope and may or may not - support arguments more complex than simple variables. Only - uses such as: + <item><tt>local</tt> to create a single scoped variable + must be supported; however, <tt>local</tt> may or may + not preserve the variable value from an outer scope and + may or may not support arguments more complex than a + single simple variable. Only uses such as: <example compact> fname () { local a [1 [EMAIL PROTECTED] debian-policy-3.7.3.0]$ diff -u policy.sgml{,.liberal} --- policy.sgml 2008-03-27 14:52:16.000000000 -0400 +++ policy.sgml.liberal 2008-03-27 15:20:58.000000000 -0400 @@ -6793,11 +6793,11 @@ <item><tt>test</tt>, if implemented as a shell built-in, must support <tt>-a</tt> and <tt>-o</tt> as binary logical operators.</item> - <item><tt>local</tt> to create a scoped variable must be - supported; however, <tt>local</tt> may or may not preserve - the variable value from an outer scope and may or may not - support arguments more complex than simple variables. Only - uses such as: + <item><tt>local</tt> to create scoped variables must be + supported; however, <tt>local</tt> may or may not + preserve the variables' values from outer scopes and may + or may not support arguments more complex than a series + of simple variable names. Only uses such as: <example compact> fname () { local a [1 [EMAIL PROTECTED] debian-policy-3.7.3.0]$ -- System Information: Debian Release: lenny/sid APT prefers testing APT policy: (500, 'testing'), (200, 'unstable'), (101, 'experimental') Architecture: i386 (i686) Kernel: Linux 2.6.22-3-686 (SMP w/1 CPU core) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash -- no debconf information -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]