Skip to content

fs.glob never matches dot files, even with explicit dot patterns #28021

Description

@Aquaticat

What version of Bun is running?

1.3.10+30e609e08

What platform is your computer?

Linux 6.17.7-ba28.fc43.x86_64 x86_64 unknown

What steps can reproduce the bug?

mkdir /tmp/glob-test && touch /tmp/glob-test/.hidden /tmp/glob-test/visible
import { glob } from 'node:fs/promises';

for await (const match of glob('/tmp/glob-test/*')) console.log(match);
for await (const match of glob('/tmp/glob-test/.*')) console.log(match);
for await (const match of glob('/tmp/glob-test/.hidden')) console.log(match);

Run with bun run file.ts on Bun 1.3.10.

What is the expected behavior?

Node.js v22 output:

/tmp/glob-test/visible
/tmp/glob-test/.hidden
/tmp/glob-test/.hidden

Wildcard * skipping dot files is expected (standard minimatch behavior).
Explicit patterns .* and .hidden should match.

What do you see instead?

Bun output:

/tmp/glob-test/visible

All three patterns produce no results for dot files. Even the literal path .hidden returns nothing.

Additional information

mapOptions in src/js/internal/fs/glob.ts delegates to Bun.Glob.scan() but never sets dot: true in the scan options. Bun.Glob defaults dot to false (in src/bun.js/api/glob.zig), which suppresses dot-file entries at the scanner level before pattern matching occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions