From jaakko@saunalahti.fi  Thu Jun 12 16:13:07 2008
Return-Path: <jaakko@saunalahti.fi>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A527B1065674
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 12 Jun 2008 16:13:07 +0000 (UTC)
	(envelope-from jaakko@saunalahti.fi)
Received: from gw02.mail.saunalahti.fi (gw02.mail.saunalahti.fi [195.197.172.116])
	by mx1.freebsd.org (Postfix) with ESMTP id 681888FC1B
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 12 Jun 2008 16:13:07 +0000 (UTC)
	(envelope-from jaakko@saunalahti.fi)
Received: from ws64.jh.dy.fi (a91-153-120-204.elisa-laajakaista.fi [91.153.120.204])
	by gw02.mail.saunalahti.fi (Postfix) with ESMTP id D81D4139B69
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 12 Jun 2008 18:54:32 +0300 (EEST)
Received: from ws64.jh.dy.fi (localhost [127.0.0.1])
	by ws64.jh.dy.fi (8.14.2/8.14.2) with ESMTP id m5CFsWd6004536
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 12 Jun 2008 18:54:32 +0300 (EEST)
	(envelope-from jaakko@ws64.jh.dy.fi)
Received: (from jaakko@localhost)
	by ws64.jh.dy.fi (8.14.2/8.14.2/Submit) id m5CFsWw8004535;
	Thu, 12 Jun 2008 18:54:32 +0300 (EEST)
	(envelope-from jaakko)
Message-Id: <200806121554.m5CFsWw8004535@ws64.jh.dy.fi>
Date: Thu, 12 Jun 2008 18:54:32 +0300 (EEST)
From: Jaakko Heinonen <jh@saunalahti.fi>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [patch] cdcontrol(1) doesn't print all error messages in non-interactive mode
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         124517
>Category:       bin
>Synopsis:       [patch] cdcontrol(1) doesn't print all error messages in non-interactive mode
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    jh
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 12 16:20:02 UTC 2008
>Closed-Date:    Fri Apr 02 09:29:54 UTC 2010
>Last-Modified:  Fri Apr 02 09:29:54 UTC 2010
>Originator:     Jaakko Heinonen
>Release:        FreeBSD 7.0-STABLE amd64
>Organization:
>Environment:
System: FreeBSD x 7.0-STABLE FreeBSD 7.0-STABLE #0: Wed Jun 11 19:18:10 EEST 2008 x:X amd64


	
>Description:
Some error messages are printed only in interactive mode.
>How-To-Repeat:
(No CD in drive)

