bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: On darwin, diff <(echo ab) <(echo cd) does nothing


From: Vincent Lefevre
Subject: Re: On darwin, diff <(echo ab) <(echo cd) does nothing
Date: Sun, 21 Aug 2005 13:28:47 +0200
User-agent: Mutt/1.5.10-vl-20050813i

On 2005-08-20 23:07:22 -0700, Paul Eggert wrote:
> This makes it look like "diff" invoked stat on /dev/fd/15 and
> /dev/fd/16, discovered that they were the same device and inode
> number, and then decided that they were the same file. Or something
> like that. That would explain the behavior. (It would also suggest a
> kernel or filesystem bug....)
> 
> Can you ask for more details from kdump, so that we can see what
> the struct stat values were here?

I don't know how to get more details (the man page doesn't say
anything more, and I'm using -t cnisuw for both ktrace and kdump).

But I've modified diff.c to print a message to stderr:

[...]
  else if ((same_files
            = (cmp.file[0].desc != NONEXISTENT
               && cmp.file[1].desc != NONEXISTENT
               && 0 < same_file (&cmp.file[0].stat, &cmp.file[1].stat)
               && same_file_attributes (&cmp.file[0].stat,
                                        &cmp.file[1].stat)))
           && no_diff_means_no_output)
    {
      /* The two named files are actually the same physical file.
         We know they are identical without actually reading them.  */
      fprintf (stderr, "Same file\n");
    }
[...]

and indeed:

prunille:...ffutils-2.8.1/src> ./diff <(echo ab) <(echo cd)
Same file

And with the previous tests (where file contains "cd\n..\n"):

prunille:~> ~/software/diffutils-2.8.1/src/diff <(echo ab) <(head -n 1 file)
Same file
prunille:~> ~/software/diffutils-2.8.1/src/diff <(echo ab) <(head -n 1 file)
1c1
< ab
---
> cd

I'll try to print more information later...

-- 
Vincent Lefèvre <address@hidden> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA




reply via email to

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