Skip to content

Commit

Permalink
age out: properly clean up lc_files linkage too
Browse files Browse the repository at this point in the history
Summary: didn't catch this last night because I was focused mostly on
Linux.  On case insensitive filesystems we also need to clean up the
lc_files linkage to avoid a crash during age out.

The multiple attempts I added to the integration test trigger this
issue: `arc unit tests/integration/age.php`

Refs: #96
  • Loading branch information
wez committed Apr 26, 2015
1 parent 3030827 commit 8fb6997
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arcanist/lib/WatchmanInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,14 @@ function start() {
throw new Exception("Failed to talk to watchman on $sockname");
}
stream_set_timeout($this->sock, self::TIMEOUT);

// If you're debugging and want to attach a debugger, then:
// `WATCHMAN_DEBUG_WAIT=1 arc unit tests/integration/age.php`
// then gdb -p or lldb -p with the PID it prints out
if (getenv("WATCHMAN_DEBUG_WAIT")) {
printf("PID: %d\n", $this->getProcessID());
sleep(10);
}
}

private function fwrite_all($sock, $buf) {
Expand Down
11 changes: 11 additions & 0 deletions root.c
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,17 @@ static void age_out_file(w_root_t *root, w_ht_t *aged_dir_names,
// Remove the entry from the containing dir hash
w_ht_del(file->parent->dirs, w_ht_ptr_val(full_name));
}
if (file->parent->lc_files) {
// Remove the entry from the containing lower case files hash,
// but only it it matches us (it may point to a different file
// node with a differently-cased name)
w_string_t *lc_name = w_string_dup_lower(file->name);
if (w_ht_get(file->parent->lc_files, w_ht_ptr_val(lc_name))
== w_ht_ptr_val(file)) {
w_ht_del(file->parent->lc_files, w_ht_ptr_val(lc_name));
}
w_string_delref(lc_name);
}

// resolve the dir of the same name and mark it for later removal
// from our internal datastructures
Expand Down

0 comments on commit 8fb6997

Please sign in to comment.