This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem with Text mounts after updating using setup.exe


On Wed, 15 Aug 2007, Bart van der Werf wrote:

> After upgrading cygwin some of my textmode mount files started to have
> additional 0x0d characters.
>
> Example of problem.
>
> With a file test.txt
>
> $ od -t x1 test.txt
> 0000000 61 0d 0a 62 0d 0a 63 0d 0a
> 0000011
>
> with dos style newlines.
>
> $ grep a test.txt > test2.txt
>
> If i invoke grep on this file, i get the problem that it duplicates the
> 0x0d
>
> $ od -t x1 test2.txt
> 0000000 61 0d 0d 0a
> 0000004
>
> I started getting this problem after running setup.exe this week.
>
> The version of cygwin before the upgrade was atleast a year old.
>
> What should i do ?
> Do i need to provide additional information ?
>
> I wouldn't expect an additional 0x0d even if the mount was in binmode.

You won't get them on a binmode mount.  Looks like grep opens the input
and output in binmode.  The shell redirection opens the output in the mode
of the mount where the output is to be placed.  Thus, grep prints out the
full input string (including the CR) and the shell happily prepends
another CR to the LF.

A workaround would be to put the output file on a binmode mount.  Another
thing that *might* work is using input redirection as well as output
(i.e., "grep a < test.txt > test2.txt").

FWIW, I can't reproduce this with grep-2.5.1a-2, which means this behavior
was introduced in -4.
HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Belief can be manipulated.  Only knowledge is dangerous.  -- Frank Herbert

--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]