From nobody@FreeBSD.org  Mon Apr 25 21:40:48 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AEF201065673
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 25 Apr 2011 21:40:48 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 9D3F88FC13
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 25 Apr 2011 21:40:48 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p3PLemZu040311
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 25 Apr 2011 21:40:48 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p3PLemcr040310;
	Mon, 25 Apr 2011 21:40:48 GMT
	(envelope-from nobody)
Message-Id: <201104252140.p3PLemcr040310@red.freebsd.org>
Date: Mon, 25 Apr 2011 21:40:48 GMT
From: Jed Clear <jclear@speakeasy.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: ipfw reports missing file as parameter problem
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         156653
>Category:       bin
>Synopsis:       ipfw(8) reports missing file as parameter problem
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ipfw
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 25 21:50:08 UTC 2011
>Closed-Date:    Wed Jul 13 04:31:30 UTC 2011
>Last-Modified:  Wed Jul 13 04:40:05 UTC 2011
>Originator:     Jed Clear
>Release:        8.1R-p3
>Organization:
Dis
>Environment:
FreeBSD net5501 8.1-RELEASE-p3 FreeBSD 8.1-RELEASE-p3 #0: Sat Apr 23 16:01:09 EDT 2011     root@fbsdam3.my.domain:/usr/obj/nanobsd.custom/i386/usr/src/sys/JEDWALL  i386

>Description:
I was trying to use -n and the cpp preprocessor to syntax check a new
rules file, using "ipfw -n -p cpp new.rules".  It kept giving me
"ipfw: illegal option -- p".  This was very puzzling for a bit as it
matches the man page perfectly.  Eventually I discovered that I hadn't
copied the new ruleset over to the right place and "new.rules" was MIA.

So the bug is that the error report is misleading.

>How-To-Repeat:
Run "ipfw -n -p cpp /path/to/missing_file"
>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-ipfw 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Tue Apr 26 02:57:22 UTC 2011 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=156653 

From: "Andrey V. Elsukov" <bu7cher@yandex.ru>
To: bug-followup@FreeBSD.org, jclear@speakeasy.net
Cc:  
Subject: Re: bin/156653: ipfw(8) reports missing file as parameter problem
Date: Mon, 02 May 2011 15:59:16 +0400

 Hi,
 
 It seems it never worked in the way you are trying.
 You should use absolute path name for the last argument, e.g.
 # ipfw -n -p cpp /etc/new.rules
 
 -- 
 WBR, Andrey V. Elsukov

From: Jed Clear <jclear@speakeasy.net>
To: Andrey V. Elsukov <bu7cher@yandex.ru>
Cc: bug-followup@FreeBSD.org
Subject: Re: bin/156653: ipfw(8) reports missing file as parameter problem
Date: Mon, 2 May 2011 19:24:24 -0400

 Actually when I discovered it, I was using an absolute path.
 
 -Jed
 On May 2, 2011, at 7:59 AM, Andrey V. Elsukov wrote:
 
 > Hi,
 > 
 > It seems it never worked in the way you are trying.
 > You should use absolute path name for the last argument, e.g.
 > # ipfw -n -p cpp /etc/new.rules
 > 
 > -- 
 > WBR, Andrey V. Elsukov
 
State-Changed-From-To: open->feedback 
State-Changed-By: ae 
State-Changed-When: Tue Jun 28 07:32:47 UTC 2011 
State-Changed-Why:  
Can you provide exact commands to reproduce this? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=156653 

From: Jed Clear <jclear@speakeasy.net>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/156653: ipfw(8) reports missing file as parameter problem
Date: Tue, 28 Jun 2011 21:58:29 -0400

 "ipfw -n -p cpp /path/to/missing_file" still works in 8.1 to generate =
 the misleading error message. (Assuming one doesn't have the file =
 /path/to/missing_file on ones system.)  The issue not that a missing =
 file caused an error, but why that is reported as "illegal option -- p" =
 instead of something like "no such file or directory".
 
 -Jed
 
 clear@net5501:~> ipfw -n -p cpp /path/to/missing_file
 ipfw: illegal option -- p
 ipfw: usage: ipfw [options]
 do "ipfw -h" or "man ipfw" for details
 clear@net5501:~> uname -a
 FreeBSD net5501 8.1-RELEASE-p4 FreeBSD 8.1-RELEASE-p4 #0: Sat May 28 =
 15:02:21 EDT 2011     =
 root@fbsdam3.my.domain:/usr/obj/nanobsd.custom/i386/usr/src/sys/JEDWALL  =
 i386
 clear@net5501:~>=20
 
State-Changed-From-To: feedback->patched 
State-Changed-By: ae 
State-Changed-When: Wed Jun 29 06:48:14 UTC 2011 
State-Changed-Why:  
Patched in head/. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=156653 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/156653: commit references a PR
Date: Wed, 29 Jun 2011 06:45:58 +0000 (UTC)

 Author: ae
 Date: Wed Jun 29 06:45:44 2011
 New Revision: 223661
 URL: http://svn.freebsd.org/changeset/base/223661
 
 Log:
   Improve error reporting. Use corresponding error message when file to be
   preprocessed is missing. Also suggest to use absolute pathname if -p option
   is specified.
   
   PR:             bin/156653
   MFC after:      2 weeks
 
 Modified:
   head/sbin/ipfw/main.c
 
 Modified: head/sbin/ipfw/main.c
 ==============================================================================
 --- head/sbin/ipfw/main.c	Wed Jun 29 05:41:14 2011	(r223660)
 +++ head/sbin/ipfw/main.c	Wed Jun 29 06:45:44 2011	(r223661)
 @@ -262,7 +262,7 @@ ipfw_main(int oldac, char **oldav)
  	save_av = av;
  
  	optind = optreset = 1;	/* restart getopt() */
 -	while ((ch = getopt(ac, av, "abcdefhinNqs:STtv")) != -1)
 +	while ((ch = getopt(ac, av, "abcdefhinNp:qs:STtv")) != -1)
  		switch (ch) {
  		case 'a':
  			do_acct = 1;
 @@ -306,6 +306,10 @@ ipfw_main(int oldac, char **oldav)
  			co.do_resolv = 1;
  			break;
  
 +		case 'p':
 +			errx(EX_USAGE, "An absolute pathname must be used "
 +			    "with -p option.");
 +
  		case 'q':
  			co.do_quiet = 1;
  			break;
 @@ -603,9 +607,12 @@ main(int ac, char *av[])
  	 * as a file to be preprocessed.
  	 */
  
 -	if (ac > 1 && av[ac - 1][0] == '/' && access(av[ac - 1], R_OK) == 0)
 -		ipfw_readfile(ac, av);
 -	else {
 +	if (ac > 1 && av[ac - 1][0] == '/') {
 +		if (access(av[ac - 1], R_OK) == 0)
 +			ipfw_readfile(ac, av);
 +		else
 +			err(EX_USAGE, "pathname: %s", av[ac - 1]);
 +	} else {
  		if (ipfw_main(ac, av)) {
  			errx(EX_USAGE,
  			    "usage: ipfw [options]\n"
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/156653: commit references a PR
Date: Wed, 13 Jul 2011 04:27:56 +0000 (UTC)

 Author: ae
 Date: Wed Jul 13 04:27:47 2011
 New Revision: 223972
 URL: http://svn.freebsd.org/changeset/base/223972
 
 Log:
   MFC r223661:
     Improve error reporting. Use corresponding error message when file to be
     preprocessed is missing. Also suggest to use absolute pathname if -p
     option is specified.
   
     PR:             bin/156653
 
 Modified:
   stable/8/sbin/ipfw/main.c
 Directory Properties:
   stable/8/sbin/ipfw/   (props changed)
 
 Modified: stable/8/sbin/ipfw/main.c
 ==============================================================================
 --- stable/8/sbin/ipfw/main.c	Wed Jul 13 00:48:36 2011	(r223971)
 +++ stable/8/sbin/ipfw/main.c	Wed Jul 13 04:27:47 2011	(r223972)
 @@ -262,7 +262,7 @@ ipfw_main(int oldac, char **oldav)
  	save_av = av;
  
  	optind = optreset = 1;	/* restart getopt() */
 -	while ((ch = getopt(ac, av, "abcdefhinNqs:STtv")) != -1)
 +	while ((ch = getopt(ac, av, "abcdefhinNp:qs:STtv")) != -1)
  		switch (ch) {
  		case 'a':
  			do_acct = 1;
 @@ -306,6 +306,10 @@ ipfw_main(int oldac, char **oldav)
  			co.do_resolv = 1;
  			break;
  
 +		case 'p':
 +			errx(EX_USAGE, "An absolute pathname must be used "
 +			    "with -p option.");
 +
  		case 'q':
  			co.do_quiet = 1;
  			break;
 @@ -603,9 +607,12 @@ main(int ac, char *av[])
  	 * as a file to be preprocessed.
  	 */
  
 -	if (ac > 1 && av[ac - 1][0] == '/' && access(av[ac - 1], R_OK) == 0)
 -		ipfw_readfile(ac, av);
 -	else {
 +	if (ac > 1 && av[ac - 1][0] == '/') {
 +		if (access(av[ac - 1], R_OK) == 0)
 +			ipfw_readfile(ac, av);
 +		else
 +			err(EX_USAGE, "pathname: %s", av[ac - 1]);
 +	} else {
  		if (ipfw_main(ac, av)) {
  			errx(EX_USAGE,
  			    "usage: ipfw [options]\n"
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: ae 
State-Changed-When: Wed Jul 13 04:31:00 UTC 2011 
State-Changed-Why:  
Merged to stable/7 and stable/8. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=156653 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/156653: commit references a PR
Date: Wed, 13 Jul 2011 04:31:06 +0000 (UTC)

 Author: ae
 Date: Wed Jul 13 04:30:16 2011
 New Revision: 223973
 URL: http://svn.freebsd.org/changeset/base/223973
 
 Log:
   MFC r223661:
     Improve error reporting. Use corresponding error message when file to be
     preprocessed is missing. Also suggest to use absolute pathname if -p
     option is specified.
   
     PR:             bin/156653
 
 Modified:
   stable/7/sbin/ipfw/main.c
 Directory Properties:
   stable/7/sbin/ipfw/   (props changed)
 
 Modified: stable/7/sbin/ipfw/main.c
 ==============================================================================
 --- stable/7/sbin/ipfw/main.c	Wed Jul 13 04:27:47 2011	(r223972)
 +++ stable/7/sbin/ipfw/main.c	Wed Jul 13 04:30:16 2011	(r223973)
 @@ -204,7 +204,7 @@ ipfw_main(int oldac, char **oldav)
  	save_av = av;
  
  	optind = optreset = 1;	/* restart getopt() */
 -	while ((ch = getopt(ac, av, "abcdefhinNqs:STtv")) != -1)
 +	while ((ch = getopt(ac, av, "abcdefhinNp:qs:STtv")) != -1)
  		switch (ch) {
  		case 'a':
  			do_acct = 1;
 @@ -248,6 +248,10 @@ ipfw_main(int oldac, char **oldav)
  			co.do_resolv = 1;
  			break;
  
 +		case 'p':
 +			errx(EX_USAGE, "An absolute pathname must be used "
 +			    "with -p option.");
 +
  		case 'q':
  			co.do_quiet = 1;
  			break;
 @@ -527,9 +531,12 @@ main(int ac, char *av[])
  	 * as a file to be preprocessed.
  	 */
  
 -	if (ac > 1 && av[ac - 1][0] == '/' && access(av[ac - 1], R_OK) == 0)
 -		ipfw_readfile(ac, av);
 -	else {
 +	if (ac > 1 && av[ac - 1][0] == '/') {
 +		if (access(av[ac - 1], R_OK) == 0)
 +			ipfw_readfile(ac, av);
 +		else
 +			err(EX_USAGE, "pathname: %s", av[ac - 1]);
 +	} else {
  		if (ipfw_main(ac, av)) {
  			errx(EX_USAGE,
  			    "usage: ipfw [options]\n"
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
