Xref: utzoo comp.unix.i386:6719 comp.unix.wizards:22835 Path: utzoo!attcan!uunet!zephyr.ens.tek.com!uw-beaver!mit-eddie!snorkelwacker!usc!ucsd!pacbell.com!pacbell!osc!osc.com From: strick@osc.com (henry strickland) Newsgroups: comp.unix.i386,comp.unix.wizards Subject: Re: i386 unix with NFS - getcwd() & /bin/pwd inode problem Message-ID: <3023@osc.COM> Date: 11 Jul 90 07:15:46 GMT References: Sender: strick@osc.COM Reply-To: strick@osc.com (henry strickland) Followup-To: comp.unix.i386 Distribution: na Organization: the techwood toaster pastry users group, georgia tech Lines: 46 Denny@tss.com (Denny Page) writes: >When you are in a directory which is mounted via nfs, and the inode of >the current directory is > 65535 (such as on a sun), /bin/pwd reports >"read error in .." Getcwd() uses /bin/pwd to do its work, and as such >doesn't function. Is anyone aware of a fix or a work around for this? Then it sounds like an easy fix: just rewrite /bin/pwd (seems like you understand what it takes to do that). If all your applications didn''t fork /bin/pwd, you''d be hosed. I reverse engineered (for the most part) the algorithm used in sunos4''s getwd() command by writing a tiny program something like #include char pathname[MAXPATHLEN]; char *getwd(); extern errno; main() { char *cp= getwd(pathname); if ( cp ) return printf("getwd: ``%s''\n", pathname), 0; else return printf("getwd: ERROR: %s\n", pathname), errno; } and then set gdb breakpoints (don''t forget -Bstatic) at all your favorite man 2 calls: open close creat read write stat lstat fstat opendir readdir etc. and run the program. Something like "display (char*) ($fp+4)" on a 68k will display the first arg of each system call, often a filename. I was surprised to see it open and read "/etc/mtab". Nice hack. strick.