From: "jcaesar (Julius Caesar)" Date: 2012-12-02T02:58:15+09:00 Subject: [ruby-core:50459] [ruby-trunk - Bug #7489][Open] Kernel.spawn sometimes executes string directly Issue #7489 has been reported by jcaesar (Julius Caesar). ---------------------------------------- Bug #7489: Kernel.spawn sometimes executes string directly https://bugs.ruby-lang.org/issues/7489 Author: jcaesar (Julius Caesar) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux] Kernel.spawn throws an exception in certain cases where it shouldn't. It seems to attempt to execute the command directly, rather than passing it to the shell. See the demo script below. What should happen, when I run this script, is that both assertions should fail, and there should be an error message from the testing framework about each test. What actually happens is that both tests pass and the test framework reports success. #------------------------------- require 'test/unit' class TestSpawn < Test::Unit::TestCase #> either command would work fine if executed # in the shell. def test1 assert_raises(Errno::ENOENT) { spawn ':' } end def test2 assert_raises(Errno::ENOENT) { spawn 'a=b true' } end end #------------------------------- My compiler is GCC, and the output of "gcc --version" is: gcc-4.4.real (Debian 4.4.5-8) 4.4.5 Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Please note that I have attached my rbconfig.rb file. -- http://bugs.ruby-lang.org/