wdiff does not work correctly with <() redirection

Bug #160912 reported by Thomas Bleher
4
Affects Status Importance Assigned to Milestone
wdiff
Unknown
Unknown
wdiff (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: wdiff

wdiff produces a diff but does not display all information if one or both of the files given is a bash process substitution.

An example session:
$ echo "word1 word2 word3" > file1
$ echo "word1 word4 word3" > file2
$ wdiff file1 file2
word1 [-word2-] {+word4+} word3
$ wdiff <(cat file1) <(cat file2)
[--]{++}$ wdiff file1 <(cat file2)
 [-word2-]{++}$ wdiff <(cat file1) file2
word1[--] {+word4+} word3
$ bash --version
GNU bash, version 3.2.25(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
$ wdiff --version
GNU wdiff 0.5
Copyright (C) 1992 Free Software Foundation, Inc.

ProblemType: Bug
Architecture: amd64
Date: Thu Nov 8 11:16:56 2007
Dependencies:
 libgcc1 1:4.2.1-5ubuntu4
 gcc-4.2-base 4.2.1-5ubuntu4
 libncurses5 5.6+20070716-1ubuntu3
 libc6 2.6.1-1ubuntu10
DistroRelease: Ubuntu 7.10
Package: wdiff 0.5-17build1
PackageArchitecture: amd64
SourcePackage: wdiff
Uname: Linux thomas 2.6.24-rc2 #8 SMP Wed Nov 7 09:38:01 CET 2007 x86_64 GNU/Linux

Tags: apport-bug
Revision history for this message
Thomas Bleher (tbleher) wrote :

A small addition: While it would be nice if wdiff supported <(), failing is OK IMHO as long as there is some error message. I just used wdiff for the first time and was confused why it didn't properly display deleted words. Only after some searching it became clear that it was because I had piped in the old file through <().

Revision history for this message
Rory McCann (rorymcc) wrote :

The strace for it is interesting. It looks like wdiff does a stat on the files and the result returns is 0.

strace -efile wdiff -1 <(echo -e "line1\nline2") <(echo -e "line1\nline3")
execve("/usr/bin/wdiff", ["wdiff", "-1", "/dev/fd/63", "/dev/fd/62"], [/* 44 vars */]) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/libncurses.so.5", O_RDONLY) = 3
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/cmov/libc.so.6", O_RDONLY) = 3
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/cmov/libdl.so.2", O_RDONLY) = 3
stat64("/dev/fd/63", {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
open("/dev/fd/63", O_RDONLY) = 3
open("/tmp/wdiff.bF8FQN", O_RDWR|O_CREAT|O_EXCL, 0600) = 4
stat64("/dev/fd/62", {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
open("/dev/fd/62", O_RDONLY) = 4
open("/tmp/wdiff.HqUIDm", O_RDWR|O_CREAT|O_EXCL, 0600) = 5
--- SIGCHLD (Child exited) @ 0 (0) ---
unlink("/tmp/wdiff.bF8FQN") = 0
unlink("/tmp/wdiff.HqUIDm") = 0
{++}Process 20780 detached

I suspect that's causing it to think the files are empty and not doing anything.

diff however does work for named pipes,
$ diff -u <(echo -e "line1\nline2") <(echo -e "line1\nline3")
--- /dev/fd/63 2009-03-30 12:17:43.235246354 +0100
+++ /dev/fd/62 2009-03-30 12:17:43.235246354 +0100
@@ -1,2 +1,2 @@
 line1
-line2
+line3

Revision history for this message
xteejx (xteejx) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. The issue that you reported is one that should be reproducible with the development release - Karmic Koala. It would help us greatly if you could test with it so we can work on getting it fixed in the next release of Ubuntu. You can find out more about the development release at http://www.ubuntu.com/testing/. Thanks again and we appreciate your help.

Changed in wdiff (Ubuntu):
status: New → Incomplete
Revision history for this message
Thomas Bleher (tbleher) wrote :

Can someone with a test machine please test this bug?
I don't have time currently to install Karmic Koala, so I can't say if this bug is still there.
But for anyone with a test machine, it should be trivial to reproduce the bug.

Revision history for this message
Rory McCann (rorymcc) wrote :

I have tested this on 9.10 Karmic Koala and the bug is still there for wdiff 0.5-18

However I have discovered another programme dwdiff that is similar to wdiff and *does* work with bash process direction. As a work around people can use this other programme instead.

Revision history for this message
xteejx (xteejx) wrote :

Thank you for updating us with this. Marking Confirmed.

Changed in wdiff (Ubuntu):
importance: Undecided → Medium
status: Incomplete → Confirmed
Revision history for this message
Johan Euphrosine (proppy) wrote :

dwdiff in universe does not have this issue.

It looks fixed upstream thought:
http://savannah.gnu.org/bugs/?25883

Revision history for this message
Martin von Gagern (gagern) wrote :

Fix committed but not released yet. Pre-release available at http://alpha.gnu.org/gnu/wdiff/ and final release expected this month.

Revision history for this message
xteejx (xteejx) wrote :

I assume this was fixed in the release that came with Maverick. If this is incorrect please set this bug back to New. Thank you.

Changed in wdiff (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.