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 — Please give the trailing slash back to os.tmpdir() · Issue #1669 · nodejs/node

Please give the trailing slash back to os.tmpdir() #1669

New issue
Copy link
New issue
Copy link
Closed
Closed
Please give the trailing slash back to os.tmpdir()#1669
Copy link
Labels
osIssues and PRs related to the os subsystem.

Description

@ghost
ghost
opened on May 10, 2015

Please revert the commit b57cc51

Since we can get any string (like "/oh/my/xxx/////"), from the environment, why bother to remove the trailing slash? For consistency between __dirname and os.tmpdir() #715 #747 ??

Activity

  1. mscdex commented on May 10, 2015

    @mscdex
    mscdex
    on May 10, 2015
    Contributor
    More actions

    Why not use path.join() or similar path methods?

    $ iojs
    > path.join('/oh/my/xxx/////', 'bar')
    '/oh/my/xxx/bar'
    
  2. mscdex
    added
    osIssues and PRs related to the os subsystem.
    on May 10, 2015
  3. rlidwka commented on May 10, 2015

    @rlidwka
    rlidwka
    on May 10, 2015
    Contributor
    More actions

    If the string "/" comes from the user environment (though hardly possible), gets trimmed into "", what directory does it represent (and on what platform)?

    That's true actually:

    $ TEMP=/ ~/io.js/iojs  -e 'console.log(JSON.stringify(require("os").tmpdir()))'
    ""

    / should not be removed if it's the only character there.

    dirname works correctly in that case:

    $ cat /test.js
    console.log(__dirname)
    $ ~/io.js/iojs /test.js
    /
  4. Fishrock123 commented on May 10, 2015

    @Fishrock123
    Fishrock123
    on May 10, 2015
    Contributor
    More actions

    cc @tellnes

  5. brendanashworth commented on May 10, 2015

    @brendanashworth
    brendanashworth
    on May 10, 2015
    Contributor
    More actions

    Perhaps semver-major changes aren't looked at hard enough... maybe we should introduce a hard minimum amount of reviewers for a major change, say 3.

  6. tellnes commented on May 10, 2015

    @tellnes
    tellnes
    on May 10, 2015
    Contributor
    More actions

    We could change it so we remove all trailing slashes and keep one if there is no other characters there?

  7. benjamingr commented on May 10, 2015

    @benjamingr
    benjamingr
    on May 10, 2015
    Member
    More actions

    @tellnes Yeah, that sounds like a solid workaround.

    @jakwings would that satisfy you? I realize this is a breaking change and that you'd have to normalize it through the library, but isn't that a one-time thing and the new behavior makes more sense?

  8. tellnes commented on May 11, 2015

    @tellnes
    tellnes
    on May 11, 2015
    Contributor
    More actions

    So remove trailing path.sep then, but keep one if there is no other characters?

  9. cjihrig
    added a commit that references this issue on May 13, 2015

    os: refine tmpdir() trailing slash stripping

    7693705
  10. cjihrig commented on May 13, 2015

    @cjihrig
    cjihrig
    on May 13, 2015
    Contributor
    More actions

    As of 7693705, trailing slashes will not be stripped from / or C:\. Additionally, only slashes relevant to the current operating system will be stripped.

  11. cjihrig
    closed this as completedon May 13, 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.