From owner-freebsd-questions@FreeBSD.ORG Fri Nov 11 20:53:06 2005 Return-Path: X-Original-To: questions@freebsd.org Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9A1AC16A41F for ; Fri, 11 Nov 2005 20:53:06 +0000 (GMT) (envelope-from ltsampros@upnet.gr) Received: from mail.vivodinet.gr (mail3.vivodinet.gr [80.76.39.13]) by mx1.FreeBSD.org (Postfix) with SMTP id 4D6C043D46 for ; Fri, 11 Nov 2005 20:53:04 +0000 (GMT) (envelope-from ltsampros@upnet.gr) Received: (qmail 5210 invoked from network); 11 Nov 2005 20:52:59 -0000 Received: from dslcustomer-222-89.vivodi.gr (HELO bifteki.home.net) (83.171.222.89) by 0 with SMTP; 11 Nov 2005 20:52:59 -0000 Received: from bifteki.home.net (localhost [127.0.0.1]) by bifteki.home.net (8.13.4/8.13.3) with ESMTP id jABKrg8Y075831; Fri, 11 Nov 2005 22:53:42 +0200 (EET) (envelope-from gaghiel@bifteki.home.net) Received: (from gaghiel@localhost) by bifteki.home.net (8.13.4/8.13.3/Submit) id jABKrcZr075830; Fri, 11 Nov 2005 22:53:38 +0200 (EET) (envelope-from gaghiel) Date: Fri, 11 Nov 2005 22:53:38 +0200 From: Leonidas Tsampros To: Steve Bertrand Message-ID: <20051111205338.GA75629@bifteki.lan> References: <20051111181620.B684443D5D@mx1.FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051111181620.B684443D5D@mx1.FreeBSD.org> User-Agent: Mutt/1.5.11 Cc: 'FreeBSD Questions' Subject: Re: Understanding a patch file [OT?] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2005 20:53:06 -0000 On Fri, Nov 11, 2005 at 01:16:15PM -0500, Steve Bertrand wrote: > Hi everyone... > > This may be off-topic, but I know someone may be able to help. I am > trying to better understand how to use diff, and moreso, understand it's > output. > > In particular, I can't quite grasp exactly what the identifiers in > between @@ and @@ represent exactly. Here is a patch file I created. The > first change looks like it will replace lines 1 through 5, but then I > look at the second change, and it completely confuses me (-11,6 +11,8). > Can someone please clarify why 11 and 8? > I think this kind of diff output is called "unified". It displays "hunks" of differences while each hunk shows one aera where the file differs. > --- randbak.pl Wed Oct 12 17:27:10 2005 > +++ randbak2.pl Fri Nov 11 13:06:51 2005 According to "info diff", the file displayed here is the file modification time. > @@ -1,5 +1,5 @@ > #!/usr/bin/perl > - > +# > use warnings; > use strict; > use Storable; This is the first hunk of changes between the files. The number -1,5 is the line range in the first file while +1,5 is the file range on the second file . But 1,5 doesn't mean all lines between line 1 and line 5. It means in line 1 , + 5 lines afterward. (consider 5 as the length of the compared regions) In this hunk you can see clearly that you removed a whiteline and you add a comment line, so the total numbers of line in both files are exactly the same. Thus you've got -1,5 +1,5. The length of the compared region in boths files did not change. If the second number is different, like in the following hunk, then the data displayed are lines 11-16 on the first file (-11,6) and because you added two lines (the ones starting with +) the file range of the compared region in the second file is 11-18 (+11,8) I hope this helps and i'm terribly sorry for my english. Alternatively you can check `info diff' for more information on diff different kinds of output. > @@ -11,6 +11,8 @@ > my $num; > my $sum = "sum"; > my $total = 0; > + > +# Test > > if (-e "randomcount"){ > $href = retrieve ("randomcount"); > > > Thank you for any advice! > Steve > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"