From: stephen.hill@... (Steve Hill) Date: 2001-10-30T00:21:13+09:00 Subject: [ruby-talk:23728] Re: Dir.chdir behaviour (was `pwd` behaviour in ruby?) To go one step further, I think that this may be a bug/feature that is OS dependant. Here is the source of the dir_chdir method which is called by dir_s_chdir (taken from the CVS tree - dir.h v 1.5.4) static void dir_chdir(path) const char *path; { if (chdir(path) < 0) rb_sys_fail(path); } As you can see, it simply invokes the chdir() call. Now, the following short c program (chdir_test.c) illustrates the behaviour of chdir(): #include #include char *tmp="/home/stehill1/tmp/test"; char cwd[256], nwd[256]; FILE* p; int main (void) { p=popen("sh -c pwd","r"); /* fscanf(p,"%s",cwd); pclose(p); chdir(tmp); p=popen("sh -c pwd","r"); fscanf(p,"%s",nwd); pclose(p); puts(cwd); puts(nwd); } and this has the following output.... 1. Under HP-UX 10.4 delaware% ./chdir_test /home/stehill1/tmp /tmp_mnt/home/stehill1/tmp/test 2. Under Linux (i386) % ./chdir_test /home/stehill1/tmp /home/stehill1/tmp/test so the chdir() call is changing the directory to the absolute local path under HP-UX, but not under linux. As I said, I don't have a solution at the moment. Maybe, if other people are using other architectures they could try running the short test program I have included, and we could start by working out which architectures it affects. Best regards Steve