Skip to content

test: Incorrect assumptions on the user uid and gid #19371

Description

@gireeshpunathil
  • Version: master
  • Platform: UNIX
  • Subsystem: test

The count of expected errors here does not take into consideration of the conditionals here and is assumed to be always true.

This fails always if the user is root or sometimes in containers where process.getuid() and process.getgid() can be 0.

ref: nodejs/help#687

Activity

  1. added
    testIssues and PRs related to Node.js core tests and test infrastructure.
    on Mar 15, 2018
  2. bnoordhuis commented on Mar 19, 2018

    @bnoordhuis
    Member

    @gireeshpunathil Links to branches (master) aren't stable. Use links to tags or commits.

    Pro tip: if you go to https://github.com/nodejs/node/blob/master/test/parallel/test-child-process-spawnsync-validation-errors.js#L14 and press y, it turns the URL into a commit link.

  3. garwahl commented on Mar 22, 2018

    @garwahl
    Contributor

    @gireeshpunathil How would I begin working on this? Could you elaborate on what needs to be done

  4. gireeshpunathil commented on Mar 22, 2018

    @gireeshpunathil
    MemberAuthor

    @garwahl -

    this line has the number of expected errors statically determined to be 62. This is based on the assumption of the condition at here and here will be true. When ran as root or ran in certain Containers, this may not be the case.

    So:

    1. Count the # of invalidArgTypeError that comes under these two sections separately.
    2. Define 1 variabales, assign 62 to that
    3. if not windows && process.getuid() === 0, reduce the count of invalidArgTypeError coming from that block, from the variable: 10
    4. if not windows && process.getgid() === 0, reduce the count further accordingly.
    5. apply the variable in place of 62.
    6. Add one liner comment against each of your changes so that someone does not stumble on the same issue in future.
    7. test in windows, non-windows, container & non-container environments if possible.

    Hope this helps!

  5. garwahl commented on Mar 22, 2018

    @garwahl
    Contributor

    Thanks, I'll make a start and let you know if I run into any issues.

  6. garwahl commented on Mar 27, 2018

    @garwahl
    Contributor

    @gireeshpunathil Please review PR when free, thanks

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueIssues that are suitable for first-time contributors.testIssues and PRs related to Node.js core tests and test infrastructure.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions