tar fails with some combinations of line ending and binmode setting

David Mastronarde mast@colorado.edu
Mon Feb 20 17:44:00 GMT 2006



On Mon, 20 Feb 2006, Eric Blake wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> According to David Mastronarde on 2/18/2006 10:55 PM:
>>
>> With CYGWIN set to binmode, tar fails on the archive of DOS files
>> created under nobinmode.
>>
>> With CYGWIN set to nobinmode, tar fails on the archives of DOS files
>> created under either mode.
>>
>> This happens on both a Windows 2000 machine with cygwin 1.5.19-4 and
>> a Windows XP machine with 1.5.18-1.
>>
>> In fact, the archive of DOS files created under nobinmode must be bad
>> since it fails to untar under Linux and OSX also.  All the other
>> archives are OK by this test.
>
> Well, nobinmode is documented as opening pipes in text mode
> (http://cygwin.com/cygwin-ug-net/using-cygwinenv.html), and tar uses a
> pipe to the compression program, so I'm not surprised (text mode has the
> nasty habit of corrupting binary data, and tar uses binary data).  I
> personally never use nobinmode (making pipes non-binary is just ASKING for
> problems, as you just proved), but I will see about trying to pinpoint yet
> one more location in tar where I should consider forcing binary mode.  But
> don't expect it to be my highest priority - you should be using binmode
> (or nothing at all, since $CYGWIN defaults to binmode).
>

Thanks for the explanation. It makes some sense once you realize a pipe is 
involved, but from a user standpoint it seems wrong for tar to try to do 
any conversions to the data.  I agree that nobinmode is problematic.  I 
considered using it because a bunch of my cshell scripts broke with the 
latest version of sed, which it started passing Ctrl-M's piped to it 
from program output.  Setting nobinmode was a potential workaround, 
but I decided it was better just to fix the scripts to filter the 
Ctrl-M's.

>>
>> tar                  1.15.1-2
>
> BTW, tar is at 1.15.1-3, consider upgrading (although it won't help for
> your particular testcase).
>
> - --
> Life is short - so eat dessert first!
>
> Eric Blake             ebb9@byu.net
> volunteer cygwin tar maintainer
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (Cygwin)
> Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
>
> iD8DBQFD+fid84KuGfSFAYARApHWAJ4yAC0wIf/InE8sCLbc92nE4oIJXwCfQVcZ
> 4AqufY340uhBuK/QIeVHcFU=
> =jhnP
> -----END PGP SIGNATURE-----
>

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list