Kernel#system not acting like 1.8.7 #123

Open
jc00ke opened this Issue Feb 7, 2012 · 10 comments

Comments

Projects
None yet
4 participants
Contributor

jc00ke commented Feb 7, 2012

I was trying to figure out why rake on minitest was outputting a bunch of weird diff messages:


Run options: -- --seed 6332

# Running tests:

.lib/minitest/unit.rb: 1: gdiff: not found
diff: missing operand after `diff'
diff: Try `diff --help' for more information.
lib/minitest/unit.rb: 1: gdiff: not found
diff: missing operand after `diff'
diff: Try `diff --help' for more information.
F....lib/minitest/unit.rb: 1: gdiff: not found
diff: missing operand after `diff'
diff: Try `diff --help' for more information.
........lib/minitest/unit.rb: 1: gdiff: not found
diff: missing operand after `diff'

It looks like Kernel#system isn't working like it should. In CRuby 1.8.7 the following prints diff -u on my Ubuntu machine:

d = if system("gdiff", __FILE__, __FILE__)
  "gdiff -u" # solaris and kin suck
elsif system("diff", __FILE__, __FILE__)
  "diff -u"
else
  nil
end

puts d

but MagLev prints

foo.rb: 1: gdiff: not found
diff: missing operand after `diff'
diff: Try `diff --help' for more information.
nil
Owner

timfel commented Feb 7, 2012

I've seen that before, iirc I had a patch somewhere that wasn't quite
right

Member

Monty commented Feb 7, 2012

Hmmm. I get slightly different results than you got, i.e. I can also print "diff -u". The "not found" is on STDERR

$ maglev-ruby foo.rb
: gdiff: command not found
diff -u

$ maglev-ruby foo.rb 2>/dev/null
diff -u

Contributor

jc00ke commented Feb 7, 2012

@Monty on OSX, right?

Owner

timfel commented Feb 8, 2012

Hm, my first guess was that MRI closes STDERR by default, but it seems that it actually checks whether the cmd is executable or not before actually running anything.

Member

Monty commented Feb 8, 2012

@jc00ke exact same results on both Mac OSX Lion and Ubuntu 10.04.3 LTS

Contributor

jc00ke commented Feb 8, 2012

@Monty hmm, I'm on Ubuntu 11.10. With @timfel's latest commit I now get an ECHILD occurred

10:20:09 jesse@maynard:~/projects/maglev (git:master+*:500533b)  rbx-head 
∴ ./bin/maglev-ruby /tmp/foo.rb
/tmp/foo.rb: 1: gdiff: not found
ERROR 2702 , a ECHILD occurred (error 2702), errno=10 (Errno::ECHILD)
topaz 1> exit
Contributor

zenspider commented Jan 16, 2013

ping

FYI... I'm starting to take a whack at getting minitest and friends happy on maglev. I'm gonna try my best not to file duplicate tickets... but some will happen. If you'd rather I work on maglev head I'm going to need to get up to speed building and installing maglev for development use. I can pair with someone on IRC if that helps speed things up.

Contributor

zenspider commented Jan 16, 2013

Worse... something about the code is coming up with defined?(@diff) => nil so the check happens again and again.

Owner

timfel commented Jan 16, 2013

If you pop into #maglev-ruby sometime and ping me (phlebas), I can help you install maglev HEAD. If you can point me to some code that doesn't work, l can also take a look

Contributor

zenspider commented Jan 26, 2013

@timfel if you can't find your patch for this, I'm going to rip the warning out entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment