Re: [rails-oceania] Crazy cases for Mac directories

2011-01-17 Thread Clifford Heath

On 17/01/2011, at 6:50 PM, Chris Berkhout wrote:
I think you're right about different implementations giving  
different results.


There was always one true name, and false references that aliased it.


But since that renaming brought everything into line, there must have
been and uppercase version and a lowercase version stored somewhere,
rather than a single true name being differently interpreted by
various implementations.


The single true name was the actual filesystem name (lower case), which
you repaired. The upper-case version was stored in the password file as
your home directory, which gets propagated into ENV['HOME'] when you
log in.

Clifford Heath.



Cheers,
Chris


On Mon, Jan 17, 2011 at 8:22 AM, Clifford Heath
clifford.he...@gmail.com wrote:

Chris,

I don't think this is a Ruby thing, but comes from the different ways
Ruby gets the information. getpwuid gets your password entry from
the password database. Dir[/] reads the content of the root  
directory.

The env, well, you know.

I'm not sure what the Mac implementation of Dir.pwd does, but it  
could

not be any of the above. One BSD implementation I knew had a very
clunky method: it would progressively read the entries in .., ../..,
../../..,
etc, and match the inode numbers with ., .., ../.., etc. I suspect  
that

Apple
has replaced that, as most unices have, with a kernel implementation,
but I can't see it documented in /usr/share/man/man2.

https://github.com/ruby/ruby/blob/trunk/dir.c says it's implemented  
using

my_getcwd, which is probably just a wrapper for getcwd (man 3 getcwd)
from the Apple standard library. Try a little C program and tell us  
what it

says:

#include unistd.h
void main()
{
   char buf[1024];
   getcwd(buf, sizeof(buf));
   puts(buf);
   exit(0);
}

Clifford Heath.

On 16/01/2011, at 10:59 PM, Chris Berkhout wrote:


Hi All,

Today I was surprised to find that the U in Users is uppercase
(which I consider correct) in:

Etc.getpwuid.dir = /Users/chrisberkhout
Dir.entries(/) = [..., Users, ...]
ENV['PWD']   = /Users/chrisberkhout

But lowercase in:

Dir.pwd   = /users/chrisberkhout
File.expand_path('.') = /users/chrisberkhout

Also,
- Manually changing into the uppercase directory doesn't help.
- Deeper directories with uppercase letters seem fine.
- Other root-level directories with uppercase letters seem fine.

Anyone else run into this issue?

Cheers,
Chris

--
You received this message because you are subscribed to the Google  
Groups

Ruby or Rails Oceania group.
To post to this group, send email to rails-oceania@googlegroups.com.
To unsubscribe from this group, send email to
rails-oceania+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rails-oceania?hl=en.



--
You received this message because you are subscribed to the Google  
Groups

Ruby or Rails Oceania group.
To post to this group, send email to rails-oceania@googlegroups.com.
To unsubscribe from this group, send email to
rails-oceania+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rails-oceania?hl=en.




--
You received this message because you are subscribed to the Google  
Groups Ruby or Rails Oceania group.

To post to this group, send email to rails-oceania@googlegroups.com.
To unsubscribe from this group, send email to rails-oceania+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en 
.




--
You received this message because you are subscribed to the Google Groups Ruby or 
Rails Oceania group.
To post to this group, send email to rails-oceania@googlegroups.com.
To unsubscribe from this group, send email to 
rails-oceania+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.



Re: [rails-oceania] Crazy cases for Mac directories

2011-01-17 Thread Chris Berkhout
On Mon, Jan 17, 2011 at 8:22 PM, Clifford Heath
clifford.he...@gmail.com wrote:
 The single true name was the actual filesystem name (lower case), which
 you repaired. The upper-case version was stored in the password file as
 your home directory, which gets propagated into ENV['HOME'] when you
 log in.

I was also getting this:
Dir.entries(/) = [..., Users, ...]
And finder and bash only showed uppercase.

Cheers,
Chris

-- 
You received this message because you are subscribed to the Google Groups Ruby 
or Rails Oceania group.
To post to this group, send email to rails-oceania@googlegroups.com.
To unsubscribe from this group, send email to 
rails-oceania+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.



Re: [rails-oceania] Crazy cases for Mac directories

2011-01-17 Thread Clifford Heath

On 17/01/2011, at 9:03 PM, Chris Berkhout wrote:

I was also getting this:
Dir.entries(/) = [..., Users, ...]
And finder and bash only showed uppercase.


Oooh, right! Funky. So the HFS filesystem must have at least two
names... There's an open HFS implementation, you could probably
find out from that.

--
You received this message because you are subscribed to the Google Groups Ruby or 
Rails Oceania group.
To post to this group, send email to rails-oceania@googlegroups.com.
To unsubscribe from this group, send email to 
rails-oceania+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.



[rails-oceania] Crazy cases for Mac directories

2011-01-16 Thread Chris Berkhout
Hi All,

Today I was surprised to find that the U in Users is uppercase
(which I consider correct) in:

Etc.getpwuid.dir = /Users/chrisberkhout
Dir.entries(/) = [..., Users, ...]
ENV['PWD']   = /Users/chrisberkhout

But lowercase in:

Dir.pwd   = /users/chrisberkhout
File.expand_path('.') = /users/chrisberkhout

Also,
- Manually changing into the uppercase directory doesn't help.
- Deeper directories with uppercase letters seem fine.
- Other root-level directories with uppercase letters seem fine.

Anyone else run into this issue?

Cheers,
Chris

-- 
You received this message because you are subscribed to the Google Groups Ruby 
or Rails Oceania group.
To post to this group, send email to rails-oceania@googlegroups.com.
To unsubscribe from this group, send email to 
rails-oceania+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.



Re: [rails-oceania] Crazy cases for Mac directories

2011-01-16 Thread Pat Allan
Heya Chris

Both of your lowercase examples return /Users... for me. What version of Ruby 
are you running? And what filesystem are you using for your hard drive?

-- 
Pat

On 16/01/2011, at 10:59 PM, Chris Berkhout wrote:

 Hi All,
 
 Today I was surprised to find that the U in Users is uppercase
 (which I consider correct) in:
 
 Etc.getpwuid.dir = /Users/chrisberkhout
 Dir.entries(/) = [..., Users, ...]
 ENV['PWD']   = /Users/chrisberkhout
 
 But lowercase in:
 
 Dir.pwd   = /users/chrisberkhout
 File.expand_path('.') = /users/chrisberkhout
 
 Also,
 - Manually changing into the uppercase directory doesn't help.
 - Deeper directories with uppercase letters seem fine.
 - Other root-level directories with uppercase letters seem fine.
 
 Anyone else run into this issue?
 
 Cheers,
 Chris
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Ruby or Rails Oceania group.
 To post to this group, send email to rails-oceania@googlegroups.com.
 To unsubscribe from this group, send email to 
 rails-oceania+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/rails-oceania?hl=en.
 

-- 
You received this message because you are subscribed to the Google Groups Ruby 
or Rails Oceania group.
To post to this group, send email to rails-oceania@googlegroups.com.
To unsubscribe from this group, send email to 
rails-oceania+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.



Re: [rails-oceania] Crazy cases for Mac directories

2011-01-16 Thread Andrew Grimm
Do you have any other rubies? Do they all say the same thing?

Also, when you say Manually changing into the uppercase directory,
to you mean /Users/_who , or /Users itself?

Andrew

