delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/12/22/13:27:21

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <d45df6780712221026h3442ed62w4823263c86ac4d82@mail.gmail.com>
Date: Sat, 22 Dec 2007 13:26:55 -0500
From: "Mike Boone" <boonedocks AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Ruby on Rails 2.0.2/Cygwin Bug
In-Reply-To: <20071222125104.GE29568@calimero.vinschen.de>
MIME-Version: 1.0
References: <d45df6780712191829xaab8c3kc844f16d04d247ad AT mail DOT gmail DOT com> <d45df6780712211913k512c08d4s8d026ecef70dc1cb AT mail DOT gmail DOT com> <20071222125104 DOT GE29568 AT calimero DOT vinschen DOT de>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

Over on the comp.ruby.lang group, I got a reply from Matz, the lead
Ruby developer:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/284495

He states: "The bug must lie between Cygwin and Ruby.  We don't call
lseek explicitly.  You can clearly see this by doing strace on Linux
(or other platforms), which don't call lseek at all.  So, someone (in
the library, I guess) must call lseek weirdly on Cygwin."

I know that Corinna noted that Linux was doing lseeks:

On Dec 22, 2007 7:51 AM, Corinna Vinschen <corinna-cygwin AT cygwin DOT com> wrote:
> Two lseek's of dubious purpose.  Why did it read 64K and then tries to
> seek back?  Why does it rely on the return code of the first lseek?
> Doing the same on Linux returns also with 0 from the first lseek, but
> with -1 from the second call and errno set to EINVAL.  However,
> according to the strace, it never *tries* to call lseek on Linux.

However, when I tried strace ruby urandom_test.rb on a few flavors of
Linux, I did not see lseeks in the output. I ran the code on Ubuntu
7.04, RHEL 2.1AS, and whatever brand of Linux is running on Dreamhost.
Which version did you try?

My Cygwin:
   29  467324 [main] ruby 2944 open: 3 = open (/dev/urandom, 0x0)
   51  467375 [main] ruby 2944 _cygwin_istext_for_stdio: fd 3: opened as binary
 2461  469836 [main] ruby 2944 fhandler_base::fstat: here
   45  469881 [main] ruby 2944 fstat64: 0 = fstat (3, 0x24096E0)
  385  470266 [main] ruby 2944 isatty: 0 = isatty (3)
   35  470301 [main] ruby 2944 sig_send: sendsig 0x6F8, pid 2944,
signal -34, its_me 1
  414  470715 [main] ruby 2944 sig_send: wakeup 0x6FC
   60  470775 [main] ruby 2944 sig_send: Waiting for pack.wakeup 0x6FC
  178  470953 [sig] ruby 2944 wait_sig: signalling pack.wakeup 0x6FC
  146  471099 [main] ruby 2944 sig_send: returning 0x0 from sending signal -34
   36  471135 [main] ruby 2944 readv: readv (3, 0x2409700, 1)
blocking, sigcatchers 10
  133  471268 [main] ruby 2944 readv: no need to call ready_for_read
23838  495106 [main] ruby 2944 readv: 65536 = readv (3, 0x2409700, 1), errno 2
  940  496046 [main] ruby 2944 lseek64: 0 = lseek (3, 0, 1)
  524  496570 [main] ruby 2944 lseek64: 0 = lseek (3, -65472, 0)
   73  496643 [main] ruby 2944 close: close (3)


RHEL 2.1AS (Ubuntu 7.04 output was similar):
open("/dev/urandom", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFCHR|0644, st_rdev=makedev(1, 9), ...}) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbffe9c30) = -1 EINVAL
(Invalid argument)
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x40018000
read(3, "\20gI\263\322j5E\345\24[\245\200,\375\23UT}\210(<\365\310"...,
4096) = 4096
close(3)                                = 0

Thanks,
Mike Boone
http://boonedocks.net/mike/

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

- Raw text -


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