deepseek-ai / deepseek-ai/DeepJIT

Temporary cache cleanup follows directory symlinks and deletes target contents

Open
#2 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
310
Forks
26
Avg merge
4m
Merged PRs (30d)
1

Description

When a compiler or post-compilation hook leaves a directory symlink in a temporary build, `DiskCacheEntry` cleanup follows the link and removes files from its target. Dangling symlinks are skipped, which can also leave temporary directories behind.

Reproduced at `8b3ef868705a3792cc1a14ab570b539f72fd3d94` on Linux, using disposable directories:

1. Create an outside directory containing a sentinel file.
2. Obtain a cache miss with `DiskCache::entry`.
3. Create a directory symlink inside `entry.path` pointing to the outside directory.
4. Destroy the uncommitted entry, as happens when compilation throws.
5. The sentinel has been deleted. With a dangling link instead, the temporary entry is not fully removed.

Expected: cleanup removes the symlink itself and preserves its target. The same expectation applies when the path passed to the cleanup helper is itself a symlink.

[`safe_remove_all`](https://github.com/deepseek-ai/DeepJIT/blob/8b3ef868705a3792cc1a14ab570b539f72fd3d94/include/deep_jit/utils/filesystem.hpp#L88-L107) uses path-based `exists` and `is_directory`, which follow links before recursion. This reproduction uses stable paths in a trusted cache; it does not require a concurrent path replacement.

The custom walker can be retained while classifying each entry with `symlink_status`. Regression coverage should include directory, file, and dangling links, ordinary directories, and cleanup after a failing CUDA post-hook.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.