# Bizarre ruby debug behaviour when using variables beginning with character 'u' on windows

**URL:** <https://www.ruby-forum.com/t/bizarre-ruby-debug-behaviour-when-using-variables-beginning-with-character-u-on-windows/153037>\
**Category:** Rails\
**Created:** [November 11, 2008, 11:12am UTC](https://www.ruby-forum.com/t/bizarre-ruby-debug-behaviour-when-using-variables-beginning-with-character-u-on-windows/153037 "2008-11-11T11:12:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 11, 2008, 11:12am UTC](https://www.ruby-forum.com/t/bizarre-ruby-debug-behaviour-when-using-variables-beginning-with-character-u-on-windows/153037/1 "2008-11-11T11:12:28Z")

</div>

I’m using Instant Rails on windows. I’m also using ruby debug.

I first stumbled across the problem when an array that I named  
utilities\_used = [] was misbehaving. I added some experimental code  
and set a breakpoint and started to investigate.

Here’s my code (it’s inside a model file):

foo = []  
ufoo = []  
vfoo = []  
utfoo = []  
utifoo = []  
utils = []  
utils\_foo = []  
foo\_used = []  
utils\_used = []  
missing\_vehicles = []

debugger

When I break into the debugger:  
(rdb:94) foo  
[]  
(rdb:94) vfoo  
[]  
(rdb:94) foo\_used  
[]  
(rdb:94) missing\_vehicles  
[]  
(rdb:94) ufoo  
#1 E:/InstantRails-2.0-win/rails\_apps/Carbon Salon Source Tree/app/  
controllers/admin\_controller.rb:37 in ‘receive\_file’  
(rdb:94) foo  
NameError Exception: undefined local variable or method `foo' for #<AdminController:0x46b45b4> (rdb:94) vfoo NameError Exception: undefined local variable or method`vfoo’ for  
#AdminController:0x46b45b4  
(rdb:94) foo\_used  
NameError Exception: undefined local variable or method `foo_used' for #<AdminController:0x46b45b4> (rdb:94) missing_vehicles NameError Exception: undefined local variable or method`missing\_vehicles’ for #AdminController:0x46b45b4

Note that, as soon as I inspect an array who’s name starts with the  
letter ‘u’, everything goes to pot…

I tinkered with this some more:  
Code:  
foo = [‘a’, ‘b’, ‘c’]  
ufoo = [‘d’, ‘e’, ‘f’]  
missing\_vehicles = []

foo.each {|f| puts f}  
ufoo.each {|u| puts u}

Console output:  
Processing AdminController#receive\_file (for 127.0.0.1 at 2008-11-10  
16:58:09) [POST]  
Session ID: 858773c8b3335d4c6e9a1326e17c7cd0  
Parameters: {“user\_data\_file”=\>#\<ActionController::UploadedStringIO:  
0x42920a8\>, “action”=\>“receive\_file”, “authenticity\_token”=\>“8  
ce751d807f83817a140eb1cc4e463cc8f5b20f0”, “controller”=\>“admin”}  
a  
b  
c  
d  
e  
f  
E:/InstantRails-2.0-win/rails\_apps/Carbon Salon Source Tree/app/models/  
user\_data\_file.rb:95 #end

so - the code itself seems to work, back to the debugger:

(rdb:98) foo  
[“a”, “b”, “c”]  
(rdb:98) ufoo  
#1 E:/InstantRails-2.0-win/rails\_apps/Carbon Salon Source Tree/app/  
controllers/admin\_controller.rb:37 in ‘receive\_file’  
(rdb:98) foo  
NameError Exception: undefined local variable or method `foo’ for  
#AdminController:0x426b46c  
(rdb:98)

So - it seems to be a problem with the debugger, rather than with  
ruby. In fact, now that I think of it, i’ve repeatedly experienced  
bizarre behaviour when using the debugger to inspect variables that  
begin with the letter ‘u’. Anybody else seen this?

I’m new to RoR, so - maybe i’m doing something stupid here… any  
input, enlightenment would be very much appreciated.

Yoram

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 11, 2008, 11:43am UTC](https://www.ruby-forum.com/t/bizarre-ruby-debug-behaviour-when-using-variables-beginning-with-character-u-on-windows/153037/2 "2008-11-11T11:43:36Z")

</div>

On 11 Nov 2008, at 01:04, removed\_email\_address@domain.invalid wrote:

> ufoo = []
> 
> #1 E:/InstantRails-2.0-win/rails\_apps/Carbon Salon Source Tree/app/  
> controllers/admin\_controller.rb:37 in ‘receive\_file’

Looks like ruby debug sees the u and handles it like the u command  
(which means move up the stack frame, pushing all your local variables  
out of scope). I’m surprised any of this works - normally to evaluate  
an expression you need to use the e command ie  
e foo

Fred
