From nobody@FreeBSD.org  Thu Jan 22 06:00:12 2009
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 F367F1065670
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 22 Jan 2009 06:00:11 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id D8EDA8FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 22 Jan 2009 06:00:11 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n0M60AOH006715
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 22 Jan 2009 06:00:10 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n0M60ARB006714;
	Thu, 22 Jan 2009 06:00:10 GMT
	(envelope-from nobody)
Message-Id: <200901220600.n0M60ARB006714@www.freebsd.org>
Date: Thu, 22 Jan 2009 06:00:10 GMT
From: Tri Brotoharsono <tbh@ittelkom.ac.id>
To: freebsd-gnats-submit@FreeBSD.org
Subject: /bin/dd if=/dev/acd0 returned error "invalid parameter"
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         130857
>Category:       bin
>Synopsis:       [patch] dd(1): /bin/dd if=/dev/acd0 returned error "invalid parameter"
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    keramida
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 22 06:10:03 UTC 2009
>Closed-Date:    Fri Jan 30 16:33:54 UTC 2009
>Last-Modified:  Fri Jan 30 16:40:04 UTC 2009
>Originator:     Tri Brotoharsono
>Release:        FreeBSD i386 7-STABLE
>Organization:
IT Telkom
>Environment:
FreeBSD broto.stttelkom.ac.id 7.1-STABLE FreeBSD 7.1-STABLE #6: Wed Jan 21 13:22:21 WIT 2009     broto@broto.stttelkom.ac.id:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
Invoking command /bin/dd with input file CDROM device file returned invalid parameter

Example:
# dd if=/dev/acd0 of=dd.iso
dd: /dev/acd0: Invalid argument
0+0 records in
0+0 records out
0 bytes transferred in 0.000080 secs (0 bytes/sec)
#

>How-To-Repeat:
dd if=/dev/acd0 of=<output file>

>Fix:
cd /usr/src/bin/dd
patch < /path/to/patchfile
make install


Patch attached with submission follows:

--- dd.c	2009-01-22 12:27:26.000000000 +0700
+++ dd.c.orig	2009-01-22 12:27:17.000000000 +0700
@@ -121,7 +121,7 @@
 		in.name = "stdin";
 		in.fd = STDIN_FILENO;
 	} else {
-		in.fd = open(in.name, O_RDONLY);
+		in.fd = open(in.name, O_RDONLY, 0);
 		if (in.fd == -1)
 			err(1, "%s", in.name);
 	}


>Release-Note:
>Audit-Trail:

From: Giorgos Keramidas <keramida@freebsd.org>
To: Tri Brotoharsono <tbh@ittelkom.ac.id>
Cc: bug-followup@freebsd.org
Subject: Re: bin/130857: /bin/dd if=/dev/acd0 returned error "invalid parameter"
Date: Thu, 22 Jan 2009 08:37:52 +0200

 On Thu, 22 Jan 2009 06:00:10 GMT, Tri Brotoharsono <tbh@ittelkom.ac.id> wrote:
 > Invoking command /bin/dd with input file CDROM device file returned invalid parameter
 >
 > Example:
 > # dd if=/dev/acd0 of=dd.iso
 > dd: /dev/acd0: Invalid argument
 > 0+0 records in
 > 0+0 records out
 > 0 bytes transferred in 0.000080 secs (0 bytes/sec)
 > #
 
 > --- dd.c	2009-01-22 12:27:26.000000000 +0700
 > +++ dd.c.orig	2009-01-22 12:27:17.000000000 +0700
 > @@ -121,7 +121,7 @@
 >  		in.name = "stdin";
 >  		in.fd = STDIN_FILENO;
 >  	} else {
 > -		in.fd = open(in.name, O_RDONLY);
 > +		in.fd = open(in.name, O_RDONLY, 0);
 >  		if (in.fd == -1)
 >  			err(1, "%s", in.name);
 >  	}
 
 Are you sure this fixes the problem?  I seem to recall audio CD-ROMs
 needs a different block size in dd.  Maybe this is why the original
 invocation failed?
 

