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 — Pull in `sindresorhus/user-home` as `os.homedir()` · Issue #682 · nodejs/node

Pull in sindresorhus/user-home as os.homedir() #682

New issue
Copy link
New issue
Copy link
Closed
Closed
Pull in sindresorhus/user-home as os.homedir()#682
Copy link
Labels
osIssues and PRs related to the os subsystem.

Description

@vkurchatkin
vkurchatkin
opened on Jan 31, 2015
Issue body actions
  1. This is generally useful
  2. We already have tmpdir()
  3. It is required for repl history support

/cc @a8m @sindresorhus

Activity

  1. rvagg commented on Jan 31, 2015

    @rvagg
    rvagg
    on Jan 31, 2015
    Member
    More actions

    Anybody else feel like #596 is getting out of hand or am I the only one?

  2. cjihrig commented on Jan 31, 2015

    @cjihrig
    cjihrig
    on Jan 31, 2015
    Contributor
    More actions

    @vkurchatkin I'm not sure whether we should include the functionality or not, but I'm gonna throw in my own module (https://github.com/cjihrig/userinfo) for consideration. It works at the C level and doesn't rely on environment variables.

    @rvagg yes. Seems like something that could live outside of core.

  3. a8m commented on Jan 31, 2015

    @a8m
    a8m
    on Jan 31, 2015
    More actions

    @rvagg I agree with you, but there's a reason why.
    after issue-394 opened, come three different implementations: 434, 442, 596, but we're not sure what is the right way(I'm not tagging those issues because it's irrelevant here).
    thanks for @vkurchatkin CR I think 596 has the best implementation(I'm trying to stay objective).

    @cjihrig I'm not sure how this could live outside of core.

  4. vkurchatkin commented on Jan 31, 2015

    @vkurchatkin
    vkurchatkin
    on Jan 31, 2015
    ContributorAuthor
    More actions

    @cjihrig repl history definitely can't live outside of core

  5. cjihrig commented on Jan 31, 2015

    @cjihrig
    cjihrig
    on Jan 31, 2015
    Contributor
    More actions

    I haven't dug deeply into this, but just based on a little Googling, it does seem possible:

    • https://github.com/tmpvar/repl.history
    • http://stackoverflow.com/questions/18511787/is-there-a-way-to-have-node-preserve-command-line-history-between-sessions
  6. vkurchatkin commented on Jan 31, 2015

    @vkurchatkin
    vkurchatkin
    on Jan 31, 2015
    ContributorAuthor
    More actions

    We also have this: https://github.com/iojs/io.js/blob/v1.x/lib/module.js#L495

  7. silverwind commented on Jan 31, 2015

    @silverwind
    silverwind
    on Jan 31, 2015
    Contributor
    More actions

    Would love to see this in core (along with path.resolve("~") support, but that's another story).

    If the C functions in @cjihrig's module work universally, I'd say that would be the best approach.

  8. rvagg commented on Jan 31, 2015

    @rvagg
    rvagg
    on Jan 31, 2015
    Member
    More actions

    As I mentioned before, there are existing packages that will give you fancy repl functionality outside if core, including history but also lots of other features. replpad by @thlorenz is just one example.

    My contention here is that the amount of additional code burden to get this feature in to core may suggest that it probably doesn't belong here. Core should remain lean and the node philosophy has evolved strongly into "small-core, vibrant-userland" so we need to always keep that in mind when assessing what pet-feature someone wants to bundle into core.

  9. thlorenz commented on Jan 31, 2015

    @thlorenz
    thlorenz
    on Jan 31, 2015
    Contributor
    More actions

    Actually history is that one feature I didn't get to yet, but am very open to have this added.
    Please submit PRs here :P.

  10. rvagg commented on Feb 1, 2015

    @rvagg
    rvagg
    on Feb 1, 2015
    Member
    More actions

    On the topic of user home detection in core I'm a strong -1 at this stage. It's not a clean operation and exposing it to users as if it were is fraught with danger.

    Consider how the suggested user-home module works for instance. If $HOME is not set on a non-Windows, non-Mac platform (i.e. the most common platforms for Node deployment: Linux and other unixes) then it assumes /home/user, which is absolutely not safe even if the common case. There is a strong case that if you cannot safely detect user home then you should fail and report. For example, an application started from Upstart or systemd where $HOME is optional, NY preference would be to fail if we really need to access user home and haven't been told where it is. A transparent operation from core conveys the impression that it's safe and can be trusted, best to encourage manual detection or using a userland module which comes with all the standard caveats that userland modules come with.

  11. brendanashworth
    added
    osIssues and PRs related to the os subsystem.
    on Feb 1, 2015
  12. cjihrig commented on Feb 3, 2015

    @cjihrig
    cjihrig
    on Feb 3, 2015
    Contributor
    More actions

    I'm also -1 on any type of detection involving environment variables.

  13. silverwind commented on Feb 3, 2015

    @silverwind
    silverwind
    on Feb 3, 2015
    Contributor
    More actions

    @cjihrig do you know if getlogin_r() + getpwnam() works on all Unix-based OS?

  14. cjihrig commented on Feb 3, 2015

    @cjihrig
    cjihrig
    on Feb 3, 2015
    Contributor
    More actions

    I'm not comfortable saying all. I've tested on OS X and Ubuntu.

  15. vkurchatkin
    closed this as completedon Feb 15, 2015
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

    osIssues and PRs related to the os subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      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.