GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — os: add homedir() by cjihrig · Pull Request #1791 · nodejs/node

Conversation

@cjihrig

@cjihrig cjihrig commented May 25, 2015

Copy link
Copy Markdown
Contributor

Do not land this yet.

This PR adds os.homedir(), which calls libuv's uv_os_homedir() to retrieve the current user's home directory. This is an alternative to #1670. This PR currently consists of two commits. 6887116 is the libuv update, which has not landed in io.js yet. This commit should be removed once a proper update is in place. e7e5992 is the io.js update.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@silverwind silverwind added os Issues and PRs related to the os subsystem. semver-minor PRs that contain new features and should be released in the next minor version. labels May 25, 2015
bnoordhuis
bnoordhuis reviewed May 25, 2015
View reviewed changes
Comment thread src/node_os.cc Outdated

@bnoordhuis bnoordhuis May 25, 2015

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

node.h defines PATH_MAX on Windows so the #ifdef is probably not necessary here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Fishrock123 Fishrock123 mentioned this pull request May 25, 2015
os: add .homedir() #1670
Closed
bnoordhuis
bnoordhuis reviewed May 25, 2015
View reviewed changes
Comment thread test/parallel/test-os.js Outdated

@bnoordhuis bnoordhuis May 25, 2015

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I'm not sure if this is a good assumption. I'd just check that it still returns something, possibly something that looks like a path.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@cjihrig cjihrig May 25, 2015

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

You're right. Updated.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bnoordhuis

bnoordhuis commented May 25, 2015

Copy link
Copy Markdown
Member

LGTM. You should probably run the CI before landing this.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented May 25, 2015

Copy link
Copy Markdown
Contributor Author

I will once libuv is updated and I can remove the floating patch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rvagg

rvagg commented May 25, 2015

Copy link
Copy Markdown
Member

lgtm, the duplication in test-os.js seems unnecessary but I guess it's consistent with what's in there

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fishrock123 Fishrock123 added the libuv Issues and PRs related to the libuv dependency or the uv binding. label May 26, 2015
@bnoordhuis
bnoordhuis force-pushed the master branch from 311c3e4 to b926718 Compare June 2, 2015 17:25
@Fishrock123

Fishrock123 commented Jun 4, 2015

Copy link
Copy Markdown
Contributor

Libuv 1.6.0 has landed. 👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

thefourtheye
thefourtheye reviewed Jun 4, 2015
View reviewed changes
Comment thread deps/uv/src/unix/core.c Outdated

@thefourtheye thefourtheye Jun 4, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

At this point, buf would be NULL only.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@cjihrig

cjihrig commented Jun 4, 2015

Copy link
Copy Markdown
Contributor Author

Floating patch removed. CI: https://jenkins-iojs.nodesource.com/view/iojs/job/iojs+any-pr+multi/766/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented Jun 4, 2015

Copy link
Copy Markdown
Contributor Author

@rvagg the CI is still running, but I'm seeing some strange failures. Unable to compile on SmartOS, out of memory errors on FreeBSD, and too many files open on CentOS. Anything odd going on with the build?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rvagg

rvagg commented Jun 4, 2015

Copy link
Copy Markdown
Member

@cjihrig eeek, not that I'm aware of, @jbergstroem has been tinkering on CentOS5 but not the others.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jbergstroem

jbergstroem commented Jun 4, 2015

Copy link
Copy Markdown
Member

I'll have a look.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jbergstroem

jbergstroem commented Jun 4, 2015

Copy link
Copy Markdown
Member

Affected os:es seems to hit file-max

freebsd: kern.maxfiles limit exceeded by uid 1003, please see tuning(7).
centos5: VFS: file-max limit 334442 reached

Jenkins has <100 file descriptors open which leads me to believe that ccache might try to. I can't say I've seen it previously, but I'll keep digging.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jbergstroem

jbergstroem commented Jun 4, 2015

Copy link
Copy Markdown
Member

Looking at cat /proc/sys/fs/file-nr (or equivalents) at different machines; can't say I see it grow even close to limits while compiling.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jbergstroem

jbergstroem commented Jun 4, 2015

Copy link
Copy Markdown
Member

