Skip to content

Ensure DEBUG is unset when executing bundle show#8891

Closed
iangreenleaf wants to merge 2 commits intoactiveadmin:masterfrom
iangreenleaf:unset-debug-in-bundle-show
Closed

Ensure DEBUG is unset when executing bundle show#8891
iangreenleaf wants to merge 2 commits intoactiveadmin:masterfrom
iangreenleaf:unset-debug-in-bundle-show

Conversation

@iangreenleaf
Copy link
Contributor

This was an unpleasant bug I ran into while trying to get my source compilation sorted out (cruelly, I had turned DEBUG on to help me troubleshoot a different problem).

If DEBUG is set at all in the environment, even as an empty string with DEBUG=, bundler will output an extra message:

Found no changes, using resolution from the lockfile

Because this goes to stdout, it gets included in the path the config file is using and asset compilation fails. Given that other people may well have this set in their envs for legitimate reasons, it seems wise to take precautions to ensure it doesn't blow up asset compilation.

@tagliala
Copy link
Contributor

Hi, thanks for this PR.

I see the problem and I can replicate, however it seems that unset is not cross platform (do not have a windows machine at the moment to test, I'm using copilot + claude)

Cross-Platform Summary

Platform Command Works?
macOS/Linux unset DEBUG ✅ Yes
Windows cmd unset DEBUG ❌ No (command not found)
Windows cmd set DEBUG= ⚠️ Sets empty string (still triggers debug)
Windows PowerShell Remove-Item Env:\DEBUG ✅ Yes
Git Bash (Windows) unset DEBUG ✅ Yes

|> WSL (Windows) | unset DEBUG | ✅ Yes |

It advises to use javascript like this:

For your JavaScript use case:

Since you need cross-platform support, do NOT use shell commands. Use the Node.js approach:

const { execSync } = require('child_process');

const env = { ...process.env };
delete env.DEBUG;

const activeAdminPath = execSync('bundle show activeadmin', { 
  encoding: 'utf-8',
  env: env
}).trim();

This is truly cross-platform because Node.js handles the environment variables internally, regardless of the underlying shell.

I'm not familiar with this process, so I'll leave the decision to others


PS: The CI looks broken, it looks like something is wrong with bundler and the latest version does not match the installed version

@iangreenleaf
Copy link
Contributor Author

Oh great, that's a better solution! I was able to use destructuring to clean it up a little more.

@iangreenleaf
Copy link
Contributor Author

@tagliala I'm guessing the CI failures are unrelated to this branch and I don't need to do anything about them?

@tagliala
Copy link
Contributor

@tagliala I'm guessing the CI failures are unrelated to this branch and I don't need to do anything about them?

Sorry, I said yesterday "I'll take a look" but I forgot. I think failures are unrelated. I'll give a fix later today and I'll ping here

@tagliala
Copy link
Contributor

@iangreenleaf I've fixed the CI.

Could you please rebase and confirm that the JS-only solution fixes the issue you are experiencing? I've only tested in node console and it did work without emitting the warning

If DEBUG is set, bundler will output extra messaging to stdout, causing
an incorrect path to be set and screwing up asset compilation.
@iangreenleaf iangreenleaf force-pushed the unset-debug-in-bundle-show branch from 927d0c3 to 0614571 Compare December 22, 2025 20:36
@iangreenleaf
Copy link
Contributor Author

@tagliala I can confirm that this version is working great for me and fixes the issue!

@tagliala
Copy link
Contributor

Did the CI broke again?

@tagliala
Copy link
Contributor

Nope, this does not look like a failure caused by bundler version mismatch

tagliala pushed a commit that referenced this pull request Dec 23, 2025
When the DEBUG environment variable is set (even if empty), bundler may output
additional messages to stdout, such as "Found no changes, using resolution from
the lockfile". This can interfere with asset compilation, as scripts expecting
a single path may instead receive multiple output lines, causing path
corruption.

This commit adjusts the logic to always use the last line of the output from
`bundle show activeadmin`, preventing such issues even if extraneous lines are
present due to DEBUG or other future messaging changes.

Ref: #8891
tagliala pushed a commit that referenced this pull request Dec 28, 2025
When the DEBUG environment variable is set (even if empty), bundler may output
additional messages to stdout, such as "Found no changes, using resolution from
the lockfile". This can interfere with asset compilation, as scripts expecting
a single path may instead receive multiple output lines, causing path
corruption.

This commit adjusts the logic to always use the last line of the output from
`bundle show activeadmin`, preventing such issues even if extraneous lines are
present due to DEBUG or other future messaging changes.

Ref: #8891
@tagliala
Copy link
Contributor

Update: found the issue on the CI

That line is not used in the CI and is required to be a single line because of this:

gsub_file "tailwind-active_admin.config.js", /^.*const activeAdminPath.*$/, <<~JS
const activeAdminPath = '../../../';
JS

I'm making some experiments

tagliala pushed a commit that referenced this pull request Dec 28, 2025
When the DEBUG environment variable is set (even if empty), bundler may output
additional messages to stdout, such as "Found no changes, using resolution from
the lockfile". This can interfere with asset compilation, as scripts expecting
a single path may instead receive multiple output lines, causing path
corruption.

This commit adjusts the logic to always use the last line of the output from
`bundle show activeadmin`, preventing such issues even if extraneous lines are
present due to DEBUG or other future messaging changes.

Ref: #8891
@tagliala
Copy link
Contributor

tagliala commented Dec 30, 2025

@iangreenleaf can you please give a try at #8895 ?

Is there anyone with a windows machine available to test #8895 ? Using the CI on windows will not work because that line is being replaced

@tagliala
Copy link
Contributor

Superseded by #8895, commit ownership preserved there, thanks!

@tagliala tagliala closed this Dec 30, 2025
tagliala pushed a commit that referenced this pull request Jan 1, 2026
When the DEBUG environment variable is set (even if empty), bundler may output
additional messages to stdout, such as "Found no changes, using resolution from
the lockfile". This can interfere with asset compilation, as scripts expecting
a single path may instead receive multiple output lines, causing path
corruption.

This commit adjusts the logic to always use the last line of the output from
`bundle show activeadmin`, preventing such issues even if extraneous lines are
present due to DEBUG or other future messaging changes.

Ref: #8891
tagliala pushed a commit that referenced this pull request Jan 3, 2026
When the DEBUG environment variable is set (even if empty), bundler may output
additional messages to stdout, such as "Found no changes, using resolution from
the lockfile". This can interfere with asset compilation, as scripts expecting
a single path may instead receive multiple output lines, causing path
corruption.

This commit adjusts the logic to always use the last line of the output from
`bundle show activeadmin`, preventing such issues even if extraneous lines are
present due to DEBUG or other future messaging changes.

Ref: #8891
tagliala pushed a commit that referenced this pull request Jan 6, 2026
When the DEBUG environment variable is set (even if empty), bundler may output
additional messages to stdout, such as "Found no changes, using resolution from
the lockfile". This can interfere with asset compilation, as scripts expecting
a single path may instead receive multiple output lines, causing path
corruption.

This commit adjusts the logic to always use the last line of the output from
`bundle show activeadmin`, preventing such issues even if extraneous lines are
present due to DEBUG or other future messaging changes.

Ref: #8891
tagliala added a commit that referenced this pull request Jan 6, 2026
When the DEBUG environment variable is set (even if empty), bundler may output
additional messages to stdout, such as "Found no changes, using resolution from
the lockfile". This can interfere with asset compilation, as scripts expecting
a single path may instead receive multiple output lines, causing path
corruption.

This commit adjusts the logic to always use the last line of the output from
`bundle show activeadmin`, preventing such issues even if extraneous lines are
present due to DEBUG or other future messaging changes.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants