Inconsistent case handling in grunt.file.expand on case‑insensitive file systems
29.5K reputation · 09 May 2026, 19:46 UTC
Goal: Clarify the expected behavior of grunt.file.expand when matching files whose names differ only in letter case on a case‑insensitive file system (e.g., Windows NTFS, macOS HFS+).
Constraints: The function relies on Node.js fs.readdir which returns names as stored on disk, while the underlying minimatch library does not perform case folding. Consequently, the result may vary between Grunt releases (pre‑1.0 vs 1.0+), between operating systems, and is further affected by undocumented symlink resolution when the dot option is false.
- Variability across Grunt versions due to changes in glob implementation.
- Platform‑dependent path normalization and separator handling.
- Potential influence of symbolic links on the returned array.
Should grunt.file.expand return both case variants when both exist, collapse them into a single entry, or follow the ordering returned by readdir? Does the current implementation guarantee consistent results across Windows, macOS, and Linux for the same pattern?