Skip to content

Conversation

eramongodb
Copy link
Contributor

Followup to #678, which replaced the prior "rename blah.exe to blah" routines with a call to find -exec ln -s (symlink instead of rename). However, on Windows distros, this command seems to spuriously fail with the following error:

find: The environment is too large for exec().

Per find docs:

This message means that you have so many environment variables set (or such large values for them) that there is no room within the system-imposed limits on program command line argument length to invoke any program. This is an unlikely situation and is more likely result of an attempt to test the limits of xargs, or break it. Please try unsetting some environment variables, or exiting the current shell. You can also use ‘xargs --show-limits’ to understand the relevant sizes.

Although I am not entirely sure what is causing this error (too many env vars? an env var (probably PATH) that is too big?), this PR implements two workarounds to mitigate both possibilities:

  • check for redundancy before adding a new entry to PATH using Bash's built-in POSIX extended regex support, and
  • use Bash filename expansion (aka globbing) instead of find to lookup blah.exe candidates.

An additional check before ln -s is included to prevent the following error:

ln: 'mongodl.exe' and 'mongodl' are the same file

@eramongodb eramongodb requested a review from blink1073 August 25, 2025 15:04
@eramongodb eramongodb self-assigned this Aug 25, 2025
Copy link
Member

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@eramongodb eramongodb merged commit 7ee71b5 into mongodb-labs:master Aug 25, 2025
77 checks passed
@eramongodb eramongodb deleted the det-cygwin-find branch August 25, 2025 16:53
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.

2 participants