Your message dated Thu, 05 Jan 2023 13:19:14 +0000
with message-id <[email protected]>
and subject line Bug#850202: fixed in dash 0.5.12-1
has caused the Debian Bug report #850202,
regarding dash: test with multiple conditions cannot handle variable whose 
expanded value is same as an operator
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
850202: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=850202
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: dash
Version: 0.5.7-4+b1
Severity: normal

In Bourne shell script with dash, using either [ ] or test,

   test -n "${variable}" && echo "variable is set to -->${variable}<--"

works as expected even if the value of variable is to a value the same
as a test operator eg -ne or -nt

   variable="-ne" ; test -n "${variable}" && echo "variable is set to 
-->${variable}<--"
   variable is set to -->-ne<--

However the addition of another test condition with -a or -o results in an
unexpected behavior in that the expanded variable is now treated as an operator
and not just as the string as should be the case.

    variable="-ne" ; test -n "${variable}" -a -n "${DISPLAY}" && echo "variable 
is set to -->${variable}<--"
    dash: 1: test: Illegal number: -n

Applying quoted parentheses makes no difference.

    variable="-ne" ; test \( -n "${variable}" \) -a \( -n "${DISPLAY}" \) && 
echo "variable is set to -->${variable}<--"
dash: 2: test: Illegal number: -n

Similarly bad behavior is seen with a variable set to "-nt", which is how I 
stumbled upon this problem.

    variable="-nt" ; test \( -n "${variable}" \) -a \( -n "${DISPLAY}" \) && 
echo "variable is set to -->${variable}<--"
dash: 3: test: closing paren expected

So if the test is consists of a single condtion, the expanded variable does not 
cause
problems with the test, and should not affect the test if it is part of a 
multiple condition test.

Incidentally bash also has this problem.

So the short term kludge in a shell script is to do

     if [ -n "${variable_with_problem_value}" ]
     then
          if [ \( other_condition1 \) -a \( other_condition2 \) ]
          then
               ...



-- System Information:
Debian Release: 8.6
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: armel (armv5tel)

Kernel: Linux 3.16.0-4-kirkwood
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=ANSI_X3.4-1968) 
(ignored: LC_ALL set to C)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages dash depends on:
ii  debianutils  4.4+b1
ii  dpkg         1.17.27
ii  libc6        2.19-18+deb8u6

dash recommends no packages.

dash suggests no packages.

-- debconf information:
* dash/sh: true

--- End Message ---
--- Begin Message ---
Source: dash
Source-Version: 0.5.12-1
Done: Andrej Shadura <[email protected]>

We believe that the bug you reported is fixed in the latest version of
dash, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Andrej Shadura <[email protected]> (supplier of updated dash package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Thu, 05 Jan 2023 14:06:02 +0100
Source: dash
Architecture: source
Version: 0.5.12-1
Distribution: unstable
Urgency: medium
Maintainer: Andrej Shadura <[email protected]>
Changed-By: Andrej Shadura <[email protected]>
Closes: 558607 819829 850202 975326 1017531 1024635
Changes:
 dash (0.5.12-1) unstable; urgency=medium
 .
   * New upstream release (Closes: #1017531, #1024635).
   * Refresh patches.
   * Apply upstream patches for hash, ulimit and manpages
     (Closes: #558607, #819829, #850202, #975326).
Checksums-Sha1:
 97cd1d5275fe8d1f81c036d7c998133674c07f25 1520 dash_0.5.12-1.dsc
 e15444a93853f693774df003f87d9040ab600a5e 246054 dash_0.5.12.orig.tar.gz
 1dd0eee42af5fd7ead7de85a79a9a8699bc5bc13 38520 dash_0.5.12-1.debian.tar.xz
Checksums-Sha256:
 0861850b279fdcd8ff6740e4813896f2ad20365b5995ef175e7d18f6122633c1 1520 
dash_0.5.12-1.dsc
 6a474ac46e8b0b32916c4c60df694c82058d3297d8b385b74508030ca4a8f28a 246054 
dash_0.5.12.orig.tar.gz
 b022cf6c89c9312fe57e9a767390f022b4dbedb5f6541c06f6a8b20187a3da61 38520 
dash_0.5.12-1.debian.tar.xz
Files:
 0f4256c25db24c637966edb041f35fac 1520 shells optional dash_0.5.12-1.dsc
 57222b768b84003ea4b801e5d5e0e52b 246054 shells optional dash_0.5.12.orig.tar.gz
 4b932e195cf79623b4895b3f9a3ae0ff 38520 shells optional 
dash_0.5.12-1.debian.tar.xz

-----BEGIN PGP SIGNATURE-----

iHUEARYIAB0WIQSD3NF/RLIsyDZW7aHoRGtKyMdyYQUCY7bLcgAKCRDoRGtKyMdy
Ybj4AQDGyhSiHNJ+NT4Tq3TN1OImwvvVhfbyPaaUpOiSq19v3AD/YdpLQHB6Ju7W
/UrNXSUeUsP4ijKpbWe4JYF37hn18Aw=
=uLUG
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to