On Sun, Jan 16, 2011 at 11:27 PM, Pat Allan p...@freelancing-gods.com wrote:
 I'm using 1.8.7 patch 249, on a Mac OS Extended (Journaled) FS, with 10.6.6 - 
 not too different, but perhaps it's the patch level?

 --
 Pat

 On 16/01/2011, at 11:22 PM, Chris Berkhout wrote:

 Huh, strange! I'm on:

 ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
 File System :         Mac OS Extended (Journaled)
 Mac OS X 10.6.5

 New shell doesn't help either.

 Hmm


 On Sun, Jan 16, 2011 at 11:05 PM, Pat Allan p...@freelancing-gods.com 
 wrote:
 Heya Chris

 Both of your lowercase examples return /Users... for me. What version of 
 Ruby are you running? And what filesystem are you using for your hard drive?

 --
 Pat

 On 16/01/2011, at 10:59 PM, Chris Berkhout wrote:

 Hi All,

 Today I was surprised to find that the U in Users is uppercase
 (which I consider correct) in:

 Etc.getpwuid.dir = /Users/chrisberkhout
 Dir.entries(/) = [..., Users, ...]
 ENV['PWD']       = /Users/chrisberkhout

 But lowercase in:

 Dir.pwd               = /users/chrisberkhout
 File.expand_path('.') = /users/chrisberkhout

 Also,
 - Manually changing into the uppercase directory doesn't help.
 - Deeper directories with uppercase letters seem fine.
 - Other root-level directories with uppercase letters seem fine.

 Anyone else run into this issue?

 Cheers,
 Chris

 --
 You received this message because you are subscribed to the Google Groups 
 Ruby or Rails Oceania group.
 To post to this group, send email to rails-oceania@googlegroups.com.
 To unsubscribe from this group, send email to 
 rails-oceania+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/rails-oceania?hl=en.


 --
 You received this message because you are subscribed to the Google Groups 
 Ruby or Rails Oceania group.
 To post to this group, send email to rails-oceania@googlegroups.com.
 To unsubscribe from this group, send email to 
 rails-oceania+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/rails-oceania?hl=en.



 --
 You received this message because you are subscribed to the Google Groups 
 Ruby or Rails Oceania group.
 To post to this group, send email to rails-oceania@googlegroups.com.
 To unsubscribe from this group, send email to 
 rails-oceania+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/rails-oceania?hl=en.


 --
 You received this message because you are subscribed to the Google Groups 
 Ruby or Rails Oceania group.
 To post to this group, send email to rails-oceania@googlegroups.com.
 To unsubscribe from this group, send email to 
 rails-oceania+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/rails-oceania?hl=en.



-- 
You received this message because you are subscribed to the Google Groups Ruby 
or Rails Oceania group.
To post to this group, send email to rails-oceania@googlegroups.com.
To unsubscribe from this group, send email to 
rails-oceania+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.



Re: [rails-oceania] Crazy cases for Mac directories

2011-01-16 Thread Clifford Heath

Chris,

I don't think this is a Ruby thing, but comes from the different ways
Ruby gets the information. getpwuid gets your password entry from
the password database. Dir[/] reads the content of the root directory.
The env, well, you know.

I'm not sure what the Mac implementation of Dir.pwd does, but it could
not be any of the above. One BSD implementation I knew had a very
clunky method: it would progressively read the entries  
in .., ../.., ../../..,
etc, and match the inode numbers with ., .., ../.., etc. I suspect  
that Apple

has replaced that, as most unices have, with a kernel implementation,
but I can't see it documented in /usr/share/man/man2.

https://github.com/ruby/ruby/blob/trunk/dir.c says it's implemented  
using

my_getcwd, which is probably just a wrapper for getcwd (man 3 getcwd)
from the Apple standard library. Try a little C program and tell us  
what it

says:

#include unistd.h
void main()
{
char buf[1024];
getcwd(buf, sizeof(buf));
puts(buf);
exit(0);
}

Clifford Heath.

On 16/01/2011, at 10:59 PM, Chris Berkhout wrote:


Hi All,

Today I was surprised to find that the U in Users is uppercase
(which I consider correct) in:

Etc.getpwuid.dir = /Users/chrisberkhout
Dir.entries(/) = [..., Users, ...]
ENV['PWD']   = /Users/chrisberkhout

But lowercase in:

Dir.pwd   = /users/chrisberkhout
File.expand_path('.') = /users/chrisberkhout

Also,
- Manually changing into the uppercase directory doesn't help.
- Deeper directories with uppercase letters seem fine.
- Other root-level directories with uppercase letters seem fine.

Anyone else run into this issue?

Cheers,
Chris

--
You received this message because you are subscribed to the Google  
Groups Ruby or Rails Oceania group.

