{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/19594","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/19594/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/19594/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/19594/events","html_url":"https://github.com/nodejs/node/issues/19594","id":308344113,"number":19594,"title":"test: Errors when running tests as root `sudo make test`","user":{"login":"dsinecos","id":24248411,"avatar_url":"https://avatars3.githubusercontent.com/u/24248411?v=4","gravatar_id":"","url":"https://api.github.com/users/dsinecos","html_url":"https://github.com/dsinecos","followers_url":"https://api.github.com/users/dsinecos/followers","following_url":"https://api.github.com/users/dsinecos/following{/other_user}","gists_url":"https://api.github.com/users/dsinecos/gists{/gist_id}","starred_url":"https://api.github.com/users/dsinecos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsinecos/subscriptions","organizations_url":"https://api.github.com/users/dsinecos/orgs","repos_url":"https://api.github.com/users/dsinecos/repos","events_url":"https://api.github.com/users/dsinecos/events{/privacy}","received_events_url":"https://api.github.com/users/dsinecos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-03-25T12:04:25Z","updated_at":"2018-03-31T08:55:43Z","closed_at":null,"author_association":"NONE","body":"<!--\r\nThank you for reporting an issue.\r\n\r\nThis issue tracker is for bugs and issues found within Node.js core.\r\nIf you require more general support please file an issue on our help\r\nrepo. https://github.com/nodejs/help\r\n\r\n\r\nPlease fill in as much of the template below as you're able.\r\n\r\nVersion: output of `node -v`\r\nPlatform: output of `uname -a` (UNIX), or version and 32 or 64-bit (Windows)\r\nSubsystem: if known, please specify affected core module name\r\n\r\nIf possible, please provide code that demonstrates the problem, keeping it as\r\nsimple and free of external dependencies as you are able.\r\n-->\r\n\r\n* **Version**: master\r\n* **Platform**: 16.04.1, Ubuntu\r\n* **Subsystem**: test\r\n\r\n<!-- Enter your issue details below this comment. -->\r\n\r\nWhen running tests as root, `sudo make test` I get the following errors\r\n\r\nError 1 -\r\n```\r\n=== release test-child-process-spawnsync-validation-errors ===                 \r\nPath: parallel/test-child-process-spawnsync-validation-errors\r\nMismatched innerFn function calls. Expected exactly 62, actual 42.\r\n    at Object.exports.mustCall (/home/divyanshu/programming/node/test/common/index.js:427:10)\r\n    at Object.expectsError (/home/divyanshu/programming/node/test/common/index.js:717:18)\r\n    at Object.<anonymous> (/home/divyanshu/programming/node/test/parallel/test-child-process-spawnsync-validation-errors.js:14:12)\r\n    at Module._compile (internal/modules/cjs/loader.js:677:30)\r\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:688:10)\r\n    at Module.load (internal/modules/cjs/loader.js:588:32)\r\n    at tryModuleLoad (internal/modules/cjs/loader.js:527:12)\r\n    at Function.Module._load (internal/modules/cjs/loader.js:519:3)\r\n    at Function.Module.runMain (internal/modules/cjs/loader.js:718:10)\r\nCommand: out/Release/node /home/divyanshu/programming/node/test/parallel/test-child-process-spawnsync-validation-errors.js\r\n```\r\nError 2 \r\n```\r\n=== release test-fs-access ===                                                 \r\nPath: parallel/test-fs-access\r\nfs.js:110\r\n    throw err;\r\n    ^\r\n\r\nError: EACCES: permission denied, access '/home/divyanshu/programming/node/test/parallel/test-fs-access.js'\r\n    at Object.fs.accessSync (fs.js:200:3)\r\n    at Object.<anonymous> (/home/divyanshu/programming/node/test/parallel/test-fs-access.js:116:4)\r\n    at Module._compile (internal/modules/cjs/loader.js:677:30)\r\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:688:10)\r\n    at Module.load (internal/modules/cjs/loader.js:588:32)\r\n    at tryModuleLoad (internal/modules/cjs/loader.js:527:12)\r\n    at Function.Module._load (internal/modules/cjs/loader.js:519:3)\r\n    at Function.Module.runMain (internal/modules/cjs/loader.js:718:10)\r\n    at startup (internal/bootstrap/node.js:225:19)\r\n    at bootstrapNodeJSCore (internal/bootstrap/node.js:572:3)\r\nCommand: out/Release/node /home/divyanshu/programming/node/test/parallel/test-fs-access.js\r\n```\r\n\r\nError 3\r\n```\r\n=== release test-process-geteuid-getegid ===                                   \r\nPath: parallel/test-process-geteuid-getegid\r\n/home/divyanshu/programming/node/test/parallel/test-process-geteuid-getegid.js:41\r\nprocess.setegid('nobody');\r\n        ^\r\n\r\nError: setegid group id does not exist\r\n    at Object.<anonymous> (/home/divyanshu/programming/node/test/parallel/test-process-geteuid-getegid.js:41:9)\r\n    at Module._compile (internal/modules/cjs/loader.js:677:30)\r\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:688:10)\r\n    at Module.load (internal/modules/cjs/loader.js:588:32)\r\n    at tryModuleLoad (internal/modules/cjs/loader.js:527:12)\r\n    at Function.Module._load (internal/modules/cjs/loader.js:519:3)\r\n    at Function.Module.runMain (internal/modules/cjs/loader.js:718:10)\r\n    at startup (internal/bootstrap/node.js:225:19)\r\n    at bootstrapNodeJSCore (internal/bootstrap/node.js:572:3)\r\nCommand: out/Release/node /home/divyanshu/programming/node/test/parallel/test-process-geteuid-getegid.js\r\n```\r\n\r\nError 4\r\n```\r\n=== release test-process-setuid-setgid ===                                     \r\nPath: parallel/test-process-setuid-setgid\r\n/home/divyanshu/programming/node/test/parallel/test-process-setuid-setgid.js:60\r\nprocess.setgid('nobody');\r\n        ^\r\n\r\nError: setgid group id does not exist\r\n    at Object.<anonymous> (/home/divyanshu/programming/node/test/parallel/test-process-setuid-setgid.js:60:9)\r\n    at Module._compile (internal/modules/cjs/loader.js:677:30)\r\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:688:10)\r\n    at Module.load (internal/modules/cjs/loader.js:588:32)\r\n    at tryModuleLoad (internal/modules/cjs/loader.js:527:12)\r\n    at Function.Module._load (internal/modules/cjs/loader.js:519:3)\r\n    at Function.Module.runMain (internal/modules/cjs/loader.js:718:10)\r\n    at startup (internal/bootstrap/node.js:225:19)\r\n    at bootstrapNodeJSCore (internal/bootstrap/node.js:572:3)\r\nCommand: out/Release/node /home/divyanshu/programming/node/test/parallel/test-process-setuid-setgid.js\r\n```\r\n\r\nError 1 is covered in [Issue 19371](https://github.com/nodejs/node/issues/19371)\r\n\r\nError 3 and Error 4\r\n\r\nThe lines that throw these errors in the respective files\r\n\r\n* [In test-process-geteuid-getegid.js - process.setegid('nobody');](https://github.com/nodejs/node/blob/master/test/parallel/test-process-geteuid-getegid.js#L41)\r\n* [In test-process-setuid-setgid.js - process.setgid('nobody');](https://github.com/nodejs/node/blob/master/test/parallel/test-process-setuid-setgid.js#L60)\r\n\r\nOn reading further, I figured that this is because the standard `nobody` group in UNIX systems is named `nogroup` in Ubuntu.\r\n\r\nWhen I changed the lines which were throwing errors to the following - which checks if `nobody` group does not exist on the UNIX system it tries to set the group to `nogroup` before throwing an error\r\n\r\n```\r\ntry {\r\n  process.setegid('nobody');\r\n} catch (err) {\r\n  if (err.message !== 'setegid group id does not exist') {\r\n    throw err;\r\n  } else {\r\n    process.setegid('nogroup');\r\n  }\r\n}\r\n```\r\nand \r\n```\r\ntry {\r\n  process.setgid('nobody');\r\n} catch (err) {\r\n  if (err.message !== 'setgid group id does not exist') {\r\n    throw err;\r\n  } else {\r\n    process.setgid('nogroup');\r\n  }\r\n}\r\n```\r\n\r\nrespectively in the two files, Errors 3 and 4 were resolved\r\n\r\nI'd like to work on Errors 3 and 4 and if the changes I have made make sense I'd like to submit a PR for it"},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/377678016","html_url":"https://github.com/nodejs/node/issues/19594#issuecomment-377678016","issue_url":"https://api.github.com/repos/nodejs/node/issues/19594","id":377678016,"user":{"login":"dsinecos","id":24248411,"avatar_url":"https://avatars3.githubusercontent.com/u/24248411?v=4","gravatar_id":"","url":"https://api.github.com/users/dsinecos","html_url":"https://github.com/dsinecos","followers_url":"https://api.github.com/users/dsinecos/followers","following_url":"https://api.github.com/users/dsinecos/following{/other_user}","gists_url":"https://api.github.com/users/dsinecos/gists{/gist_id}","starred_url":"https://api.github.com/users/dsinecos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsinecos/subscriptions","organizations_url":"https://api.github.com/users/dsinecos/orgs","repos_url":"https://api.github.com/users/dsinecos/repos","events_url":"https://api.github.com/users/dsinecos/events{/privacy}","received_events_url":"https://api.github.com/users/dsinecos/received_events","type":"User","site_admin":false},"created_at":"2018-03-31T08:55:43Z","updated_at":"2018-03-31T08:55:43Z","author_association":"NONE","body":"@gireeshpunathil\r\n\r\nI ran `sudo make test` to verify that the error 2 is resolved after I add my code. \r\n\r\nHowever, if I run `make test` after `sudo make test` I get a bunch of EACCES permission denied errors on files, because they were created with root privileges when I ran `sudo make test`.\r\n\r\nIf I run only `make test` the error I'm working on won't occur so I need to run `sudo make test` to verify the error I'm working on is resolved.\r\n\r\nShould I submit the PR as long as that error is resolved in `sudo make test`?"}}
{"actor":{"display_login":"dsinecos"}}