delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/02/21/14:52:04

X-Spam-Check-By: sourceware.org
Date: Wed, 21 Feb 2007 14:51:36 -0500 (EST)
From: Igor Peshansky <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Pedro Alves <pedro_alves AT portugalmail DOT pt>
cc: cygwin AT cygwin DOT com
Subject: Re: patch -e from stdin broken?
In-Reply-To: <45DC9D30.8080506@portugalmail.pt>
Message-ID: <Pine.GSO.4.63.0702211446380.6005@access1.cims.nyu.edu>
References: <1172072129 DOT 45dc66c1415be AT webmail4 DOT portugalmail DOT pt> <20070221154449 DOT GB15002 AT calimero DOT vinschen DOT de> <45DC9D30 DOT 8080506 AT portugalmail DOT pt>
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Wed, 21 Feb 2007, Pedro Alves wrote:

> (Here is the original message I tried to send earlier, sorry for the mess.)
>
> Hi guys,
>
> While looking at why 'quilt annotate' is broken in Cygwin, I found
> something fishy on 'patch' in ed mode.  Looks like reading the patch
> from stdin is broken.  Reading the patch from a file with -i works
> ok.  Here is how to reproduce:
>
> $ touch a.txt
>
> $ cat << EOF > b.txt
>
> > > a new line
> > > EOF
> >
>
> $ diff -e a.txt b.txt > ab.diff
>
> $ cat ab.diff
> 0a
> a new line
> .
>
> $ patch -e a.txt < ab.diff
>
> $ /cygdrive/c/DOCUME~1/pt104167/LOCALS~1/Temp/poL0ERTu: No such file
> or directory

    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Looks like your $TMP is set to something Cygwin doesn't like...  Try
setting it to, say, /tmp, and see if that makes patch -e happier...

> [snip]
> That 'No such file' error message comes from ed, or so it seems.
> It looks like something is going wrong with the pipe to ed
> (patch/pch.c:do_ed_script), but I can't see what.  The filename passed
> to it is correct, but somehow, when the pipe is fflushed ed barks.
> If I put a _cexit before the pipe is flushed, ed doesn't complain.
> I also tested it on kubuntu 6.06, and on Solaris 10 with gnu patch,
> gnu diff and Sun ed, and it worked correctly, so it does look
> like a Cygwin specific problem.

You could also try playing with the "binmode" setting in the Cygwin
environment variable, which controls line endings in pipes.

> (end original message)
>
> As Corinna found out, not specifying the file to patch, but doing
> it interactively works ok.  That should make it easier to debug.
>
> $ patch -e < ab.diff
> can't find file to patch at input line 1
> Perhaps you used the wrong -p or --strip option?
> File to patch: a.txt
> $ cat a.txt
> a new line
> $
>
> $ patch -e a.txt < ab.diff
> /cygdrive/c/DOCUME~1/ADMINI~1/DEFINI~1/Temp/poh0o0Rq: No such file or
> directory

Hmm, you also forgot to mention the directory where a.txt resides...
Try first doing this on a binary mount in some directory under Cygwin root
(e.g., /tmp).  If that works, look into directories and environment
variable settings.
HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Freedom is just another word for "nothing left to lose"...  -- Janis Joplin

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

- Raw text -


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