From vd@datamax.bg  Thu May  5 09:26:38 2005
Return-Path: <vd@datamax.bg>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 7462016A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  5 May 2005 09:26:38 +0000 (GMT)
Received: from jengal.datamax.bg (jengal.datamax.bg [82.103.104.21])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 1BCFC43D7B
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  5 May 2005 09:26:38 +0000 (GMT)
	(envelope-from vd@datamax.bg)
Received: from sinanica.bg.datamax (sinanica.bg.datamax [192.168.10.1])
	by jengal.datamax.bg (Postfix) with QMQP id 34B8C87E3
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  5 May 2005 12:26:32 +0300 (EEST)
Received: (nullmailer pid 15684 invoked by uid 1004);
	Thu, 05 May 2005 09:26:32 -0000
Message-Id: <20050505092632.GA15619@sinanica.bg.datamax>
Date: Thu, 5 May 2005 12:26:32 +0300
From: Vasil Dimov <vd@datamax.bg>
Reply-To: vd@datamax.bg
To: FreeBSD-gnats-submit@freebsd.org
Subject: Wrong sed arguments in command for CRLF->LF conversion in porters-handbook
X-Send-Pr-Version: 3.113

>Number:         80650
>Category:       docs
>Synopsis:       Wrong sed arguments in command for CRLF->LF conversion in porters-handbook
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    keramida
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 05 09:30:02 GMT 2005
>Closed-Date:    Thu May 05 11:15:09 GMT 2005
>Last-Modified:  Thu May 05 11:15:09 GMT 2005
>Originator:     Vasil Dimov
>Release:        FreeBSD 5.4-STABLE i386
>Organization:
DataMax
>Environment:

System: FreeBSD sinanica.bg.datamax 5.4-STABLE FreeBSD 5.4-STABLE #5: Mon Apr 11 14:07:32 EEST 2005     root@sinanica.bg.datamax:/usr/obj/usr/src/sys/SINANICA-SMP  i386

>Description:

The command given in the "4.4 Patching" chapter of the porters-handbook
as a way to convert CRLF line endings (dos format) to LF (unix) uses
sed's -e argument when it is not needed (only one sed command) and
misses -E argument when it is needed to interpret the regexp
as an extended regular expression.

NOTE: this patch assumes patch from docs/80649 is already applied.

>How-To-Repeat:

>Fix:

--- en_US.ISO8859-1/books/porters-handbook/book.sgml.orig	Thu May  5 12:18:55 2005
+++ en_US.ISO8859-1/books/porters-handbook/book.sgml	Thu May  5 12:19:01 2005
@@ -694,7 +694,7 @@
 
 post-extract:
 	@${FIND} -E ${WRKDIR} -type f -iregex ".*\.(c|cpp|h|txt)" -print0 | \
-		${XARGS} -0 ${REINPLACE_CMD} -e 's/[[:cntrl:]]*$$//'</programlisting>
+		${XARGS} -0 ${REINPLACE_CMD} -E 's/[[:cntrl:]]*$$//'</programlisting>
 
 	<para>Of course, if you need to process each and every file,
 	  <option>-iregex</option> above can be omitted.  Be aware that this
>Release-Note:
>Audit-Trail:

From: Giorgos Keramidas <keramida@freebsd.org>
To: Vasil Dimov <vd@datamax.bg>
Cc: bug-followup@freebsd.org
Subject: Re: docs/80650: Wrong sed arguments in command for CRLF->LF conversion in porters-handbook
Date: Thu, 5 May 2005 12:57:55 +0300

 On 2005-05-05 12:26, Vasil Dimov <vd@datamax.bg> wrote:
 > The command given in the "4.4 Patching" chapter of the
 > porters-handbook as a way to convert CRLF line endings
 > (dos format) to LF (unix) uses sed's -e argument when
 > it is not needed (only one sed command) and misses -E 
 > argument when it is needed to interpret the regexp as
 > an extended regular expression.
 
 > --- en_US.ISO8859-1/books/porters-handbook/book.sgml.orig	Thu May  5 12:18:55 2005
 > +++ en_US.ISO8859-1/books/porters-handbook/book.sgml	Thu May  5 12:19:01 2005
 > @@ -694,7 +694,7 @@
 >  
 >  post-extract:
 >  	@${FIND} -E ${WRKDIR} -type f -iregex ".*\.(c|cpp|h|txt)" -print0 | \
 > -		${XARGS} -0 ${REINPLACE_CMD} -e 's/[[:cntrl:]]*$$//'</programlisting>
 > +		${XARGS} -0 ${REINPLACE_CMD} -E 's/[[:cntrl:]]*$$//'</programlisting>
 
 This is not an extended RE and, in my opinion, it's better to be safe
 than sorry.  We are using a long and somewhat complex command as an
 example, which some Unix newcomers may find instructive.  In this case,
 I vote for clarity instead of the dubious brevity we get by deleting
 just a short single-letter option :-)
 

From: Vasil Dimov <vd@datamax.bg>
To: Giorgos Keramidas <keramida@freebsd.org>
Cc: bug-followup@freebsd.org
Subject: Re: docs/80650: Wrong sed arguments in command for CRLF->LF conversion in porters-handbook
Date: Thu, 5 May 2005 13:18:29 +0300

 I forgot to mention that the command does not convert line endings
 if used without -E

From: Giorgos Keramidas <keramida@freebsd.org>
To: Vasil Dimov <vd@datamax.bg>
Cc: bug-followup@freebsd.org
Subject: Re: docs/80650: Wrong sed arguments in command for CRLF->LF conversion in porters-handbook
Date: Thu, 5 May 2005 13:37:40 +0300

 On 2005-05-05 13:18, Vasil Dimov <vd@datamax.bg> wrote:
 > I forgot to mention that the command does not convert line endings
 > if used without -E
 
 It works fine here:
 
     # echo -e 'foo\015' | cat -vte
     foo^M$
     # echo -e 'foo\015' | sed -e 's/[[:cntrl:]]*$//' | cat -vte
     foo$
     #
 
 Pleae note that the example in the porters-handbook is meant to be a
 Makefile snippet, so the dollar (`$') character is doubled (because of
 the way make(1) handles dollar signs in makefiles).
 
 If you test this on a shell's command line, replace '$$' with '$' in the
 regexp, as I did above.
 

From: Vasil Dimov <vd@datamax.bg>
To: Giorgos Keramidas <keramida@freebsd.org>
Cc: bug-followup@freebsd.org
Subject: Re: docs/80650: Wrong sed arguments in command for CRLF->LF conversion in porters-handbook
Date: Thu, 5 May 2005 14:08:11 +0300

 On Thu, May 05, 2005 at 01:37:40PM +0300, Giorgos Keramidas wrote:
 > Pleae note that the example in the porters-handbook is meant to be a
 > Makefile snippet, so the dollar (`$') character is doubled (because of
 > the way make(1) handles dollar signs in makefiles).
 
 Yes, of-course. I just cut-pasted the RE on the command line without
 looking at it.
 
 This PR should be closed.
State-Changed-From-To: open->closed 
State-Changed-By: keramida 
State-Changed-When: Thu May 5 11:13:42 GMT 2005 
State-Changed-Why:  
Closed at submitter's request.  Even though this wasn't committed, 
thanks for your efforts to improve our docs.  Keep it up :-) 


Responsible-Changed-From-To: freebsd-doc->keramida 
Responsible-Changed-By: keramida 
Responsible-Changed-When: Thu May 5 11:13:42 GMT 2005 
Responsible-Changed-Why:  

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