Skip Menu |

This queue is for tickets about the Text-Diff CPAN distribution.

Report information
The Basics
Id: 110611
Status: resolved
Priority: 0/
Queue: Text-Diff

People
Owner: NEILB [...] cpan.org
Requestors: leva [...] ecentrum.hu
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.44



Subject: Now newline in output, when *not* using filenames as parameters for diff()
Date: Fri, 25 Dec 2015 21:15:16 +0100
To: bug-Text-Diff [...] rt.cpan.org
From: LÉVAI Dániel <leva [...] ecentrum.hu>
Easy to test: ==========8<========== $ perl -MText::Diff -e 'my $a = [ 'a' ]; my $b = [ 'b' ]; print diff($a, $b) . "\n";' @@ -1 +1 @@ -a+b ==========8<========== This is the case with every output 'STYLE'. However, when using filenames with the same contents: ==========8<========== $ echo a > a $ echo b > b $ perl -MText::Diff -e 'print diff("a", "b") . "\n";' --- a Fri Dec 25 21:13:29 2015 +++ b Fri Dec 25 21:13:31 2015 @@ -1 +1 @@ -a +b ==========8<========== ... it works.
Subject: Re: [rt.cpan.org #110611] AutoReply: Now newline in output, when *not* using filenames as parameters for diff()
Date: Fri, 25 Dec 2015 23:00:31 +0100
To: Bugs in Text-Diff via RT <bug-Text-Diff [...] rt.cpan.org>
From: LÉVAI Dániel <leva [...] ecentrum.hu>
Tested with perl-5.20.2 on OpenBSD 5.8, perl-5.22.0 on Slackware Linux, and Text::Diff 1.41 and 1.43. Daniel
On 2015-12-25 15:15:45, daniell wrote: Show quoted text
> Easy to test: > > ==========8<========== > $ perl -MText::Diff -e 'my $a = [ 'a' ]; my $b = [ 'b' ]; print > diff($a, $b) . "\n";' > @@ -1 +1 @@ > -a+b > ==========8<========== > This is the case with every output 'STYLE'. > > However, when using filenames with the same contents: > ==========8<========== > $ echo a > a > $ echo b > b
You should use "echo -n" to get the same contents (i.e. no trailing newline in the file). Show quoted text
> $ perl -MText::Diff -e 'print diff("a", "b") . "\n";' > --- a Fri Dec 25 21:13:29 2015 > +++ b Fri Dec 25 21:13:31 2015 > @@ -1 +1 @@ > -a > +b > ==========8<========== > ... it works.
On 2015-12-26 17:48:57, SREZIC wrote: Show quoted text
> On 2015-12-25 15:15:45, daniell wrote:
> > Easy to test: > > > > ==========8<========== > > $ perl -MText::Diff -e 'my $a = [ 'a' ]; my $b = [ 'b' ]; print > > diff($a, $b) . "\n";' > > @@ -1 +1 @@ > > -a+b > > ==========8<========== > > This is the case with every output 'STYLE'. > > > > However, when using filenames with the same contents: > > ==========8<========== > > $ echo a > a > > $ echo b > b
> > You should use "echo -n" to get the same contents (i.e. no trailing > newline in the file). >
... but you're probably right if you think that the output is suboptimal. Probably it should doing the same like system's diff: $ diff -u a b --- a 2015-12-26 23:47:59.000000000 +0100 +++ b 2015-12-26 23:48:05.000000000 +0100 @@ -1 +1 @@ -a \ No newline at end of file +b \ No newline at end of file
Subject: Re: [rt.cpan.org #110611] Now newline in output, when *not* using filenames as parameters for diff()
Date: Sat, 26 Dec 2015 23:52:29 +0100
To: Slaven_Rezic via RT <bug-Text-Diff [...] rt.cpan.org>
From: LÉVAI Dániel <leva [...] ecentrum.hu>
Slaven_Rezic via RT @ 2015-12-26T23:48:58 +0100: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=110611 > > > On 2015-12-25 15:15:45, daniell wrote:
> > Easy to test: > > > > ==========8<========== > > $ perl -MText::Diff -e 'my $a = [ 'a' ]; my $b = [ 'b' ]; print > > diff($a, $b) . "\n";' > > @@ -1 +1 @@ > > -a+b > > ==========8<========== > > This is the case with every output 'STYLE'. > > > > However, when using filenames with the same contents: > > ==========8<========== > > $ echo a > a > > $ echo b > b
> > You should use "echo -n" to get the same contents (i.e. no trailing newline in the file). >
You're right; so it's also broken with files... Daniel
I'm pretty sure this is what I just fixed and was included in 1.44
On 2016-03-04 11:57:09, DROLSKY wrote: Show quoted text
> I'm pretty sure this is what I just fixed and was included in 1.44
Looks good!
Thanks -- fixed in 1.44, thanks to Dave Rolsky.