bug-diffutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-diffutils] Funny behaviour of diff 2.8.1


From: Paul Eggert
Subject: Re: [bug-diffutils] Funny behaviour of diff 2.8.1
Date: Thu, 12 Aug 2010 01:26:06 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6

On 08/11/10 14:34, Philipp Thomas wrote:
> I got the following question from our ksh maintainer
> (https://bugzilla.novell.com/show_bug.cgi?id=627524)

I can't read that; it's behind some sort of registration wall.

Your email doesn't mention ksh or diff version numbers, or platform,
which makes things a bit hard to diagnose, but I'll give it a try
anyhow.

> $> echo "test" | diff - /dev/null
> diff: -: Bad file descriptor
> ...
> ksh uses socketpairs as a fast replacement for pipes which is a major
> feature of the ksh ...  I do not understand why /usr/bin/diff
> executes dup(), then opens /proc/self/fd/3, and then tries to open this:

Nor do I.  Nor can I reproduce the problem on my system (RHEL 5, ksh
93t+ 2010-02-02, diff 2.8.1).  Also, I cannot reproduce the problem
with diff 3.0, which I built myself on that host.  For example, under
ksh the command "echo abc | strace diff - /dev/null" (diff 3.0)
produces trace output like this:

...
fstat(0, {st_mode=S_IFSOCK|0400, st_size=0, ...}) = 0
clock_gettime(CLOCK_REALTIME, {1281568629, 304244000}) = 0
stat("/dev/null", {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 3), ...}) = 0
open("/dev/null", O_RDONLY)             = 3
read(0, "abc\n", 4096)                  = 4
read(0, "", 4092)                       = 0
read(3, "", 4096)                       = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x2b85118bd000
write(1, "1d0\n", 4)                    = 4
write(1, "< abc\n", 6)                  = 6
close(0)                                = 0
close(3)                                = 0
close(1)                                = 0
...

Perhaps your correspondent can drop into a debugger and see what code
is executing "dup"?  The source code of GNU diff proper never invokes
dup, as far as I can see, though no doubt some library functions might
do that.  It might be helpful to try diff 3.0, if you're not trying
that already.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]