(for reference, the run I'm measuring is here: https://jenkins-iojs.nodesource.com/job/iojs+any-pr+multi/767/)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jbergstroem

jbergstroem commented Jun 4, 2015

Copy link
Copy Markdown
Member

So yeah, I'm unable to reproduce what happened at that specific run. Jenkins.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented Jun 4, 2015

Copy link
Copy Markdown
Contributor Author

Added limits.h in https://github.com/cjihrig/io.js/commit/69c1c33348ac1803615c73e42bf7dfef3155a4a7#diff-2b7b259d26f297c87b7d71512e33ccecR14 to get the compile working on SmartOS. The CentOS failure seemed to be flakey. FreeBSD is still throwing ENOMEM. @bnoordhuis any clue why this might be happening (other than the obvious answer that the process is out of memory)?

Updated CI run: https://jenkins-iojs.nodesource.com/view/iojs/job/iojs+any-pr+multi/769/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnoordhuis

bnoordhuis commented Jun 4, 2015

Copy link
Copy Markdown
Member

I speculate it's because of this. :-)

(IIRC, I pointed that out in the review, that sysconf() can return < 0, but I'm not 100% sure. At any rate, bufsize is a size_t so the -1 wraps around and becomes SIZE_MAX.)

(EDIT: That may have been another PR, come to think of it.)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented Jun 4, 2015

Copy link
Copy Markdown
Contributor Author

@bnoordhuis you did mention that. The data type for bufsize not being switched from size_t to long was my bad (I did add the check for bufsize <= 0, but didn't change the data type). Assuming that this is the problem, I'm curious why this didn't cause a problem with the libuv CI. And, do you think we should ditch the sysconf() call and use something else as the starting point for malloc()?

EDIT: this has a good example that calls sysconf() and falls back to a different value if it fails, although they also use a size_t to hold the return value :-)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented Jun 4, 2015

Copy link
Copy Markdown
Contributor Author

@bnoordhuis you were right, so I added a37072b as a floating patch on libuv, and the CI is much happier now. Let me know how you want this handled in libuv.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnoordhuis

bnoordhuis commented Jun 4, 2015

Copy link
Copy Markdown
Member

@cjihrig Left a comment. Can you file that as a libuv PR? We'll do a patch release for that.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig cjihrig mentioned this pull request Jun 4, 2015
unix: handle invalid _SC_GETPW_R_SIZE_MAX values libuv/libuv#389
Closed
@jbergstroem

jbergstroem commented Jun 4, 2015

Copy link
Copy Markdown
Member

Ah, should've tested the branch while searching for issues; I just assumed it was lingering processes or similar.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented Jun 5, 2015

Copy link
Copy Markdown
Contributor Author

@bnoordhuis if I update the floating patch here, is this OK to land?

EDIT: Removed the floating patch since the libuv update PR was opened.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

saghul added a commit to saghul/node that referenced this pull request Jun 5, 2015
@saghul
deps: update libuv to version 1.6.1
d3b69c5
Refs: nodejs#1791
@saghul saghul mentioned this pull request Jun 5, 2015
deps: update libuv to version 1.6.1 #1905
Closed
@saghul

saghul commented Jun 5, 2015

Copy link
Copy Markdown
Member

@cjihrig FYI: #1905

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bnoordhuis pushed a commit that referenced this pull request Jun 5, 2015
@saghul @bnoordhuis
deps: update libuv to version 1.6.1
a5bd466
PR-URL: #1905
Refs: #1791
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
@cjihrig

cjihrig commented Jun 5, 2015

Copy link
Copy Markdown
Contributor Author

Thanks @saghul. Hopefully one last CI run: https://jenkins-iojs.nodesource.com/view/iojs/job/iojs+any-pr+multi/774/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fishrock123

Fishrock123 commented Jun 5, 2015

Copy link
Copy Markdown
Contributor

Hmmm.. freebsd isn't so happy. https://jenkins-iojs.nodesource.com/view/iojs/job/iojs+any-pr+multi/774/nodes=freebsd101-64/tapTestReport/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig
os: add homedir()
6e78e5f
os.homedir() calls libuv's uv_os_homedir() to retrieve the current
user's home directory.

PR-URL: #1791
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Rod Vagg <[email protected]>
@cjihrig
cjihrig merged commit 6e78e5f into nodejs:master Jun 6, 2015
@cjihrig

cjihrig commented Jun 6, 2015

Copy link
Copy Markdown
Contributor Author

It would help if I rebased the branch to include the libuv 1.6.1 update.

https://jenkins-iojs.nodesource.com/view/iojs/job/iojs+any-pr+multi/775/ is all green.

Landed in 6e78e5f.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig
cjihrig deleted the homedir branch June 6, 2015 04:45
@rvagg rvagg mentioned this pull request Jun 11, 2015
Release proposal: 2.3.0 #1939
Closed
rvagg added a commit that referenced this pull request Jun 13, 2015
@rvagg
2015-06-13 io.js v2.3.0 Release
41951d4
Notable Changes:

* libuv: Upgraded to 1.6.0 and 1.6.1, see full ChangeLog for details.
  (Saúl Ibarra Corretgé) #1905 #1889. Highlights include:
  - Fix TTY becoming blocked on OS X
  - Fix UDP send callbacks to not to be synchronous
  - Add uv_os_homedir() (exposed as os.homedir(), see below)
* npm: See full release notes for details. (Kat Marchán) #1899. Highlight:
  - Use GIT_SSH_COMMAND (available as of Git 2.3)
* openssl:
  - Upgrade to 1.0.2b and 1.0.2c, introduces DHE man-in-the-middle protection
    (Logjam) and fixes malformed ECParameters causing infinite loop
    (CVE-2015-1788). See the security advisory for full details.
    (Shigeki Ohtsu) #1950 #1958
  - Support FIPS mode of OpenSSL, see README for instructions.
    (Fedor Indutny) #1890
* os: Add os.homedir() method. (Colin Ihrig) #1791
* smalloc: Deprecate whole module. (Vladimir Kurchatkin) #1822
* Add new collaborators:
  - Alex Kocharin (@rlidwka)
  - Christopher Monsanto (@monsanto)
  - Ali Ijaz Sheikh (@ofrobots)
  - Oleg Elifantiev (@Olegas)
  - Domenic Denicola (@domenic)
  - Rich Trott (@Trott)
@sindresorhus

sindresorhus commented Jun 13, 2015

Copy link
Copy Markdown

I made a polyfill for anyone wanting to use this while still supporting older node/io versions:
https://github.com/sindresorhus/os-homedir

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nfischer nfischer mentioned this pull request Jan 19, 2016
feat: add tilde expansion to expand() shelljs/shelljs#293
Merged
@renkun-ken renkun-ken mentioned this pull request Jan 10, 2020
Improve session watcher initialization REditorSupport/vscode-R#184
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

libuv Issues and PRs related to the libuv dependency or the uv binding. os Issues and PRs related to the os subsystem. semver-minor PRs that contain new features and should be released in the next minor version.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

10 participants

@cjihrig @bnoordhuis @rvagg @Fishrock123 @jbergstroem @saghul @sindresorhus @jorangreef @thefourtheye @silverwind
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.