From unknown Mon Jun 23 02:23:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24894: coreutils 8.4 : `test -s` without argument does not return an error Resent-From: BAECKEROOT Alain Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 07 Nov 2016 16:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 24894 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 24894@debbugs.gnu.org X-Debbugs-Original-To: "bug-coreutils@gnu.org" Received: via spool by submit@debbugs.gnu.org id=B.147853644028160 (code B ref -1); Mon, 07 Nov 2016 16:34:01 +0000 Received: (at submit) by debbugs.gnu.org; 7 Nov 2016 16:34:00 +0000 Received: from localhost ([127.0.0.1]:48577 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c3mrw-0007K7-1t for submit@debbugs.gnu.org; Mon, 07 Nov 2016 11:34:00 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47338) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c3jVR-0000Wp-AP for submit@debbugs.gnu.org; Mon, 07 Nov 2016 07:58:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c3jVL-0008IE-5S for submit@debbugs.gnu.org; Mon, 07 Nov 2016 07:58:28 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,HTML_MESSAGE autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:47120) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c3jVL-0008I7-25 for submit@debbugs.gnu.org; Mon, 07 Nov 2016 07:58:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c3jVJ-0007i5-Jx for bug-coreutils@gnu.org; Mon, 07 Nov 2016 07:58:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c3jVF-00088m-Mf for bug-coreutils@gnu.org; Mon, 07 Nov 2016 07:58:25 -0500 Received: from smtpin-noe.cnav.fr ([46.20.171.17]:38485 helo=smtpout-tours.cnav.fr) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1c3jVF-00080N-Ej for bug-coreutils@gnu.org; Mon, 07 Nov 2016 07:58:21 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2AIAgCheSBY/2czkTJdHAEBBAEBCgEBgy4BAQEBAR+BWwGNMKtSggiGJAKCBT8UAQIBAQEBAQEBYh0LhGg6UQEVFRQvEyYBBBuIUKFKkjo4Aosyj1yDL4IvBYhMkVsaRZBLiSeGA5EwHjeBFYJEDII/h28BgQsBAQE X-IronPort-AV: E=Sophos;i="5.31,606,1473112800"; d="scan'208";a="40281401" Content-Type: multipart/mixed; boundary="===============2551599620287384794==" MIME-Version: 1.0 Received: from unknown (HELO internet-mail.n18.an.cnav) ([50.145.51.103]) by smtpout-tours.cnav.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 07 Nov 2016 13:58:16 +0100 Received: from QASPW0351125.n18.an.cnav ([169.254.3.189]) by QASPW351103.n18.an.cnav ([50.145.51.103]) with mapi id 14.03.0158.001; Mon, 7 Nov 2016 13:58:15 +0100 From: BAECKEROOT Alain Thread-Topic: coreutils 8.4 : `test -s` without argument does not return an error Thread-Index: AdI488lwsEOv46YSSjOP/cEeorR11A== Date: Mon, 7 Nov 2016 12:58:15 +0000 Message-ID: <823C9BABC7E0CC47AC3804DF8BAC1D504F01DBFD@QASPW0351125.n18.an.cnav> Accept-Language: fr-FR, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [50.145.51.8] MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Mailman-Approved-At: Mon, 07 Nov 2016 11:33:59 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --===============2551599620287384794== Content-Language: fr-FR Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Dear gnu-coreutils team We had a funny problem caused by `test` which does return "0" when an optio= n is given without any EXPRESSION=20 The man page says (near line 15 or so) :=20 An omitted EXPRESSION defaults to false. This is not the case when an option is given (tested for -s and -d options) wasoi@CMV03:/home/wasoi> echo $SHELL /bin/ksh wasoi@CMV03:/home/wasoi> uname Linux wasoi@CMV03:/home/wasoi> test -s wasoi@CMV03:/home/wasoi> echo $? 0 I expected an error (at least return code not zero) , or it would be nice t= o be warned in the man page. ---------- system and package information :=20 wasoi@CMV03:/home/wasoi> cat /etc/redhat\-release CentOS release 6.4 (Final) List of rpm coreutils-libs-8.4-19.el6.x86_64 coreutils-8.4-19.el6.x86_64 policycoreutils-2.0.83-19.30.el6.x86_64 ------------- reference : On *AIX* 6.1 , with IBM's test , there is an error=20 wasoi@cms054:/i/w/l/w00/was> echo $SHELL /bin/ksh wasoi@cms054:/i/w/l/w00/was> uname AIX wasoi@cms054:/i/w/l/w00/was> test -s ksh: test: argument expected wasoi@cms054:/i/w/l/w00/was> echo $? 1 This was the expected behavior :-) =20 The *AIX* man page gives=20 Exit Status This command returns the following exit values: Item Description 0 The Expression parameter is true. 1 The Expression parameter is false or missing. >1 An error occurred. ------------- Best regards , and thanks a lot for your work. Alain BAECKEROOT (cnav.fr) --===============2551599620287384794== Content-Type: multipart/alternative; boundary="===============4729288105988926040==" MIME-Version: 1.0 Content-Disposition: inline --===============4729288105988926040== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable ***************************************************************************= ************** Ce message =C3=A9lectronique, les =C3=A9ventuels fichiers joints et les inf= ormations qu'il contient, peuvent =C3=AAtre couverts par le secret professi= onnel et sont exclusivement adress=C3=A9s =C3=A0 son destinataire. Si vous = le recevez par erreur, merci d'en informer l'exp=C3=A9diteur et de le d=C3= =A9truire. A ce titre, toute diffusion non autoris=C3=A9e de ce message, m= =C3=AAme partielle, sous quelque forme que ce soit, est interdite et punie = par la loi. En aucun cas, le contenu de ce message ne peut valoir offre ou acceptation = ou engagement de la part de la CARSAT SUD-EST. Les opinions contenues dans ce message sont personnelles =C3=A0 l'=C3=A9met= teur. Il est de la responsabilit=C3=A9 du destinataire de s'assurer que le messag= e et ses =C3=A9ventuelles pi=C3=A8ces jointes ne contiennent pas de virus i= nformatique. --===============4729288105988926040== Content-Type: text/html; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable ***********************************************************************= ******************

Ce message =C3=A9lectronique, les =C3=A9ventuels fichiers = joints et les informations qu'il contient, peuvent =C3=AAtre couverts par l= e secret professionnel et sont exclusivement adress=C3=A9s =C3=A0 son desti= nataire. Si vous le recevez par erreur, merci d'en informer l'exp=C3=A9dite= ur et de le d=C3=A9truire. A ce titre, toute diffusion non autoris=C3=A9e d= e ce message, m=C3=AAme partielle, sous quelque forme que ce soit, est inte= rdite et punie par la loi.

En aucun cas, le contenu de ce message ne peut valoir offr= e ou acceptation ou engagement de la part de la CARSAT SUD-EST.

Les opinions contenues dans ce message sont personnelles = =C3=A0 l'=C3=A9metteur.

Il est de la responsabilit=C3=A9 du destinataire de s'assurer que le= message et ses =C3=A9ventuelles pi=C3=A8ces jointes ne contiennent pas de = virus informatique.

--===============4729288105988926040==-- --===============2551599620287384794==-- From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 07 11:46:25 2016 Received: (at control) by debbugs.gnu.org; 7 Nov 2016 16:46:25 +0000 Received: from localhost ([127.0.0.1]:48592 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c3n3x-0007d9-4V for submit@debbugs.gnu.org; Mon, 07 Nov 2016 11:46:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33404) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c3n3v-0007cn-9D; Mon, 07 Nov 2016 11:46:23 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8281033884D; Mon, 7 Nov 2016 16:46:17 +0000 (UTC) Received: from [10.3.116.189] (ovpn-116-189.phx2.redhat.com [10.3.116.189]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uA7GkG6M029484; Mon, 7 Nov 2016 11:46:17 -0500 Subject: Re: bug#24894: coreutils 8.4 : `test -s` without argument does not return an error To: BAECKEROOT Alain , 24894-done@debbugs.gnu.org References: <823C9BABC7E0CC47AC3804DF8BAC1D504F01DBFD@QASPW0351125.n18.an.cnav> From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Organization: Red Hat, Inc. Message-ID: <3dbc5f88-542f-e9f2-e965-5adb1e0fafaf@redhat.com> Date: Mon, 7 Nov 2016 10:46:16 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <823C9BABC7E0CC47AC3804DF8BAC1D504F01DBFD@QASPW0351125.n18.an.cnav> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="NGdbX3dCjjvWrgUONGnGGrjnoE5EBdddh" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 07 Nov 2016 16:46:17 +0000 (UTC) X-Spam-Score: -7.9 (-------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -7.9 (-------) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --NGdbX3dCjjvWrgUONGnGGrjnoE5EBdddh Content-Type: multipart/mixed; boundary="F7UjtEAcQ9oItcg0exvdcD2LehUjFWFQg"; protected-headers="v1" From: Eric Blake To: BAECKEROOT Alain , 24894-done@debbugs.gnu.org Message-ID: <3dbc5f88-542f-e9f2-e965-5adb1e0fafaf@redhat.com> Subject: Re: bug#24894: coreutils 8.4 : `test -s` without argument does not return an error References: <823C9BABC7E0CC47AC3804DF8BAC1D504F01DBFD@QASPW0351125.n18.an.cnav> In-Reply-To: <823C9BABC7E0CC47AC3804DF8BAC1D504F01DBFD@QASPW0351125.n18.an.cnav> --F7UjtEAcQ9oItcg0exvdcD2LehUjFWFQg Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable tag 24894 notabug thanks On 11/07/2016 06:58 AM, BAECKEROOT Alain wrote: > Dear gnu-coreutils team >=20 > We had a funny problem caused by `test` which does return "0" when an o= ption is given without any EXPRESSION=20 >=20 > The man page says (near line 15 or so) :=20 > An omitted EXPRESSION defaults to false. You are correct that it states that, but it means that 'test' (with no expression at all) is what results in a false return (that is, an omitted expression is equivalent to zero arguments). 'test -s' is NOT a case of an omitted expression; your expression was '-s'. Since you provided exactly one argument, you are testing whether '-s' is the empty string (it is not, hence the true result). The full POSIX rules are here: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html > I expected an error (at least return code not zero) , or it would be ni= ce to be warned in the man page. You are correct that the man page could probably do a bit better at explaining that test's behavior is STRONGLY influenced by the number of parameters present (and this is per POSIX rules, so it is not just coreutils' test implementation, but ALL conforming implementations that will behave the same way). > ------------- > reference : On *AIX* 6.1 , with IBM's test , there is an error=20 >=20 > wasoi@cms054:/i/w/l/w00/was> echo $SHELL > /bin/ksh > wasoi@cms054:/i/w/l/w00/was> uname > AIX > wasoi@cms054:/i/w/l/w00/was> test -s > ksh: test: argument expected That is a bug in AIX's ksh, which is not POSIX compliant. > wasoi@cms054:/i/w/l/w00/was> echo $? > 1 >=20 > This was the expected behavior :-) =20 Sorry, but that behavior is contrary to POSIX. > Ce message =C3=A9lectronique, les =C3=A9ventuels fichiers joints et les= informations qu'il contient, Legalese like this is unenforceable on public mailing lists; you may wish to use a personal email account rather than spamming us with your employer's garbage disclaimer. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --F7UjtEAcQ9oItcg0exvdcD2LehUjFWFQg-- --NGdbX3dCjjvWrgUONGnGGrjnoE5EBdddh Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJYIK/YAAoJEKeha0olJ0NqmQ4IAKffL9QevYpYqu/6BJdpayaF yH9P8u1RO/MeiriU1xpHxrNfV4EEy1jhBWBsVINl42hxneuJNOwP9w5fU3P5HhZB Hf376EUOsD9KBh2xxMoMbfAoEmmhbkf3wJhHL4cEJm7CbrYGWL0v/asj1nvuUcQH lT5mDAaAB+VTC7aLp8wzok7bbTzxgM4FexRgSXcClYeFM15gq2a4YEDFu6YK/JPI qS+7sYJYMvLcPorHE5VfNsMicIe0An/5JZ6u1we9QDfO/xk6ZAPsIEWSXakZHhGu n0YJSuMZyWIUAJjnpp4K4hOoFFaRvnINRCWv1AcV06wYRVX/FlDSp76VDbYc1BY= =nTKJ -----END PGP SIGNATURE----- --NGdbX3dCjjvWrgUONGnGGrjnoE5EBdddh-- From unknown Mon Jun 23 02:23:39 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: BAECKEROOT Alain Subject: bug#24894: closed (Re: bug#24894: coreutils 8.4 : `test -s` without argument does not return an error) Message-ID: References: <3dbc5f88-542f-e9f2-e965-5adb1e0fafaf@redhat.com> <823C9BABC7E0CC47AC3804DF8BAC1D504F01DBFD@QASPW0351125.n18.an.cnav> X-Gnu-PR-Message: they-closed 24894 X-Gnu-PR-Package: coreutils X-Gnu-PR-Keywords: notabug Reply-To: 24894@debbugs.gnu.org Date: Mon, 07 Nov 2016 16:47:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1478537223-29399-1" This is a multi-part message in MIME format... ------------=_1478537223-29399-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #24894: coreutils 8.4 : `test -s` without argument does not return an err= or=20 which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 24894@debbugs.gnu.org. --=20 24894: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D24894 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1478537223-29399-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 24894-done) by debbugs.gnu.org; 7 Nov 2016 16:46:25 +0000 Received: from localhost ([127.0.0.1]:48590 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c3n3w-0007d7-S1 for submit@debbugs.gnu.org; Mon, 07 Nov 2016 11:46:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33404) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c3n3v-0007cn-9D; Mon, 07 Nov 2016 11:46:23 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8281033884D; Mon, 7 Nov 2016 16:46:17 +0000 (UTC) Received: from [10.3.116.189] (ovpn-116-189.phx2.redhat.com [10.3.116.189]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uA7GkG6M029484; Mon, 7 Nov 2016 11:46:17 -0500 Subject: Re: bug#24894: coreutils 8.4 : `test -s` without argument does not return an error To: BAECKEROOT Alain , 24894-done@debbugs.gnu.org References: <823C9BABC7E0CC47AC3804DF8BAC1D504F01DBFD@QASPW0351125.n18.an.cnav> From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Organization: Red Hat, Inc. Message-ID: <3dbc5f88-542f-e9f2-e965-5adb1e0fafaf@redhat.com> Date: Mon, 7 Nov 2016 10:46:16 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <823C9BABC7E0CC47AC3804DF8BAC1D504F01DBFD@QASPW0351125.n18.an.cnav> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="NGdbX3dCjjvWrgUONGnGGrjnoE5EBdddh" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 07 Nov 2016 16:46:17 +0000 (UTC) X-Spam-Score: -7.9 (-------) X-Debbugs-Envelope-To: 24894-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -7.9 (-------) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --NGdbX3dCjjvWrgUONGnGGrjnoE5EBdddh Content-Type: multipart/mixed; boundary="F7UjtEAcQ9oItcg0exvdcD2LehUjFWFQg"; protected-headers="v1" From: Eric Blake To: BAECKEROOT Alain , 24894-done@debbugs.gnu.org Message-ID: <3dbc5f88-542f-e9f2-e965-5adb1e0fafaf@redhat.com> Subject: Re: bug#24894: coreutils 8.4 : `test -s` without argument does not return an error References: <823C9BABC7E0CC47AC3804DF8BAC1D504F01DBFD@QASPW0351125.n18.an.cnav> In-Reply-To: <823C9BABC7E0CC47AC3804DF8BAC1D504F01DBFD@QASPW0351125.n18.an.cnav> --F7UjtEAcQ9oItcg0exvdcD2LehUjFWFQg Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable tag 24894 notabug thanks On 11/07/2016 06:58 AM, BAECKEROOT Alain wrote: > Dear gnu-coreutils team >=20 > We had a funny problem caused by `test` which does return "0" when an o= ption is given without any EXPRESSION=20 >=20 > The man page says (near line 15 or so) :=20 > An omitted EXPRESSION defaults to false. You are correct that it states that, but it means that 'test' (with no expression at all) is what results in a false return (that is, an omitted expression is equivalent to zero arguments). 'test -s' is NOT a case of an omitted expression; your expression was '-s'. Since you provided exactly one argument, you are testing whether '-s' is the empty string (it is not, hence the true result). The full POSIX rules are here: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html > I expected an error (at least return code not zero) , or it would be ni= ce to be warned in the man page. You are correct that the man page could probably do a bit better at explaining that test's behavior is STRONGLY influenced by the number of parameters present (and this is per POSIX rules, so it is not just coreutils' test implementation, but ALL conforming implementations that will behave the same way). > ------------- > reference : On *AIX* 6.1 , with IBM's test , there is an error=20 >=20 > wasoi@cms054:/i/w/l/w00/was> echo $SHELL > /bin/ksh > wasoi@cms054:/i/w/l/w00/was> uname > AIX > wasoi@cms054:/i/w/l/w00/was> test -s > ksh: test: argument expected That is a bug in AIX's ksh, which is not POSIX compliant. > wasoi@cms054:/i/w/l/w00/was> echo $? > 1 >=20 > This was the expected behavior :-) =20 Sorry, but that behavior is contrary to POSIX. > Ce message =C3=A9lectronique, les =C3=A9ventuels fichiers joints et les= informations qu'il contient, Legalese like this is unenforceable on public mailing lists; you may wish to use a personal email account rather than spamming us with your employer's garbage disclaimer. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --F7UjtEAcQ9oItcg0exvdcD2LehUjFWFQg-- --NGdbX3dCjjvWrgUONGnGGrjnoE5EBdddh Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJYIK/YAAoJEKeha0olJ0NqmQ4IAKffL9QevYpYqu/6BJdpayaF yH9P8u1RO/MeiriU1xpHxrNfV4EEy1jhBWBsVINl42hxneuJNOwP9w5fU3P5HhZB Hf376EUOsD9KBh2xxMoMbfAoEmmhbkf3wJhHL4cEJm7CbrYGWL0v/asj1nvuUcQH lT5mDAaAB+VTC7aLp8wzok7bbTzxgM4FexRgSXcClYeFM15gq2a4YEDFu6YK/JPI qS+7sYJYMvLcPorHE5VfNsMicIe0An/5JZ6u1we9QDfO/xk6ZAPsIEWSXakZHhGu n0YJSuMZyWIUAJjnpp4K4hOoFFaRvnINRCWv1AcV06wYRVX/FlDSp76VDbYc1BY= =nTKJ -----END PGP SIGNATURE----- --NGdbX3dCjjvWrgUONGnGGrjnoE5EBdddh-- ------------=_1478537223-29399-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 Nov 2016 16:34:00 +0000 Received: from localhost ([127.0.0.1]:48577 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c3mrw-0007K7-1t for submit@debbugs.gnu.org; Mon, 07 Nov 2016 11:34:00 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47338) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c3jVR-0000Wp-AP for submit@debbugs.gnu.org; Mon, 07 Nov 2016 07:58:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c3jVL-0008IE-5S for submit@debbugs.gnu.org; Mon, 07 Nov 2016 07:58:28 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,HTML_MESSAGE autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:47120) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c3jVL-0008I7-25 for submit@debbugs.gnu.org; Mon, 07 Nov 2016 07:58:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c3jVJ-0007i5-Jx for bug-coreutils@gnu.org; Mon, 07 Nov 2016 07:58:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c3jVF-00088m-Mf for bug-coreutils@gnu.org; Mon, 07 Nov 2016 07:58:25 -0500 Received: from smtpin-noe.cnav.fr ([46.20.171.17]:38485 helo=smtpout-tours.cnav.fr) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1c3jVF-00080N-Ej for bug-coreutils@gnu.org; Mon, 07 Nov 2016 07:58:21 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2AIAgCheSBY/2czkTJdHAEBBAEBCgEBg?= =?us-ascii?q?y4BAQEBAR+BWwGNMKtSggiGJAKCBT8UAQIBAQEBAQEBYh0LhGg6UQEVFRQvEyY?= =?us-ascii?q?BBBuIUKFKkjo4Aosyj1yDL4IvBYhMkVsaRZBLiSeGA5EwHjeBFYJEDII/h28Bg?= =?us-ascii?q?QsBAQE?= X-IronPort-AV: E=Sophos;i="5.31,606,1473112800"; d="scan'208";a="40281401" Content-Type: multipart/mixed; boundary="===============2551599620287384794==" MIME-Version: 1.0 Received: from unknown (HELO internet-mail.n18.an.cnav) ([50.145.51.103]) by smtpout-tours.cnav.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 07 Nov 2016 13:58:16 +0100 Received: from QASPW0351125.n18.an.cnav ([169.254.3.189]) by QASPW351103.n18.an.cnav ([50.145.51.103]) with mapi id 14.03.0158.001; Mon, 7 Nov 2016 13:58:15 +0100 From: BAECKEROOT Alain To: "bug-coreutils@gnu.org" Subject: coreutils 8.4 : `test -s` without argument does not return an error Thread-Topic: coreutils 8.4 : `test -s` without argument does not return an error Thread-Index: AdI488lwsEOv46YSSjOP/cEeorR11A== Date: Mon, 7 Nov 2016 12:58:15 +0000 Message-ID: <823C9BABC7E0CC47AC3804DF8BAC1D504F01DBFD@QASPW0351125.n18.an.cnav> Accept-Language: fr-FR, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [50.145.51.8] MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 07 Nov 2016 11:33:59 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --===============2551599620287384794== Content-Language: fr-FR Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Dear gnu-coreutils team We had a funny problem caused by `test` which does return "0" when an optio= n is given without any EXPRESSION=20 The man page says (near line 15 or so) :=20 An omitted EXPRESSION defaults to false. This is not the case when an option is given (tested for -s and -d options) wasoi@CMV03:/home/wasoi> echo $SHELL /bin/ksh wasoi@CMV03:/home/wasoi> uname Linux wasoi@CMV03:/home/wasoi> test -s wasoi@CMV03:/home/wasoi> echo $? 0 I expected an error (at least return code not zero) , or it would be nice t= o be warned in the man page. ---------- system and package information :=20 wasoi@CMV03:/home/wasoi> cat /etc/redhat\-release CentOS release 6.4 (Final) List of rpm coreutils-libs-8.4-19.el6.x86_64 coreutils-8.4-19.el6.x86_64 policycoreutils-2.0.83-19.30.el6.x86_64 ------------- reference : On *AIX* 6.1 , with IBM's test , there is an error=20 wasoi@cms054:/i/w/l/w00/was> echo $SHELL /bin/ksh wasoi@cms054:/i/w/l/w00/was> uname AIX wasoi@cms054:/i/w/l/w00/was> test -s ksh: test: argument expected wasoi@cms054:/i/w/l/w00/was> echo $? 1 This was the expected behavior :-) =20 The *AIX* man page gives=20 Exit Status This command returns the following exit values: Item Description 0 The Expression parameter is true. 1 The Expression parameter is false or missing. >1 An error occurred. ------------- Best regards , and thanks a lot for your work. Alain BAECKEROOT (cnav.fr) --===============2551599620287384794== Content-Type: multipart/alternative; boundary="===============4729288105988926040==" MIME-Version: 1.0 Content-Disposition: inline --===============4729288105988926040== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable ***************************************************************************= ************** Ce message =C3=A9lectronique, les =C3=A9ventuels fichiers joints et les inf= ormations qu'il contient, peuvent =C3=AAtre couverts par le secret professi= onnel et sont exclusivement adress=C3=A9s =C3=A0 son destinataire. Si vous = le recevez par erreur, merci d'en informer l'exp=C3=A9diteur et de le d=C3= =A9truire. A ce titre, toute diffusion non autoris=C3=A9e de ce message, m= =C3=AAme partielle, sous quelque forme que ce soit, est interdite et punie = par la loi. En aucun cas, le contenu de ce message ne peut valoir offre ou acceptation = ou engagement de la part de la CARSAT SUD-EST. Les opinions contenues dans ce message sont personnelles =C3=A0 l'=C3=A9met= teur. Il est de la responsabilit=C3=A9 du destinataire de s'assurer que le messag= e et ses =C3=A9ventuelles pi=C3=A8ces jointes ne contiennent pas de virus i= nformatique. --===============4729288105988926040== Content-Type: text/html; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable ***********************************************************************= ******************

Ce message =C3=A9lectronique, les =C3=A9ventuels fichiers = joints et les informations qu'il contient, peuvent =C3=AAtre couverts par l= e secret professionnel et sont exclusivement adress=C3=A9s =C3=A0 son desti= nataire. Si vous le recevez par erreur, merci d'en informer l'exp=C3=A9dite= ur et de le d=C3=A9truire. A ce titre, toute diffusion non autoris=C3=A9e d= e ce message, m=C3=AAme partielle, sous quelque forme que ce soit, est inte= rdite et punie par la loi.

En aucun cas, le contenu de ce message ne peut valoir offr= e ou acceptation ou engagement de la part de la CARSAT SUD-EST.

Les opinions contenues dans ce message sont personnelles = =C3=A0 l'=C3=A9metteur.

Il est de la responsabilit=C3=A9 du destinataire de s'assurer que le= message et ses =C3=A9ventuelles pi=C3=A8ces jointes ne contiennent pas de = virus informatique.

--===============4729288105988926040==-- --===============2551599620287384794==-- ------------=_1478537223-29399-1-- From unknown Mon Jun 23 02:23:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24894: coreutils 8.4 : `test -s` without argument does not return an error Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 07 Nov 2016 16:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24894 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: BAECKEROOT Alain , 24894@debbugs.gnu.org Received: via spool by 24894-submit@debbugs.gnu.org id=B24894.147853749729806 (code B ref 24894); Mon, 07 Nov 2016 16:52:02 +0000 Received: (at 24894) by debbugs.gnu.org; 7 Nov 2016 16:51:37 +0000 Received: from localhost ([127.0.0.1]:48601 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c3n8y-0007kg-Q0 for submit@debbugs.gnu.org; Mon, 07 Nov 2016 11:51:36 -0500 Received: from mail.magicbluesmoke.com ([82.195.144.49]:38752) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c3n8x-0007kY-CV for 24894@debbugs.gnu.org; Mon, 07 Nov 2016 11:51:35 -0500 Received: from [192.168.1.80] (unknown [109.79.57.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.magicbluesmoke.com (Postfix) with ESMTPSA id 331159859; Mon, 7 Nov 2016 16:51:34 +0000 (GMT) References: <823C9BABC7E0CC47AC3804DF8BAC1D504F01DBFD@QASPW0351125.n18.an.cnav> From: =?UTF-8?Q?P=C3=A1draig?= Brady Message-ID: <5683e26c-fe15-158a-e90f-a41e1afe3270@draigBrady.com> Date: Mon, 7 Nov 2016 16:51:33 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <823C9BABC7E0CC47AC3804DF8BAC1D504F01DBFD@QASPW0351125.n18.an.cnav> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 07/11/16 12:58, BAECKEROOT Alain wrote: > Dear gnu-coreutils team > > We had a funny problem caused by `test` which does return "0" when an option is given without any EXPRESSION > > The man page says (near line 15 or so) : > An omitted EXPRESSION defaults to false. It's a bit of a gotcha, but not a bug. I updated: http://www.pixelbeat.org/docs/coreutils-gotchas.html#test thanks, Pádraig From unknown Mon Jun 23 02:23:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24894: coreutils 8.4 : `test -s` without argument does not return an error Resent-From: Reuti Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 07 Nov 2016 16:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24894 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: Eric Blake Cc: 24894-done@debbugs.gnu.org, BAECKEROOT Alain Received: via spool by 24894-done@debbugs.gnu.org id=D24894.147853778230222 (code D ref 24894); Mon, 07 Nov 2016 16:57:01 +0000 Received: (at 24894-done) by debbugs.gnu.org; 7 Nov 2016 16:56:22 +0000 Received: from localhost ([127.0.0.1]:48606 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c3nDa-0007rO-DW for submit@debbugs.gnu.org; Mon, 07 Nov 2016 11:56:22 -0500 Received: from vhrz24.hrz.uni-marburg.de ([137.248.1.34]:45351) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c3nDY-0007rG-VP for 24894-done@debbugs.gnu.org; Mon, 07 Nov 2016 11:56:21 -0500 Received: from ma15106.chemie.uni-marburg.de (ma15106.Chemie.Uni-Marburg.DE [137.248.150.142]) (authenticated bits=0) by vhrz24.HRZ.Uni-Marburg.DE (8.14.4/8.14.4/Debian-8+deb8u1) with ESMTP id uA7Gu9D3027828 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 7 Nov 2016 17:56:11 +0100 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Content-Type: multipart/signed; boundary="Apple-Mail=_1AEAD42A-AFEE-41DE-8308-83290982CFC2"; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Pgp-Agent: GPGMail From: Reuti In-Reply-To: <3dbc5f88-542f-e9f2-e965-5adb1e0fafaf@redhat.com> Date: Mon, 7 Nov 2016 17:56:08 +0100 Message-Id: References: <823C9BABC7E0CC47AC3804DF8BAC1D504F01DBFD@QASPW0351125.n18.an.cnav> <3dbc5f88-542f-e9f2-e965-5adb1e0fafaf@redhat.com> X-Mailer: Apple Mail (2.2104) X-Null-Tag: 0b76899fd360a13111b7a7414b5b844d X-UniMR-MailScanner-Information: see http://www.uni-marburg.de/hrz/internet/mail/spam/ X-UniMR-MailScanner-ID: uA7Gu9D3027828 X-UniMR-MailScanner: Found to be clean X-UniMR-MailScanner-From: reuti@staff.uni-marburg.de X-Spam-Score: -5.2 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.2 (-----) --Apple-Mail=_1AEAD42A-AFEE-41DE-8308-83290982CFC2 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Am 07.11.2016 um 17:46 schrieb Eric Blake : >=20 > tag 24894 notabug > thanks >=20 > On 11/07/2016 06:58 AM, BAECKEROOT Alain wrote: >> Dear gnu-coreutils team >>=20 >> We had a funny problem caused by `test` which does return "0" when an = option is given without any EXPRESSION >>=20 >> The man page says (near line 15 or so) : >> An omitted EXPRESSION defaults to false. >=20 > You are correct that it states that, but it means that 'test' (with no > expression at all) is what results in a false return (that is, an > omitted expression is equivalent to zero arguments). 'test -s' is NOT = a > case of an omitted expression; your expression was '-s'. Since you > provided exactly one argument, you are testing whether '-s' is the = empty > string (it is not, hence the true result). Doesn't -s refer to a FILE existence, it's not -z? But I thought in a similar way: it may be incomplete, but not omitted. Nevertheless: the bash builtin behaves the same. @Alain: I have no AIX, but l get the impression that test is also a = ksh-builtin. Are you getting the results for both implementations? -- Reuti > The full POSIX rules are here: > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html >=20 >> I expected an error (at least return code not zero) , or it would be = nice to be warned in the man page. >=20 > You are correct that the man page could probably do a bit better at > explaining that test's behavior is STRONGLY influenced by the number = of > parameters present (and this is per POSIX rules, so it is not just > coreutils' test implementation, but ALL conforming implementations = that > will behave the same way). >=20 >> ------------- >> reference : On *AIX* 6.1 , with IBM's test , there is an error >>=20 >> wasoi@cms054:/i/w/l/w00/was> echo $SHELL >> /bin/ksh >> wasoi@cms054:/i/w/l/w00/was> uname >> AIX >> wasoi@cms054:/i/w/l/w00/was> test -s >> ksh: test: argument expected >=20 > That is a bug in AIX's ksh, which is not POSIX compliant. >=20 >> wasoi@cms054:/i/w/l/w00/was> echo $? >> 1 >>=20 >> This was the expected behavior :-) >=20 > Sorry, but that behavior is contrary to POSIX. >=20 >> Ce message =C3=A9lectronique, les =C3=A9ventuels fichiers joints et = les informations qu'il contient, >=20 > Legalese like this is unenforceable on public mailing lists; you may > wish to use a personal email account rather than spamming us with your > employer's garbage disclaimer. >=20 > -- > Eric Blake eblake redhat com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org >=20 --Apple-Mail=_1AEAD42A-AFEE-41DE-8308-83290982CFC2 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iEYEARECAAYFAlggsikACgkQo/GbGkBRnRrsAwCfSEs2If5VNOU9LLNk7WFY+8WJ +sQAoJPYV8KOZ26rxQt+HY2enGm01dxM =ZKL9 -----END PGP SIGNATURE----- --Apple-Mail=_1AEAD42A-AFEE-41DE-8308-83290982CFC2-- From unknown Mon Jun 23 02:23:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24894: coreutils 8.4 : `test -s` without argument does not return an error Resent-From: Eric Blake Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 07 Nov 2016 17:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24894 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: Reuti Cc: 24894-done@debbugs.gnu.org, BAECKEROOT Alain Received: via spool by 24894-done@debbugs.gnu.org id=D24894.1478538038369 (code D ref 24894); Mon, 07 Nov 2016 17:01:01 +0000 Received: (at 24894-done) by debbugs.gnu.org; 7 Nov 2016 17:00:38 +0000 Received: from localhost ([127.0.0.1]:48610 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c3nHi-00005b-2E for submit@debbugs.gnu.org; Mon, 07 Nov 2016 12:00:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60838) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c3nHg-0008Pu-1k for 24894-done@debbugs.gnu.org; Mon, 07 Nov 2016 12:00:36 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 613DD80F9D; Mon, 7 Nov 2016 17:00:30 +0000 (UTC) Received: from [10.3.116.189] (ovpn-116-189.phx2.redhat.com [10.3.116.189]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uA7H0T3m030872; Mon, 7 Nov 2016 12:00:29 -0500 References: <823C9BABC7E0CC47AC3804DF8BAC1D504F01DBFD@QASPW0351125.n18.an.cnav> <3dbc5f88-542f-e9f2-e965-5adb1e0fafaf@redhat.com> From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Organization: Red Hat, Inc. Message-ID: <51d032ec-0051-be6a-843c-4ce3399f825a@redhat.com> Date: Mon, 7 Nov 2016 11:00:29 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="0MxjGGklxSK3Kqtt8gK1jn1SVADGnrANQ" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 07 Nov 2016 17:00:30 +0000 (UTC) X-Spam-Score: -7.9 (-------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -7.9 (-------) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --0MxjGGklxSK3Kqtt8gK1jn1SVADGnrANQ Content-Type: multipart/mixed; boundary="E98geANb1HJtsFujpGaciJH922A6MgLJM"; protected-headers="v1" From: Eric Blake To: Reuti Cc: BAECKEROOT Alain , 24894-done@debbugs.gnu.org Message-ID: <51d032ec-0051-be6a-843c-4ce3399f825a@redhat.com> Subject: Re: bug#24894: coreutils 8.4 : `test -s` without argument does not return an error References: <823C9BABC7E0CC47AC3804DF8BAC1D504F01DBFD@QASPW0351125.n18.an.cnav> <3dbc5f88-542f-e9f2-e965-5adb1e0fafaf@redhat.com> In-Reply-To: --E98geANb1HJtsFujpGaciJH922A6MgLJM Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/07/2016 10:56 AM, Reuti wrote: >> You are correct that it states that, but it means that 'test' (with no= >> expression at all) is what results in a false return (that is, an >> omitted expression is equivalent to zero arguments). 'test -s' is NOT= a >> case of an omitted expression; your expression was '-s'. Since you >> provided exactly one argument, you are testing whether '-s' is the emp= ty >> string (it is not, hence the true result). >=20 > Doesn't -s refer to a FILE existence, it's not -z? When there are TWO arguments, '-s "$file"' tests for whether file is empty, and '-z "$string"' tests for whether $string is empty. But here we are talking about ONE argument, '-s', which is non-empty. (Yes, the one-argument case is identical to using the two-argument -z "$string" cas= e.) --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --E98geANb1HJtsFujpGaciJH922A6MgLJM-- --0MxjGGklxSK3Kqtt8gK1jn1SVADGnrANQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJYILMtAAoJEKeha0olJ0Nq/boIAIdNT9zB1+Q1Jy59HLO6JOYB gYSYy+X6gyMmla9I+mHQpw8MBsljqKVGBsm6FBe2ugbx8B7r2XBhtZ/zjgHeXLHk CR1VmrBp0JWX7sN38SKC8KlnRpDr5M4hfqH2GsZzIx87F9oMPgMBI+SgiisuHFPa Ts7kZOBB38NFGIeUSvd68i7M5V72HJ5yMNfDbG70w13eyYvNbAH2Qhc6mV5lXtvf xWS5kMdDfZgg8FBgbmwL1d+J8KAPRgWvByFWi+8O7H+S/cA+IxdjQuhOnJE5h1Oh T/lNiKWd9K7Fl8mo0qpt33WrgTRAS7ylA820vA0luIKXehVXqi9OHxzTBuyXXZs= =sPIm -----END PGP SIGNATURE----- --0MxjGGklxSK3Kqtt8gK1jn1SVADGnrANQ--