To post to this group, send email to rails-oceania@googlegroups.com.
To unsubscribe from this group, send email to rails-oceania+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en 
.




--
You received this message because you are subscribed to the Google Groups Ruby or 
Rails Oceania group.
To post to this group, send email to rails-oceania@googlegroups.com.
To unsubscribe from this group, send email to 
rails-oceania+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.



Re: [rails-oceania] Crazy cases for Mac directories

2011-01-16 Thread Chris Berkhout
I tried with other rubies, but had the same issue.

I think I've resolved it by doing sudo mv /users /Users.

Still not sure why it happened at all. The only thing I can think of
is that in the past while doing and OS reinstall I may have copied the
Users directory onto a non-HFS+ filesystem and then back.

Thanks for the good tips!
Chris

-- 
You received this message because you are subscribed to the Google Groups Ruby 
or Rails Oceania group.
To post to this group, send email to rails-oceania@googlegroups.com.
To unsubscribe from this group, send email to 
rails-oceania+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.



Re: [rails-oceania] Crazy cases for Mac directories

2011-01-16 Thread Chris Berkhout
Hi Clifford,

I think you're right about different implementations giving different results.

Unfortunately the C code doesn't really say anything now, because I'd
already done sudo mv /users /Users and everything is coming back
uppercase.

But since that renaming brought everything into line, there must have
been and uppercase version and a lowercase version stored somewhere,
rather than a single true name being differently interpreted by
various implementations.

Cheers,
Chris


On Mon, Jan 17, 2011 at 8:22 AM, Clifford Heath
clifford.he...@gmail.com wrote:
 Chris,

 I don't think this is a Ruby thing, but comes from the different ways
 Ruby gets the information. getpwuid gets your password entry from
 the password database. Dir[/] reads the content of the root directory.
 The env, well, you know.

 I'm not sure what the Mac implementation of Dir.pwd does, but it could
 not be any of the above. One BSD implementation I knew had a very
 clunky method: it would progressively read the entries in .., ../..,
 ../../..,
 etc, and match the inode numbers with ., .., ../.., etc. I suspect that
 Apple
 has replaced that, as most unices have, with a kernel implementation,
 but I can't see it documented in /usr/share/man/man2.

 https://github.com/ruby/ruby/blob/trunk/dir.c says it's implemented using
 my_getcwd, which is probably just a wrapper for getcwd (man 3 getcwd)
 from the Apple standard library. Try a little C program and tell us what it
 says:

 #include unistd.h
 void main()
 {
        char buf[1024];
        getcwd(buf, sizeof(buf));
        puts(buf);
        exit(0);
 }

 Clifford Heath.

 On 16/01/2011, at 10:59 PM, Chris Berkhout wrote:

 Hi All,

 Today I was surprised to find that the U in Users is uppercase
 (which I consider correct) in:

 Etc.getpwuid.dir = /Users/chrisberkhout
 Dir.entries(/) = [..., Users, ...]
 ENV['PWD']       = /Users/chrisberkhout

 But lowercase in:

 Dir.pwd               = /users/chrisberkhout
 File.expand_path('.') = /users/chrisberkhout

 Also,
 - Manually changing into the uppercase directory doesn't help.
 - Deeper directories with uppercase letters seem fine.
 - Other root-level directories with uppercase letters seem fine.

 Anyone else run into this issue?

 Cheers,
 Chris

 --
 You received this message because you are subscribed to the Google Groups
 Ruby or Rails Oceania group.
 To post to this group, send email to rails-oceania@googlegroups.com.
 To unsubscribe from this group, send email to
 rails-oceania+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/rails-oceania?hl=en.


 --
 You received this message because you are subscribed to the Google Groups
 Ruby or Rails Oceania group.
 To post to this group, send email to rails-oceania@googlegroups.com.
 To unsubscribe from this group, send email to
 rails-oceania+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/rails-oceania?hl=en.



-- 
You received this message because you are subscribed to the Google Groups Ruby 
or Rails Oceania group.
To post to this group, send email to rails-oceania@googlegroups.com.
To unsubscribe from this group, send email to 
rails-oceania+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.