Bug 183629 - dos2unix erroneously strips \r
dos2unix erroneously strips \r
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: dos2unix (Show other bugs)
2.1
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
Ben Levenson
:
Depends On: 57508
Blocks: 143573
  Show dependency treegraph
 
Reported: 2006-03-02 07:32 EST by Tim Waugh
Modified: 2007-11-30 17:06 EST (History)
1 user (show)

See Also:
Fixed In Version: RHBA-2005-145
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-03-13 15:52:34 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Tim Waugh 2006-03-02 07:32:19 EST
+++ This bug was initially created as a clone of Bug #57508 +++

Description of Problem:

If you give dos2unix a mac file (one where lines are separate by \r alone)
and accidentally ask it to convert in DOS mode, you get a file with no
newlines.

To me this seems like confusing behavior.  I'd prefer it if DOS conversion
mode changed `\r\n' to `\n' -- and left lone `\r's unmodified.  That
would reduce the potential for error.

Version-Release number of selected component (if applicable):

dos2unix 3.1 (Thu Nov 19 1998)

How Reproducible:


Steps to Reproduce:
1. 
2. 
3. 

Actual Results:


Expected Results:


Additional Information:

-- Additional comment from bugs.michael@gmx.net on 2004-09-26 05:16 EST --
Created an attachment (id=104332)
a patch


-- Additional comment from bugs.michael@gmx.net on 2004-09-26 05:47 EST --
Created an attachment (id=104333)
patch (with uneeded lines dropped)

My post to fedora-patch-list bounced, and when I looked at the message, I've
noticed lines in the patch which I should have deleted earlier.


-- Additional comment from riel@redhat.com on 2004-09-26 10:05 EST --
The patch makes sense.  I haven't been able to test it because I have
no mac files here, but the code looks sane.

Mike, want to rebuild the package or should I rebuild it ?

-- Additional comment from bugs.michael@gmx.net on 2004-09-26 14:37 EST --
cat unixfile | tr \\n \\r > macfile


-- Additional comment from bugs.michael@gmx.net on 2004-09-26 15:03 EST --
Created an attachment (id=104335)
final patch

While the unneeded lines in the first patch did no harm (a cut'n'rename
mistake), the second patch lost the line delimiter of the last line when
running mac2unix on a Mac file. A minor detail, easily overlooked when running
tests.

$ cd /tmp
$ cat /etc/services | tr \\n \\r > macfile
$ ls -la macfile
-rw-------  1 misc2 misc2 19936 Sep 26 21:05 macfile
$ dos2unix -c Mac macfile
dos2unix: converting file macfile to UNIX format ...
$ ls -la macfile
-rw-------  1 misc2 misc2 19936 Sep 26 21:06 macfile
$ cat macfile | tr \\r \\n > unixfile
$ md5sum unixfile /etc/services
485eacadb2a1d18fcf66483f81829f02  unixfile
485eacadb2a1d18fcf66483f81829f02  /etc/services

[size and checksum stay the same]


-- Additional comment from riel@redhat.com on 2004-09-26 17:19 EST --
Patch applied in dos2unix-3.1-19

-- Additional comment from timp@redhat.com on 2005-05-19 20:35 EST --

An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2005-195.html
Comment 4 Red Hat Bugzilla 2006-03-13 15:52:35 EST
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2005-145.html

Note You need to log in before you can comment on or make changes to this bug.