Opened 19 years ago
Last modified 9 years ago
#4556 closed defect
diff <(echo ab) <(echo cd) and same files problem — at Initial Version
Reported by: | vincent-opdarw@… | Owned by: | blb@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 1.0 |
Keywords: | Cc: | ||
Port: | diffutils |
Description
When doing "diff <(echo ab) <(echo cd)" under zsh, diff sees /dev/fd/15 and /dev/fd/16 as the same file. Indeed, "stat <(echo ab) <(echo cd)" gives the same values for both. The following patch is a workaround that fixes the problem:
--- diff.c.bak 2002-03-24 07:35:28.000000000 +0000 +++ diff.c 2005-08-21 13:19:28.000000000 +0000 @@ -1208,7 +1208,9 @@
&& 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)))
+ &cmp.file[1].stat) + && strncmp (cmp.file[0].name, "/dev/fd/", 8) != 0 + && strncmp (cmp.file[1].name, "/dev/fd/", 8) != 0))
&& no_diff_means_no_output)
{
/* The two named files are actually the same physical file.