Skip to content

Commit e61d0f2

Browse files
authored
Correct {DSK} versioned file cache failures (#526)
A missing check for the applicability of a versioned file cache caused loadups to fail in the case where the modification timestamp of a directory and its parent were identical, and the file being looked up had the same name (when lowercased) as the directory it was contained within. E.g., looking up TEDIT in library/tedit/ where the modification times of library and library/tedit were identical. The inode number of the directory containing the file must be the same as the inode number of the directory the cache was built from.
1 parent 3c4d9f5 commit e61d0f2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/dsk.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ typedef struct filename_entry {
6666
*/
6767
static struct {
6868
char name[MAXPATHLEN]; /* lowercase unversioned file name */
69+
ino_t dir_ino; /* inode of the directory */
6970
struct timespec lastMTime; /* modification time of the directory */
7071
int allocated; /* number of entries in the files array */
7172
int lastUsed; /* index of the last entry in use in files array */
@@ -3055,11 +3056,13 @@ static int get_version_array(char *dir, char *file)
30553056
*Lisp_errno = errno;
30563057
return(0);
30573058
}
3058-
if (0 == strcmp(lcased_file, VA.name) &&
3059+
if (sbuf.st_ino == VA.dir_ino &&
3060+
0 == strcmp(lcased_file, VA.name) &&
30593061
sbuf.st_mtim.tv_sec == VA.lastMTime.tv_sec &&
30603062
sbuf.st_mtim.tv_nsec == VA.lastMTime.tv_nsec) {
30613063
return (1);
30623064
} else {
3065+
VA.dir_ino = sbuf.st_ino;
30633066
VA.lastMTime = sbuf.st_mtim;
30643067
strcpy(VA.name, lcased_file);
30653068
}

0 commit comments

Comments
 (0)