Skip to content

Conversation

@yorkie
Copy link
Member

@yorkie yorkie commented Oct 17, 2019

Implements the Node.js os API: https://nodejs.org/dist/latest-v12.x/docs/api/os.html#os_os_tmpdir

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added

@yorkie
Copy link
Member Author

yorkie commented Oct 17, 2019

Note: this is a prepared PR for adding the fsync and fdatasync() :)

}

exports.tmpdir = function tmpdir() {
var path = process.env.TMPDIR ||
Copy link
Contributor

Choose a reason for hiding this comment

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

why not get env from getenv(3)

Copy link
Member Author

Choose a reason for hiding this comment

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

What's the benefits in that way? Actually we did set the env at GetEnvironArray via environ(7).

Copy link
Contributor

Choose a reason for hiding this comment

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

in Windows, Node.js is also in this way,but on other platforms are via getenv, i am not sure why Node.js is doing this.

Copy link
Contributor

Choose a reason for hiding this comment

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

getenv is only used if node environment has not been setup.

Copy link
Contributor

Choose a reason for hiding this comment

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

why not read directly from process.env like Windows?
because of thesetuid root?

Copy link
Member Author

Choose a reason for hiding this comment

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

See nodejs/node#18511 for all related history, this seems a historic design problem that allows packages sharing via process.env(write/read), but anyway, we have to handle this security, thanks @lolBig

@yorkie
Copy link
Member Author

yorkie commented Oct 17, 2019

Restart the failed job(https://travis-ci.com/yodaos-project/ShadowNode/jobs/246598500) caused by networks.


assert.deepStrictEqual(actual, expected);

// test for tmpdir
Copy link
Contributor

Choose a reason for hiding this comment

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

A default case shall be covered. i.e. no TMPDIR nor TMP and TEMP environs are set.

Copy link
Member Author

Choose a reason for hiding this comment

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

* `scopeid` {Number} The numeric IPv6 scope ID (only specified when family is IPv6)
* `cidr` {String} The assigned IPv4 or IPv6 address with the routing prefix in CIDR notation. If the netmask is invalid, this property is set to null

```js
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a necessary change?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea, the below lines actually are not in JavaScript.

@yorkie yorkie closed this Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants