[MacPorts] #4556: BUG: diff <(echo ab) <(echo cd) and same files problem

MacPorts noreply at macports.org
Thu Mar 24 07:14:02 PDT 2016


#4556: BUG: diff <(echo ab) <(echo cd) and same files problem
-------------------------------+--------------------
  Reporter:  vincent-opdarw@…  |      Owner:  blb@…
      Type:  defect            |     Status:  closed
  Priority:  Normal            |  Milestone:
 Component:  ports             |    Version:  1.0
Resolution:  fixed             |   Keywords:
      Port:  diffutils         |
-------------------------------+--------------------
Changes (by ryandesign@…):

 * port:   => diffutils


Old 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.

New 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.
 }}}

--

-- 
Ticket URL: <https://trac.macports.org/ticket/4556#comment:10>
MacPorts <https://www.macports.org/>
Ports system for OS X


More information about the macports-tickets mailing list