delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/12/29/11:44:01

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:content-type
:content-transfer-encoding:date:from:to:subject:in-reply-to
:references:message-id; q=dns; s=default; b=L5/hUVvaS1YmvDyYxn1P
RlDytYxoaveZiLg2kpqfVdvVjlUqKdR12CL8dd3PcgMq0hsY16vdbkBZTsYiP+Jq
G9aiNjOfQ/xVTRXoPco3/yh+ot/4tpQcIkpvWlBHugnnxxU7YYN8UA8bZXwa8aCS
ljJlSTmF+GEAEnUsnHhvHNs=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:content-type
:content-transfer-encoding:date:from:to:subject:in-reply-to
:references:message-id; s=default; bh=kumWfcU/OyImMgmVVhTzo96mbY
g=; b=UHkTY5qGC0jo1bShvrLvhTDJfnmn3SJGT2gvFqbqNEZo3iIQ9jfxwXQMA1
UdjDNT+n5pAHpToRNx73jilIzHB7veUCcYtt0yzStdCVodA8ErPpjooYsNqO/7xq
FfElkOKvzkJ7mE1e7bDoycjr5hykScBROlJev+AgY88BvefV4=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_40,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=0291, 2015-12-25, 1204, inode
X-HELO: lb3-smtp-cloud6.xs4all.net
MIME-Version: 1.0
Date: Tue, 29 Dec 2015 17:43:41 +0100
From: Houder <houder AT xs4all DOT nl>
To: cygwin AT cygwin DOT com
Subject: Re: cmp (or echo) bug?
In-Reply-To: <CAPJ9Yc9uFnFSFPkYxJj2A87EzZVNrWx2mN5Pq6SxCwpf_78QVQ@mail.gmail.com>
References: <CAPJ9Yc9uFnFSFPkYxJj2A87EzZVNrWx2mN5Pq6SxCwpf_78QVQ AT mail DOT gmail DOT com>
Message-ID: <2fd8829b7e5d7d1904306d45fbb63a7d@xs4all.nl>
X-Sender: houder AT xs4all DOT nl (Gv8nUPbHDppJ/4axoqLXUQ==)
User-Agent: XS4ALL Webmail
X-IsSubscribed: yes

On 2015-12-25 22:32, David Balažic wrote:
> Hi!
> 
> In Cygwin terminal (bash) I typed:
> 
> cmp  <(echo echo1)  <(echo echo2)
> 
> This does not print anything.
> Not even with -b.
> 
> On Linux (Ubuntu 12.04 in VMWare) it reports that the inputs are 
> different.
> 
> Bug?
> Or am I missing something?

@@ uname -a
CYGWIN_NT-6.1-WOW Seven 2.3.1(0.291/5/3) 2015-11-14 12:42 i686 Cygwin
@@ ./cmp <(echo echo1) <(echo echo2)
/dev/fd/63 /dev/fd/62 differ: byte 5, line 1
@@ ./cmp <(echo echo1) <(echo echo2)
/dev/fd/63 /dev/fd/62 differ: byte 5, line 1
@@ ./cmp <(echo echo1) <(echo echo2)
/dev/fd/63 /dev/fd/62 differ: byte 5, line 1
@@ ./cmp <(echo echo1) <(echo echo2)
/dev/fd/63 /dev/fd/62 differ: byte 5, line 1
@@ ./cmp <(echo echo1) <(echo echo2)
/dev/fd/63 /dev/fd/62 differ: byte 5, line 1
@@ ./cmp <(echo echo1) <(echo echo2)
/dev/fd/63 /dev/fd/62 differ: byte 5, line 1

etc.

But only after I had modified cmp.c (diffutils) as follows:

int
main (int argc, char **argv)
{
...

#if 0
       if (file_desc[f1] < 0 || fstat (file_desc[f1], stat_buf + f1) != 
0)
#else
       if (file_desc[f1] < 0 || f1 ? ( stat (file[1], stat_buf + f1) != 0 
)
                                   : ( stat (file[0], stat_buf + f1) != 0 
) ) // Henri: suspect fstat
#endif
         {
           if (file_desc[f1] < 0 && comparison_type == type_status)
             exit (EXIT_TROUBLE);
           else
             error (EXIT_TROUBLE, errno, "%s", file[f1]);
         }
     }

   /* If the files are links to the same inode and have the same file 
position,
      they are identical.  */

   if (0 < same_file (&stat_buf[0], &stat_buf[1])
       && same_file_attributes (&stat_buf[0], &stat_buf[1])
       && file_position (0) == file_position (1))
{ // Henri: diagnostics
#if 0
     printf("same_file = %d\n", same_file (&stat_buf[0], &stat_buf[1]) );
     printf("same_file_attributes = %d\n", same_file_attributes 
(&stat_buf[0], &stat_buf[1]) );
     printf("same file pos = %d\n", file_position (0) == file_position 
(1) );
#endif
     printf("file[0] = %s, file[1] = %s\n", file[0], file[1]);
     printf("file_desc[0] = %d, file_desc[1] = %d\n", file_desc[0], 
file_desc[1]);
     printf("bailing out: same file.\n");
     return EXIT_SUCCESS;
}

Regards,
Henri


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019