From: Giorgos Keramidas <keramida@freebsd.org>
To: Tri Brotoharsono <mail@tribrotoharsono.net>
Cc: bug-followup@freebsd.org
Subject: Re: bin/130857: /bin/dd if=/dev/acd0 returned error "invalid  parameter"
Date: Thu, 22 Jan 2009 22:05:31 +0200

 On Thu, 22 Jan 2009 14:22:09 +0700, Tri Brotoharsono <mail@tribrotoharsono.net> wrote:
 > Giorgos Keramidas wrote:
 > : :
 > : : Invoking command /bin/dd with input file CDROM device file returned
 > : : invalid parameter
 > : :
 > : : Example:
 > : : # dd if=/dev/acd0 of=dd.iso
 > : : dd: /dev/acd0: Invalid argument
 > : : 0+0 records in
 > : : 0+0 records out
 > : : 0 bytes transferred in 0.000080 secs (0 bytes/sec)
 > : : #
 > : :
 > : :
 > : : --- dd.c    2009-01-22 12:27:26.000000000 +0700
 > : : +++ dd.c.orig    2009-01-22 12:27:17.000000000 +0700
 > : : @@ -121,7 +121,7 @@
 > : :          in.name = "stdin";
 > : :          in.fd = STDIN_FILENO;
 > : :      } else {
 > : : -        in.fd = open(in.name, O_RDONLY);
 > : : +        in.fd = open(in.name, O_RDONLY, 0);
 > : :          if (in.fd == -1)
 > : :              err(1, "%s", in.name);
 > : :      }
 > :
 > : Are you sure this fixes the problem?  I seem to recall audio CD-ROMs
 > : needs a different block size in dd.  Maybe this is why the original
 > : invocation failed?
 >
 > Oh, my mistake. You are right. I am not noticed my bs=2048 parameter,
 > without bs=2048 still returned error, I think the differences with man
 > open(2) which triggered this error.
 
 Hi Tri,
 
 So, if you use the patched dd version with open(in.name, O_RDONLY, 0)
 then the bs=2048 is not needed, and dd works with your CD-ROM disk?
 
 That would be a bit odd.
 
 > Note: Sorry replying with this address, but my original address denied
 > by mx1.freebsd.org due misconfiguration at my mail server.
 
 That's fine, don't worry about it.  As long as the subject is there and
 we can correlate the message with the original bug, all is well.
 
   * If you still think we should patch dd with the change, let me know.
 
   * If you think it's ok to leave it unmodified, and use bs=2048 should
     be recommended, we can document this in the manpage and close the
     problem report.
 
 How should we proceed with this?
 

