Skip to content

Conversation

@lsq
Copy link

@lsq lsq commented Sep 27, 2025

Checklist
  • npm install && npm run lint && npm test passes
  • tests are included
  • documentation is changed or added
  • commit message follows commit guidelines
Description of change

related issue: nodejs#3120

Summary by Sourcery

Bug Fixes:

  • Remove surrounding double quotes in paths to handle MINGW node -p output

@sourcery-ai
Copy link

sourcery-ai bot commented Sep 27, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR updates the makefile generator's Absolutify method to strip enclosing double quotes from paths returned by node -p on MINGW, preventing incorrect path handling.

Class diagram for updated Absolutify method in Makefile generator

classDiagram
    class MakefileGenerator {
        +Pchify(path, lang)
        +Absolutify(path)
    }
    MakefileGenerator : Absolutify(path)
    MakefileGenerator : "path = path.strip('"')" // new line added to strip double quotes
Loading

File-Level Changes

Change Details Files
Strip enclosing double quotes in Absolutify to handle MINGW node -p paths
  • Add docstring noting MINGW node -p behavior
  • Insert path = path.strip('"') at the start of Absolutify
gyp/pylib/gyp/generator/make.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@gemini-code-assist
Copy link

Summary of Changes

Hello @lsq, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the robustness of path handling within the gyp build system, specifically targeting environments where node -p might return paths enclosed in double quotes, such as in MINGW on Windows. By introducing a simple stripping mechanism, the change prevents potential issues arising from malformed paths, ensuring that build processes can correctly interpret and utilize file system locations.

Highlights

  • Path Handling Improvement: This change addresses an issue where paths returned by node -p in MINGW environments might include double quotes, which could lead to incorrect path resolution.
  • Quote Stripping Implementation: A fix has been implemented in the Absolutify function within gyp/pylib/gyp/generator/make.py to explicitly strip double quotes from the path variable, ensuring cleaner path processing.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses an issue where paths returned by node -p on MINGW may be enclosed in double quotes. The change correctly strips these quotes in the Absolutify method. My feedback focuses on improving the code style of the comment explaining this change to align with Python best practices.

Comment on lines +2487 to +2488
"""In MINGW node -p return a path with double quote"""
path = path.strip('"')

Choose a reason for hiding this comment

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

medium

This string literal acts as a comment, but it's better to use a standard hash (#) comment for clarity and to follow Python conventions. String literals that are not docstrings or assigned to variables are evaluated and then discarded, which can be slightly less efficient and might be confusing to other developers. I've also slightly rephrased the comment for clarity.

Suggested change
"""In MINGW node -p return a path with double quote"""
path = path.strip('"')
# In MINGW, `node -p` can return a path enclosed in double quotes.
path = path.strip('"')

"""Convert a subdirectory-relative path into a base-relative path.
Skips over paths that contain variables."""
"""In MINGW node -p return a path with double quote"""
path = path.strip('"')
Copy link

Choose a reason for hiding this comment

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

Given that this is a MINGW-only issue, would there be a way to rewrite as:

if on_mingw:
    path = path.strip('"')

Copy link
Author

Choose a reason for hiding this comment

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

Kreijstal‘s fork be used for msys2 user,any plan merge to officail repo need to check MINGW platform.

Copy link
Owner

Choose a reason for hiding this comment

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

I mean yes but this branch is also a PR itself
nodejs#3166
so I would like to be friendly with node-gyp upstream eventually they should merge it of course...

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.

3 participants