Stale completion definitions in zcompdump cache
0 reputation · 12 Oct 2024, 12:00 UTC
The zsh completion system uses compinit to initialize and zcompdump to cache completion definitions. This mechanism is designed to reduce shell startup latency by avoiding the repeated parsing of completion functions across sessions.
A known behavior occurs when underlying completion scripts or system binaries are updated, but the .zcompdump file persists. Because the completion system does not natively implement a checksum or timestamp validation for individual cached entries, the shell continues to use outdated completion logic until the cache is manually cleared.
In environments with frequent package updates, this creates a discrepancy between the installed tool's capabilities and the shell's suggested arguments.
- Does zsh provide a programmatic way to invalidate specific entries within the dump file without deleting the entire cache?
- Is there a configuration option to enable automatic cache expiration based on the modification time of the completion scripts?