From: Giorgos Keramidas <keramida@freebsd.org>
To: Tri Brotoharsono <mail@tribrotoharsono.net>
Cc: bug-followup@freebsd.org
Subject: Re: bin/130857: /bin/dd if=/dev/acd0 returned error "invalid  parameter"
Date: Fri, 23 Jan 2009 05:24:45 +0200

 On Fri, 23 Jan 2009 09:45:46 +0700, Tri Brotoharsono <mail@tribrotoharsono.net> wrote:
 > Giorgos Keramidas wrote:
 > : So, if you use the patched dd version with open(in.name, O_RDONLY, 0)
 > : then the bs=2048 is not needed, and dd works with your CD-ROM disk?
 >
 > No
 >
 > : That would be a bit odd.
 > :
 > : Note: Sorry replying with this address, but my original address denied
 > : by mx1.freebsd.org due misconfiguration at my mail server.
 > :
 > : That's fine, don't worry about it.  As long as the subject is there and
 > : we can correlate the message with the original bug, all is well.
 > :
 > :  * If you still think we should patch dd with the change, let me know.
 > :
 > :  * If you think it's ok to leave it unmodified, and use bs=2048 should
 > :    be recommended, we can document this in the manpage and close the
 > :    problem report.
 > :
 > : How should we proceed with this?
 >
 > leave unmodified, recommend  bs=2048 in the manpage
 
 Does the following patch to the EXAMPLES section look ok?
 
 I can commit it to the manpage when we shape it to look acceptable.
 After the patch is applied, the example looks like this:
 
     EXAMPLES
          Check that a disk drive contains no bad blocks:
 
          [...]
 
          To create an image of a Mode-1 CD-ROM, which is commonly
          used for data CD-ROM disks, use a block size of 2048 bytes:
 
                dd if=/dev/acd0 of=filename.iso bs=2048
 
     SEE ALSO
          [...]
 
 Here's the patch and the proposed commit log...
 
 ----- 20090123T031913+0000-dd-cdrom.diff patch starts here -----
 
 Add an example of using bs=2048 to duplicate data CD-ROMs.
 
 This should be a bit useful for users who look at the manpage and
 then try to copy data CD-ROM disks using dd.  A lot of us know
 that bs=2048 is required, but it still manages to cause a bit of
 grief to those who haven't heard about it.
 
 PR:		bin/130857
 Submitted by:	Tri Brotoharsono < mail at tribrotoharsono.net >
 
 diff -r ce5936bddb83 -r dfbd83a06fcf bin/dd/dd.1
 --- a/bin/dd/dd.1	Fri Jan 23 01:34:58 2009 +0200
 +++ b/bin/dd/dd.1	Fri Jan 23 05:18:11 2009 +0200
 @@ -392,6 +392,11 @@
  Check for (even) parity errors on a file:
  .Pp
  .Dl "dd if=file conv=pareven | cmp -x - file"
 +.Pp
 +To create an image of a Mode-1 CD-ROM, which is a commonly used format
 +for data CD-ROM disks, use a block size of 2048 bytes:
 +.Pp
 +.Dl "dd if=/dev/acd0 of=filename.iso bs=2048"
  .Sh SEE ALSO
  .Xr cp 1 ,
  .Xr mt 1 ,
 
 ----- 20090123T031913+0000-dd-cdrom.diff patch ends here -----
State-Changed-From-To: open->patched 
State-Changed-By: keramida 
State-Changed-When: Fri Jan 23 03:47:03 UTC 2009 
State-Changed-Why:  
I've committed the patch to /head.  Thanks :) 


Responsible-Changed-From-To: freebsd-bugs->keramida 
Responsible-Changed-By: keramida 
Responsible-Changed-When: Fri Jan 23 03:47:03 UTC 2009 
Responsible-Changed-Why:  
Mark for MFC to the stable branches after a few days. 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/130857: commit references a PR
Date: Fri, 23 Jan 2009 03:46:54 +0000 (UTC)

 Author: keramida (doc committer)
 Date: Fri Jan 23 03:46:44 2009
 New Revision: 187609
 URL: http://svn.freebsd.org/changeset/base/187609
 
 Log:
   Add an example of using bs=2048 to duplicate data CD-ROMs.
   
   This should be a bit useful for users who look at the manpage and
   then try to copy data CD-ROM disks using dd.  A lot of us know
   that bs=2048 is required, but it still manages to cause a bit of
   grief to those who haven't heard about it.
   
   PR:		bin/130857
   Submitted by:	Tri Brotoharsono < mail at tribrotoharsono.net >
   MFC after:	3 days
 
 Modified:
   head/bin/dd/dd.1
 
 Modified: head/bin/dd/dd.1
 ==============================================================================
 --- head/bin/dd/dd.1	Fri Jan 23 03:15:28 2009	(r187608)
 +++ head/bin/dd/dd.1	Fri Jan 23 03:46:44 2009	(r187609)
 @@ -392,6 +392,11 @@ Remove parity bit from a file:
  Check for (even) parity errors on a file:
  .Pp
  .Dl "dd if=file conv=pareven | cmp -x - file"
 +.Pp
 +To create an image of a Mode-1 CD-ROM, which is a commonly used format
 +for data CD-ROM disks, use a block size of 2048 bytes:
 +.Pp
 +.Dl "dd if=/dev/acd0 of=filename.iso bs=2048"
  .Sh SEE ALSO
  .Xr cp 1 ,
  .Xr mt 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/130857: commit references a PR
