[#9722] Kernel#system broken inside Dir.chdir(&block) if system command doesn't have shell characters — <noreply@...>

Bugs item #7278, was opened at 2006-12-14 13:59

8 messages 2006/12/14

[#9749] System V IPC in standard library? — Steven Jenkins <steven.jenkins@...>

Back in August, I needed a semaphore to serialize access to an external

14 messages 2006/12/19

[#9753] CVS freeze — SASADA Koichi <ko1@...>

Hi,

20 messages 2006/12/20
[#9755] Re: [ruby-dev:30039] CVS freeze — SASADA Koichi <ko1@...> 2006/12/20

Hi,

[#9757] Re: [ruby-dev:30040] Re: CVS freeze — SASADA Koichi <ko1@...> 2006/12/20

Hi,

Re: [ ruby-Bugs-7274 ] Inconsistant parsing within a block

From: Eric Hodel <drbrain@...7.net>
Date: 2006-12-14 19:02:30 UTC
List: ruby-core #9721
On Dec 14, 2006, at 13:08, <noreply@rubyforge.org>  
<noreply@rubyforge.org> wrote:
> Bugs item #7274, was opened at 2006-12-14 13:08
> You can respond by visiting:
> http://rubyforge.org/tracker/? 
> func=detail&atid=1698&aid=7274&group_id=426
>
> Category: Core
> Group: 1.8.x
> Status: Open
> Resolution: None
> Priority: 3
> Submitted By: Darren Smith (flagitious)
> Assigned to: Nobody (None)
> Summary: Inconsistant parsing within a block
>
> Initial Comment:
> 3.times{1;print (1)+1} --> 222
> 3.times{print (1)+1} --> 1 ... undefined method `+' for  
> nil:NilClass (NoMethodError)
>
> Usually foo (x)+1 acts like foo((x)+1), but if it is the first  
> statement in a block of code then it acts like (foo(x))+1
>
> The bug occurred on all versions of ruby I tried, including:
> ruby 1.8.4 (2005-12-24) [powerpc-darwin7.9.0]
> ruby 1.8.5 (2006-08-25) [x86_64-freebsd6.1]
> ruby 1.8.5 (2006-08-25) [i386-mswin32]

Ruby tells you exactly what it is doing:

$ ruby -ve '3.times {1;print (1)+1}'
ruby 1.8.5 (2006-12-04 patchlevel 2) [i686-darwin8.8.2]
-e:1: warning: (...) interpreted as grouped expression
-e:1: warning: unused literal ignored

$ ruby -ve '3.times {print (1)+1}'
ruby 1.8.5 (2006-12-04 patchlevel 2) [i686-darwin8.8.2]
-e:1: warning: don't put space before argument parentheses
-e:1: undefined method `+' for nil:NilClass (NoMethodError)
         from -e:1:in `times'
         from -e:1

-- 
Eric Hodel - drbrain@segment7.net - http://blog.segment7.net

I LIT YOUR GEM ON FIRE!


In This Thread

Prev Next