$ cdcontrol 
Compact Disc Control utility, version 2.0
Type `?' for command list

cdcontrol> play 1
cdcontrol: Input/output error
cdcontrol> ^D
$ cdcontrol play 1
$

After applying the patch attached to this PR:

$ cdcontrol play 1
cdcontrol: Input/output error
$
>Fix:

--- cdcontrol-error-reporting.diff begins here ---
Index: usr.sbin/cdcontrol/cdcontrol.c
===================================================================
--- usr.sbin/cdcontrol/cdcontrol.c	(revision 179721)
+++ usr.sbin/cdcontrol/cdcontrol.c	(working copy)
@@ -228,7 +228,7 @@ int main (int argc, char **argv)
 
 	if (argc > 0) {
 		char buf[80], *p;
-		int len;
+		int len, rc;
 
 		for (p=buf; argc-->0; ++argv) {
 			len = strlen (*argv);
@@ -244,7 +244,10 @@ int main (int argc, char **argv)
 		}
 		*p = 0;
 		arg = parse (buf, &cmd);
-		return (run (cmd, arg));
+		if ((rc = run (cmd, arg)) < 0 && verbose)
+			warn(NULL);
+
+		return (rc);
 	}
 
 	if (verbose == 1)
--- cdcontrol-error-reporting.diff ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->jh 
Responsible-Changed-By: jh 
Responsible-Changed-When: Tue Oct 6 15:20:05 UTC 2009 
Responsible-Changed-Why:  
Take. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=124517 
State-Changed-From-To: open->patched 
State-Changed-By: jh 
State-Changed-When: Wed Oct 7 13:27:34 UTC 2009 
State-Changed-Why:  
Patched in head (r197833). 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/124517: commit references a PR
Date: Wed,  7 Oct 2009 13:25:39 +0000 (UTC)

 Author: jh
 Date: Wed Oct  7 13:25:22 2009
 New Revision: 197833
 URL: http://svn.freebsd.org/changeset/base/197833
 
 Log:
   When run() returns an error, print the error message also in
   non-interactive mode. Previously error messages were printed only in
   interactive mode.
   
   PR:		bin/124517
   Approved by:	trasz (mentor)
   MFC after:	1 month
 
 Modified:
   head/usr.sbin/cdcontrol/cdcontrol.c
 
 Modified: head/usr.sbin/cdcontrol/cdcontrol.c
 ==============================================================================
 --- head/usr.sbin/cdcontrol/cdcontrol.c	Wed Oct  7 13:12:43 2009	(r197832)
 +++ head/usr.sbin/cdcontrol/cdcontrol.c	Wed Oct  7 13:25:22 2009	(r197833)
 @@ -241,7 +241,7 @@ int main (int argc, char **argv)
  
  	if (argc > 0) {
  		char buf[80], *p;
 -		int len;
 +		int len, rc;
  
  		for (p=buf; argc-->0; ++argv) {
  			len = strlen (*argv);
 @@ -257,7 +257,11 @@ int main (int argc, char **argv)
  		}
  		*p = 0;
  		arg = parse (buf, &cmd);
 -		return (run (cmd, arg));
 +		rc = run (cmd, arg);
 +		if (rc < 0 && verbose)
 +			warn(NULL);
 +
 +		return (rc);
  	}
  
  	if (verbose == 1)
 _______________________________________________
 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/124517: commit references a PR
Date: Wed, 11 Nov 2009 19:51:02 +0000 (UTC)

 Author: jh
 Date: Wed Nov 11 19:50:52 2009
 New Revision: 199194
 URL: http://svn.freebsd.org/changeset/base/199194
 
 Log:
   MFC r197833:
   
   When run() returns an error, print the error message also in
   non-interactive mode. Previously error messages were printed only in
   interactive mode.
   
   PR:		bin/124517
   Approved by:	trasz (mentor)
 
 Modified:
   stable/8/usr.sbin/cdcontrol/cdcontrol.c
 Directory Properties:
   stable/8/usr.sbin/cdcontrol/   (props changed)
 
 Modified: stable/8/usr.sbin/cdcontrol/cdcontrol.c
 ==============================================================================
 --- stable/8/usr.sbin/cdcontrol/cdcontrol.c	Wed Nov 11 19:39:45 2009	(r199193)
 +++ stable/8/usr.sbin/cdcontrol/cdcontrol.c	Wed Nov 11 19:50:52 2009	(r199194)
 @@ -241,7 +241,7 @@ int main (int argc, char **argv)
  
  	if (argc > 0) {
  		char buf[80], *p;
 -		int len;
 +		int len, rc;
  
  		for (p=buf; argc-->0; ++argv) {
  			len = strlen (*argv);
 @@ -257,7 +257,11 @@ int main (int argc, char **argv)
  		}
  		*p = 0;
  		arg = parse (buf, &cmd);
 -		return (run (cmd, arg));
 +		rc = run (cmd, arg);
 +		if (rc < 0 && verbose)
 +			warn(NULL);
 +
 +		return (rc);
  	}
  
  	if (verbose == 1)
 _______________________________________________
 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/124517: commit references a PR
Date: Fri,  2 Apr 2010 08:57:50 +0000 (UTC)

 Author: jh
 Date: Fri Apr  2 08:57:39 2010
 New Revision: 206085
 URL: http://svn.freebsd.org/changeset/base/206085
 
 Log:
   MFC r197833:
   
   When run() returns an error, print the error message also in
   non-interactive mode. Previously error messages were printed only in
   interactive mode.
   
   PR:		bin/124517
 
 Modified:
   stable/7/usr.sbin/cdcontrol/cdcontrol.c
 Directory Properties:
   stable/7/usr.sbin/cdcontrol/   (props changed)
 
 Modified: stable/7/usr.sbin/cdcontrol/cdcontrol.c
 ==============================================================================
 --- stable/7/usr.sbin/cdcontrol/cdcontrol.c	Fri Apr  2 08:55:10 2010	(r206084)
 +++ stable/7/usr.sbin/cdcontrol/cdcontrol.c	Fri Apr  2 08:57:39 2010	(r206085)
 @@ -241,7 +241,7 @@ int main (int argc, char **argv)
  
  	if (argc > 0) {
  		char buf[80], *p;
 -		int len;
 +		int len, rc;
  
  		for (p=buf; argc-->0; ++argv) {
  			len = strlen (*argv);
 @@ -257,7 +257,11 @@ int main (int argc, char **argv)
  		}
  		*p = 0;
  		arg = parse (buf, &cmd);
 -		return (run (cmd, arg));
 +		rc = run (cmd, arg);
 +		if (rc < 0 && verbose)
 +			warn(NULL);
 +
 +		return (rc);
  	}
  
  	if (verbose == 1)
 _______________________________________________
 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: jh 
State-Changed-When: Fri Apr 2 09:29:53 UTC 2010 
State-Changed-Why:  
Fixed in head, stable/8, and stable/7. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=124517 
>Unformatted:
