Skip to content

Conversation

@Sapphire64
Copy link
Member

@Sapphire64 Sapphire64 commented Oct 16, 2025

For one of the issues we've seen internally, wrapping the command call into shell to avoid the issue.

Related: https://github.com/Shopify/team-ruby-dx/issues/1724

@Sapphire64 Sapphire64 marked this pull request as ready for review October 16, 2025 15:43
@Sapphire64 Sapphire64 requested a review from a team as a code owner October 16, 2025 15:43
Copy link
Contributor

@Morriar Morriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be clearer to call /bin/sh -c instead?

@Sapphire64
Copy link
Member Author

@Morriar that was the original version but it adds a complexity of having to handle two types of quotes in the string, so a bit more noisy and error-prone. I can change it to /bin/sh if we want to.

Because I was not able to reproduce the issue in local Spoom tests, I personally believe that the fix here is not necessary, and we should find the core issue, while using this branch as a relief point for the team and a guidance on where to look for.

@egiurleo
Copy link
Contributor

egiurleo commented Dec 1, 2025

This is a complex issue so I wanted to share my current understanding of how and why it's happening:

At Shopify, many of our dev environments are set up with Nix. In some of our Nix-ified environment, Nix wraps Ruby in an execution script that sets DYLD_LIBRARY_PATH to include libtiff-4.7.0/lib.

This libtiff directory contains the following file: libcxx-19.1.7/lib/libc++.1.0.dylib. This is Nix's version of the C++ standard library. Separately, Sorbet attempts to load whatever version of C++ comes standard on the user's machine. These two versions of C++ stdlib are incompatible with one another, resulting in bugs in Sorbet, such as corrupted JSON output.

Shelling out from Ruby mitigates the issue because it forces commands to execute from the system shell, where Sorbet will only load the system version of C++ stdlib, thus preventing the error.

@egiurleo egiurleo merged commit d896589 into main Dec 1, 2025
8 checks passed
@egiurleo egiurleo deleted the shell-wrapper branch December 1, 2025 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants