From: matt_armstrong AT bigfoot DOT com (Matt Armstrong) Subject: hash_path_name fix for "dir/." 31 Jan 1999 18:33:30 -0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" To: cygwin32-developers AT cygnus DOT com This is a MIME multipart message. If you are reading this, you shouldn't. --=-=-= The attached patch fixes a bug in hash_path_name(). hash_path_name() currently hashes foo and foo/ the same, but it will hash foo/. differently. The patch causes all three to hash to the same value/inode. (I've mailed this to cygwin32-developers before, but I wasn't on the list at the time. Lemme know if it has already been applied.) --=-=-= Content-Type: application/x-patch Content-Disposition: attachment; filename=hash_path_name.patch Content-Transfer-Encoding: 8bit Content-Description: hash_path_name fix for path/. *** path.cc.orig Thu Jan 21 23:05:36 1999 --- path.cc Thu Jan 21 23:03:44 1999 *************** hash_path_name (unsigned long hash, cons *** 1757,1770 **** } hashit: ! /* Build up hash. Ignore single trailing slash or \a\b\ != \a\b ! but allow a single \ if that's all there is. */ do { hash += *name + (*name << 17); hash ^= hash >> 2; } ! while (*++name != '\0' && (*name != '\\' || name[1] != '\0')); return hash; } --- 1757,1775 ---- } hashit: ! /* Build up hash. Ignore trailing \ or \. so \a\b\ == \a\b and ! \a\b\. == \a\b but hash a single \ for \ or \. */ do { hash += *name + (*name << 17); hash ^= hash >> 2; + ++name; + if (name[0] == '\\' && + (name[1] == '\0' || + (name[1] == '.' && name[2] == '\0'))) + break; } ! while (*name); return hash; } *** ChangeLog.orig Thu Jan 21 23:05:32 1999 --- ChangeLog Thu Jan 21 23:08:42 1999 *************** *** 0 **** --- 1,5 ---- + 1999-01-21 Matt Armstrong + + * path.cc (hash_path_name): Ignore trailing "\." when calculating + pathname hash. + --=-=-= --=-=-=--