X-Spam-Check-By: sourceware.org Message-ID: <45DC9D30.8080506@portugalmail.pt> Date: Wed, 21 Feb 2007 19:27:44 +0000 From: Pedro Alves User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.8.0.9) Gecko/20061207 Thunderbird/1.5.0.9 Mnenhy/0.7.4.0 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: patch -e from stdin broken? References: <1172072129 DOT 45dc66c1415be AT webmail4 DOT portugalmail DOT pt> <20070221154449 DOT GB15002 AT calimero DOT vinschen DOT de> In-Reply-To: <20070221154449.GB15002@calimero.vinschen.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 000715-1, 21-02-2007), Outbound message X-Antivirus-Status: Clean X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Corinna Vinschen wrote: > On Feb 21 15:35, pedro_alves AT portugalmail DOT pt wrote: > >> 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 >> > > The diff file also contains a third line with just a single dot. > If I feed this to patch from stdin, everything's fine: > > $ patch < 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 > $ > > Where's the problem exactly? > > > (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 #(a.txt should have the same contents as b.txt at this point) $ cat a.txt $ cat ab.diff | patch -e a.txt $ /cygdrive/c/DOCUME~1/pt104167/LOCALS~1/Temp/po5so3lD: No such file or directory #(still wrong contents) $ cat a.txt $ patch -e a.txt -i ab.diff #(ok now.) $ cat a.txt a new line 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. Cygwin Package Information Package Version Status cygwin 1.5.24-2 OK patch 2.5.8-9 OK diffutils 2.8.7-1 OK ed 0.2-1 OK (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 Cheers, Pedro Alves -- 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/