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

Bug#785085: marked as done (mksh: Misleading note in manpage about equality test)



Your message dated Tue, 12 May 2015 08:02:16 +0000 (UTC)
with message-id <Pine.BSM.4.64L.1505120800370.31736@herc.mirbsd.org>
and subject line Re: Bug#785085: mksh: Misleading note in manpage about equality test
has caused the Debian Bug report #785085,
regarding mksh: Misleading note in manpage about equality test
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 owner@bugs.debian.org
immediately.)


-- 
785085: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=785085
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: mksh
Version: 50d-5
Severity: minor

Dear Maintainer,

here is a note in manpage about [ $foo = bar ] equality test:

$ MANWIDTH=78 LC_ALL=C man mksh 2>>/dev/null <&2 | grep -A5 'A common mistake is to use'

Note: A common mistake is to use ``if [ $foo = bar ]'' which
fails if parameter ``foo'' is NULL or unset, if it has embedded
spaces (i.e. IFS octets), or if it is a unary operator like '!'
or '-n'.  Use tests like ``if [ x"$foo" = x"bar" ]'' instead, or
the double-bracket operator ``if [[ $foo = bar ]]'' or, to avoid
pattern matching (see [[ above): ``if [[ $foo = "$bar" ]]''

the proposed [ x"$foo" = x"bar" ] is correct but with redundant x character;
this x looks odd and attracts attention, while proper quotation is the point

in order to make it clear it should be something like [ "$foo" = bar ]

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: armhf (armv7l)
Foreign Architectures: armel

Kernel: Linux 3.0.35-ygrex-fx6-6.3+ (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages mksh depends on:
ii  libc6  2.19-18

mksh recommends no packages.

Versions of packages mksh suggests:
ii  ed  1.10-2

-- no debconf information

--- End Message ---
--- Begin Message ---
ygrex@ygrex.ru dixit:

>the proposed [ x"$foo" = x"bar" ] is correct but with redundant x character;

No, this is the recommended form from the GNU Autoconf manual,
section Portable Shell, because some nōn- or old-POSIX shells
require the ‘x’. So this is a portable shell advice, which is
admittedly overzealous in the face of contemporary POSIX sh –
but, as we all know, we have to deal with older shells in the
real life, so this stays.

bye,
//mirabilos

PS: Cosmetic issues like this one are “wishlist”, at best.
-- 
„Cool, /usr/share/doc/mksh/examples/uhr.gz ist ja ein Grund,
mksh auf jedem System zu installieren.“
	-- XTaran auf der OpenRheinRuhr, ganz begeistert
(EN: “[…]uhr.gz is a reason to install mksh on every system.”)

--- End Message ---

Reply to: