Skip to content

[Bug]: Dockerignore **.txt patterns do not exclude template files in either SDK #1933

Closed

Description

@siye566

Sandbox ID or Build ID

Not applicable: offline template file selection; no sandbox or build was created.

Environment

Current main a9c58ab2b81ba3d948819a55bbecae9b2617b347, JS and Python SDK 2.52.0, Windows, Node 22.23.2, Python 3.12.14, pnpm 10.34.5.

Timestamp

2026-10-02 22:34 +08:00.

Frequency

Happens every time with the local reproducer.

Expected behavior

A Dockerignore pattern **.txt should exclude paths ending in .txt, including root.txt and src/nested.txt. Moby's suffix-match implementation handles a leading ** followed by a literal suffix.

Actual behavior

Both SDKs leave these files in the list used for template copy. The port always compiles a non-final ** into (.*/)?, omitting Moby's literal-suffix case. **.txt therefore matches a filename literally named .txt, rather than root.txt.

Reproduction

No API key or cloud sandbox is needed:

from pathlib import Path
from tempfile import TemporaryDirectory
from e2b.template.utils import get_all_files_in_path

with TemporaryDirectory() as context:
    root = Path(context)
    (root / "src").mkdir()
    (root / "root.txt").write_text("x")
    (root / "src" / "nested.txt").write_text("x")
    files = get_all_files_in_path(".", context, ["**.txt"])
    print([Path(p).relative_to(root).as_posix() for p in files])

On main, the output contains both root.txt and src/nested.txt; neither should be present. Equivalent regression tests through JS getAllFilesInPath and Python get_all_files_in_path both failed before applying the fix.

Additional context

This is a remaining edge case after #1917, not a proposal to replace that fix. A focused patch is prepared in both SDKs, with tests for root/nested paths, literal suffix escaping, negation, and subsequent wildcard syntax. No new dependencies. AI-assisted with Codex; reproduction and SDK-scoped offline checks were executed locally.

Activity

  1. added
    bugSomething isn't working
    sdkImprovements or additions to SDKs
    on Oct 2, 2026
  2. devin-ai-integration commented on Oct 2, 2026

    @devin-ai-integration
    Contributor

    Triage

    • type: bug
    • priority: medium
    • complexity: small
    • affected_area: js-sdk/template + python-sdk/template (dockerignore pattern matching in getAllFilesInPath / get_all_files_in_path)
    • actionable: yes
    • needs_clarification: false
    • summary: In both SDKs, the dockerignore-to-regex port compiles a non-final leading ** as (.*/)?, so a pattern like **.txt doesn't exclude root.txt or src/nested.txt (Moby treats it as a literal-suffix match). Clear offline repro included; the reporter says this is an edge case left over after fix(sdk): apply .dockerignore patterns Docker-style when copying template files #1917 and has a patch ready.

    Written by Devin

  3. devin-ai-integration commented on Oct 5, 2026

    @devin-ai-integration
    Contributor

    @siye566 thanks for reporting this and for the clear offline repro (and for #1934). The fix shipped in #1935: a leading ** followed by literal characters (e.g. **.txt) now matches at any depth, as it does in BuildKit, in both SDKs.

    It's in e2b 2.52.1 (JS SDK on npm and Python SDK on PyPI):

    npm i [email protected]
    pip install -U e2b==2.52.1
    

    Written by Devin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsdkImprovements or additions to SDKs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions