www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/05/06/22:34:39

From: drupp AT cs DOT washington DOT edu (Douglas Rupp)
Message-Id: <199605070233.TAA11024@june.cs.washington.edu>
Subject: Re: Patch bug
To: eliz AT is DOT elta DOT co DOT il (Eli Zaretskii)
Date: Mon, 6 May 1996 19:33:44 -0700 (PDT)
Cc: drupp AT cs DOT washington DOT edu, djgpp-workers AT delorie DOT com
In-Reply-To: <Pine.SUN.3.91.960505144946.11941U-100000@is> from "Eli Zaretskii" at May 5, 96 02:57:06 pm
MIME-Version: 1.0

> 
> > I've noticed that patch doesn't open files in O_BINARY mode.  I
> > think it should.  When trying to patch Unix style files with Unix style
> > patches, the first patch works fine but the file gets written out in
> > DOS text style.  Then if a second Unix style patch is applied, it messes up
> > because of the mis-match.
> 
> But AFAIK patch only knows about line numbers, not byte offsets, so how
> can extra CR characters mess it up?  Are you sure you use the latest
> version of `patch'?  A bug in `fseek' and `ftell' in the initial release
> of v2.0 made `patch' buggy; please get the latest version of pat21b.zip,
> dated 22-Feb-96 or later and try it. 

I build patch from pat21s.zip and it messed up.

> 
> If that also doesn't work, please post an example of file and a 
> patch-file that demonstrates the problem.
> 
> > A simple "_fmode=O_BINARY" in main() will fix this (appropriately ifdef'ed).
> 
> Even if reading in binary is necessary, this may not be enough. `_fmode'
> doesn't affect stdin and stdout, so if you say "patch < patchfile",
> `patchfile' will be still read in text mode.  If you need to read stdin in
> binary, use `setmode' (but first test for stdin being a file with
> `isatty'). 
> 

patch <gcc-272.dif is exactly how I invoke my modifed patch (w/ _fmode=binary)
and it works fine.  The sources and patch are both Unix style.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019