Date: Fri, 30 Jan 2009 16:28:53 +0000 (UTC)

 Author: keramida (doc committer)
 Date: Fri Jan 30 16:28:32 2009
 New Revision: 187923
 URL: http://svn.freebsd.org/changeset/base/187923
 
 Log:
   MFC 187922,187609 from /head
   
     Add an example of using bs=2048 to duplicate data CD-ROMs.
   
     This should be a bit useful for users who look at the manpage and
     then try to copy data CD-ROM disks using dd.  A lot of us know
     that bs=2048 is required, but it still manages to cause a bit of
     grief to those who haven't heard about it.
   
     PR:             bin/130857
     Submitted by:   Tri Brotoharsono < mail at tribrotoharsono.net >
 
 Modified:
   stable/7/bin/dd/   (props changed)
   stable/7/bin/dd/dd.1
 
 Modified: stable/7/bin/dd/dd.1
 ==============================================================================
 --- stable/7/bin/dd/dd.1	Fri Jan 30 16:23:57 2009	(r187922)
 +++ stable/7/bin/dd/dd.1	Fri Jan 30 16:28:32 2009	(r187923)
 @@ -32,7 +32,7 @@
  .\"     @(#)dd.1	8.2 (Berkeley) 1/13/94
  .\" $FreeBSD$
  .\"
 -.Dd August 15, 2004
 +.Dd January 23, 2009
  .Dt DD 1
  .Os
  .Sh NAME
 @@ -392,6 +392,11 @@ Remove parity bit from a file:
  Check for (even) parity errors on a file:
  .Pp
  .Dl "dd if=file conv=pareven | cmp -x - file"
 +.Pp
 +To create an image of a Mode-1 CD-ROM, which is a commonly used format
 +for data CD-ROM disks, use a block size of 2048 bytes:
 +.Pp
 +.Dl "dd if=/dev/acd0 of=filename.iso bs=2048"
  .Sh SEE ALSO
  .Xr cp 1 ,
  .Xr mt 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: keramida 
State-Changed-When: Fri Jan 30 16:32:38 UTC 2009 
State-Changed-Why:  
Merged to stable/6 and stable/7 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/130857: commit references a PR
Date: Fri, 30 Jan 2009 16:33:17 +0000 (UTC)

 Author: keramida (doc committer)
 Date: Fri Jan 30 16:32:26 2009
 New Revision: 187924
 URL: http://svn.freebsd.org/changeset/base/187924
 
 Log:
   MFC 187922,187609 from /head
   
     Add an example of using bs=2048 to duplicate data CD-ROMs.
   
     This should be a bit useful for users who look at the manpage and
     then try to copy data CD-ROM disks using dd.  A lot of us know
     that bs=2048 is required, but it still manages to cause a bit of
     grief to those who haven't heard about it.
   
     PR:             bin/130857
     Submitted by:   Tri Brotoharsono < mail at tribrotoharsono.net >
 
 Modified:
   stable/6/bin/dd/   (props changed)
   stable/6/bin/dd/dd.1
 
 Modified: stable/6/bin/dd/dd.1
 ==============================================================================
 --- stable/6/bin/dd/dd.1	Fri Jan 30 16:28:32 2009	(r187923)
 +++ stable/6/bin/dd/dd.1	Fri Jan 30 16:32:26 2009	(r187924)
 @@ -32,7 +32,7 @@
  .\"     @(#)dd.1	8.2 (Berkeley) 1/13/94
  .\" $FreeBSD$
  .\"
 -.Dd August 15, 2004
 +.Dd January 23, 2009
  .Dt DD 1
  .Os
  .Sh NAME
 @@ -392,6 +392,11 @@ Remove parity bit from a file:
  Check for (even) parity errors on a file:
  .Pp
  .Dl "dd if=file conv=pareven | cmp -x - file"
 +.Pp
 +To create an image of a Mode-1 CD-ROM, which is a commonly used format
 +for data CD-ROM disks, use a block size of 2048 bytes:
 +.Pp
 +.Dl "dd if=/dev/acd0 of=filename.iso bs=2048"
  .Sh SEE ALSO
  .Xr cp 1 ,
  .Xr mt 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"
 
>Unformatted:
