[turbopack] Improve handling of symlink resolution errors in track_glob and read_glob (#83357)
# Improve symlink handling in turbo-tasks-fs
This PR enhances symlink handling in the filesystem layer to better handle error cases and provide more detailed error messages. The key changes include:
- Refactored `realpath_with_links` to return a more structured error instead of silently returning the input path when hitting a resolution error
- propagate this through the callers
- Improved `DirectoryEntry::Error` to include error messages instead of just signaling an error occurred
- Enhanced `resolve_symlink()` to handle more edge cases like dead symlinks
These changes make the system more robust when dealing with complex symlink scenarios, including symlink loops, dead links, and excessive symlink chains.
A few customers have hit errors where broad tailwind globs cause turbopack to navigate through symlinks that trigger crashes, this is due a a few reasons:
* a symlink pointing at a non-existent file.
* a symlink pointing outside the filesystem root
This can happen with certain package managers and we need to be defensive. For `track_glob` we just want to track matching files and directories, but we don't want to navigate out of the filesystem so just ignore links that trigger these conditions.
Closes PACK-5383
One interesting thing is that `read_glob` does not resolve symlinks, and therefore doesn't trigger the errors, that behavior is unchanged.