Skip to content

Home directory incorrectly detected as Bazel project when ~/workspace directory exists on macOS #1961

@tofuya

Description

@tofuya

Expected behavior

Projectile should not treat the home directory as a Bazel project when only a ~/workspace directory exists (and no WORKSPACE file).

Actual behavior

Projectile incorrectly recognizes the home directory (/Users/foo/) as a Bazel project even though there is no WORKSPACE file directly under $HOME.
When a directory named ~/workspace exists, running M-x projectile-project-info shows:

Project dir: /Users/foo/
Project VCS: none
Project type: bazel

If I rename ~/workspace to something else (e.g. ~/workspaces), then $HOME is no longer treated as a project.

This seems to be a side effect of macOS’s case-insensitive filesystem, which makes workspace and WORKSPACE indistinguishable in certain checks.
It causes Projectile to falsely identify $HOME as a Bazel project, even though no marker file exists.

As a result, Projectile treats the entire home directory as a project, leading to severe performance degradation in downstream environments (e.g. Spacemacs, pet-mode) when opening files under $HOME.

Steps to reproduce the problem

  1. On macOS, create a directory named ~/workspace
  2. Start Emacs with Projectile enabled
  3. Execute M-x projectile-project-info
  4. Observe that the home directory is recognized as a Bazel project
  5. Rename ~/workspace~/workspaces and see that the issue disappears

Additional notes

This issue causes significant performance problems downstream (see syl20bnr/spacemacs#17142 and related reports).
In my case, simply opening a Python file under $HOME can take several minutes if Projectile misidentifies $HOME as a project.

Environment & Version information

Projectile version

Projectile version: 20250704.908

Emacs version

GNU Emacs 30.1

Operating system

macOS 13.7.8.1

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions