From: Marko Schulz Date: 2003-08-06T01:06:46+09:00 Subject: Re: Log4r and Ruby 1.8.0 in Singleton problems On Tue, Aug 05, 2003 at 11:46:07PM +0900, Dave Thomas wrote: > Marko Schulz wrote: > > > >>I have never understood this: why doesn't Ruby store the cannonical > >>(fully expanded) path name; that would eliminate this kind of problem. > > > >I always thought this isn't done, so the programmer isn't deluded a > >false sense of security: There isn't always _the_ cannonical > >path. Think of filesystems that ignore the case in filenames. (Not to > >mention (symbolic and hard) links or alias names (single~1.rb) > > > > > 1. Would it be worse than it is now? If there is a solution: Great! I don't really have enough cross-platform knowledge to decide whether it is possible; but on the platforms I know, it already seems awkward, to detect for sure, whether a file already has been read (maybe somebody should look how others do it): > 2. Why couldn't Ruby make the name cannonical. On a Unix-based box, for > example, it could store the i-node number. Besides the number of the i-node you would at least have to store the mount point (or the device?). Here I have to files on different devices with the same inode: $ ls -di /usr/include/netax25 /home/marko/musik/Farin_Urlaub/Endlich_Urlaub 374641 /home/marko/musik/Farin_Urlaub/Endlich_Urlaub 374641 /usr/include/netax25 But even then, I wouldn't be sure, that every filesystem on every unices uses reliable i-node numbers. Under Linux they are at least not stable across remounts for a FAT-FS: $ ls -i /mnt/dos/autoexec.bat 67756 /mnt/dos/autoexec.bat $ sudo umount /mnt/dos/ $ sudo mount /mnt/dos/ $ ls -i /mnt/dos/autoexec.bat 67757 /mnt/dos/autoexec.bat > Surely every operating system > has _some_ way to get to a single target identifier for a given file? Maybe just storing the full path is already enough (resolving all ../'s and maybe symlinks). Maybe storing a md5sum for each file is enough. Maybe somebody just has to try it. -- marko schulz