Skip to content

Bootsnap changes require's memoizing behavior vs vanilla Ruby #264

@nelhage-stripe

Description

@nelhage-stripe

In vanilla MRI, if you require a file via absolute path, which is also present on $LOAD_PATH, MRI internally caches it under its relative path, and will allow it to satisfy future require "relative/path" calls, even if such a call would otherwise resolve to a file earlier in $LOAD_PATH.

bootsnap does not properly implement this behavior, resulting in a difference in behavior versus MRI's require, which turned out to break our application. This is honestly an odd behavior for us to be relying on and I'm going to attempt to work around it locally, but I wanted to report the bug for visibility.

This behavior is rather unclear to me from the Ruby documentation, and arguably this could be reported as an MRI bug instead.

I've built a simple reproducer that demonstrates different behavior under bootsnap and without here: https://github.com/nelhage-stripe/bootsnap-reproducer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions