From owner-svn-src-all@freebsd.org Thu Aug 9 16:35:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A949F106C057; Thu, 9 Aug 2018 16:35:18 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward105p.mail.yandex.net (forward105p.mail.yandex.net [77.88.28.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Yandex CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 16CFF7CBC5; Thu, 9 Aug 2018 16:35:17 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from mxback19j.mail.yandex.net (mxback19j.mail.yandex.net [IPv6:2a02:6b8:0:1619::95]) by forward105p.mail.yandex.net (Yandex) with ESMTP id 5E8014087900; Thu, 9 Aug 2018 19:35:15 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback19j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 0ZaAM3n9Ng-ZFG05sdw; Thu, 09 Aug 2018 19:35:15 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1533832515; bh=VrtmfHs6NY2E+m3NLt3ZA6v1/ZHt8fdh1UtTjpwqsvg=; h=Subject:To:Cc:References:From:Message-ID:Date:In-Reply-To; b=adTAA3xLyk5XJSQzeboyPuwKfcFeBpKdnRIer/KFNcvDuW6xEFAMxhXQaaVi3U1mb BVg72bqUsUoRrkbKgfqVfXmxceK69wd0mnB4ZgjiGYK8szaR4XLYAjttMpwL3g1a7U c/+4jW2f/MxtYo3PxwlM/PIki4Nk3cziSoVtMwao= Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id XJ7HBwl7kI-ZEPiX9Ll; Thu, 09 Aug 2018 19:35:14 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1533832514; bh=VrtmfHs6NY2E+m3NLt3ZA6v1/ZHt8fdh1UtTjpwqsvg=; h=Subject:To:Cc:References:From:Message-ID:Date:In-Reply-To; b=JN8Yooi5qfxjPKRFl1Dg23uVIEsRZ3jCMgOiKmGZAiltBBCkSoXiatuJHl3CAeDd/ wHUKXuAsIXUdg2pruyY7d2sF53I7YDIfL7gU+gjVS8p543Nj0vjMqfNH6OjXhU8hVn jgGe0U5TMFkFDeJB5obRAErWMHDr9oAhNYEWOsUQ= Authentication-Results: smtp4o.mail.yandex.net; dkim=pass header.i=@yandex.ru Subject: Re: svn commit: r337536 - head/sbin/ipfw To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201808091619.w79GJ9lp018293@pdx.rh.CN85.dnsmgr.net> From: "Andrey V. Elsukov" Openpgp: id=E6591E1B41DA1516F0C9BC0001C5EA0410C8A17A Autocrypt: addr=bu7cher@yandex.ru; prefer-encrypt=mutual; keydata= xsBNBEwBF1kBCADB9sXFhBEUy8qQ4X63Y8eBatYMHGEFWN9ypS5lI3RE6qQW2EYbxNk7qUC5 21YIIS1mMFVBEfvR7J9uc7yaYgFCEb6Sce1RSO4ULN2mRKGHP3/Sl0ijZEjWHV91hY1YTHEF ZW/0GYinDf56sYpDDehaBF5wkWIo1+QK5nmj3vl0DIDCMNd7QEiWpyLVwECgLX2eOAXByT8B bCqVhJGcG6iFP7/B9Ll6uX5gb8thM9LM+ibwErDBVDGiOgvfxqidab7fdkh893IBCXa82H9N CNwnEtcgzh+BSKK5BgvPohFMgRwjti37TSxwLu63QejRGbZWSz3OK3jMOoF63tCgn7FvABEB AAHNIkFuZHJleSBWLiBFbHN1a292IDxhZUBm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1hIWNRxanAe7Vlg7OL+gvLpdtrYCMg28PNqKNyrQ87LQ49O9 50IIZDOtNFeR0FGucjcLPdS9PiEqCoH7/waJxWp6ydJ+g4OYRBYNM0EmMgy1N85JJrV1mi5i Message-ID: <640fc2e6-9332-2b59-c6ad-b0fd42dae7f2@yandex.ru> Date: Thu, 9 Aug 2018 19:34:47 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <201808091619.w79GJ9lp018293@pdx.rh.CN85.dnsmgr.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="o4EFbxeT5wmGonS9hninS7cVFGEJvMOfc" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2018 16:35:18 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --o4EFbxeT5wmGonS9hninS7cVFGEJvMOfc Content-Type: multipart/mixed; boundary="ED60JM1c6I2rSV9k2NyRGw4OwEhDoinM2"; protected-headers="v1" From: "Andrey V. Elsukov" To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <640fc2e6-9332-2b59-c6ad-b0fd42dae7f2@yandex.ru> Subject: Re: svn commit: r337536 - head/sbin/ipfw References: <201808091619.w79GJ9lp018293@pdx.rh.CN85.dnsmgr.net> In-Reply-To: <201808091619.w79GJ9lp018293@pdx.rh.CN85.dnsmgr.net> --ED60JM1c6I2rSV9k2NyRGw4OwEhDoinM2 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 09.08.2018 19:19, Rodney W. Grimes wrote: >>>> table add/delete commands had the same behavior, "nat" already noted= in >>>> this list. What is the usage scenario do you use, where you need to = fail >>>> on bad delete? >>> >>> if [ ipfw delete ${1} ]; then >>> handle the missing rule >>> fi >> >> This is mostly unneeded operation, that we wanted to avoid. >> I.e. to be able run in bath mode: >> >> delete ${n} >> add ${n} ... >=20 > That is one use case, but any shell script worth writting > is worth writting to handle error conditions, and not being > able to handle errors while being silent is a PITA. Ok, I still don't understand the usefulness of knowing the error code of delete command. But, I can propose the following solution: Index: ipfw2.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- ipfw2.c (revision 337541) +++ ipfw2.c (working copy) @@ -3314,7 +3314,7 @@ ipfw_delete(char *av[]) } } } - if (exitval !=3D EX_OK && co.do_quiet =3D=3D 0) + if (exitval !=3D EX_OK && co.do_force =3D=3D 0) exit(exitval); } With this patch -q will work as "quiet", -f will work as "force". So, you can still get error code in shell script, and I can run batched commands with -q -f: # ipfw -f delete 10000-11000 ; echo $? ipfw: no rules rules in 10000-11000 range 0 # ipfw -qf delete 10000-11000 ; echo $? 0 # ipfw -q delete 10000-11000 ; echo $? 69 Are you fine with this? --=20 WBR, Andrey V. Elsukov --ED60JM1c6I2rSV9k2NyRGw4OwEhDoinM2-- --o4EFbxeT5wmGonS9hninS7cVFGEJvMOfc Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQEzBAEBCAAdFiEE5lkeG0HaFRbwybwAAcXqBBDIoXoFAltsbScACgkQAcXqBBDI oXqBkwf+O4mBg6wo0VC19fS4aIfej3CwSJ7i82sxmb9kaf5jGTwX5qudvEwb8dz5 bHeFq4eTNw3feECgtAaPaFIi6eKZwuuK+oL0w/dvssDUIiak4RYMVG4slkI5HgiQ qTaZTD8otIJFexKW+AKd5SpB0IsGN2zAdAJXXBpVCuFlpi3Bkpu1yo3DRs5vRBGF S8gFM/rndmTQrzbPPug/MHt7QWhzTcapoxTmuCKJqjumhNqFdbYACLfyQdtNxhLG evFWC2UE7GiQbEYvXjmghJ15J9LI1ozyYDeGxQI6LG+yMgoHc6C5oZs1VK3Nk46Q mR57mCnBuX7HXWdeTpDBv/t0agOnHQ== =Ogot -----END PGP SIGNATURE----- --o4EFbxeT5wmGonS9hninS7cVFGEJvMOfc--