Skip to content

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

Description

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
    Contributor

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

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

    @rlidwka
    Contributor

    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
    Contributor
  5. brendanashworth commented on May 10, 2015

    @brendanashworth
    Contributor

    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
    Contributor

    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
    Member

    @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
    Contributor

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

  9. cjihrig commented on May 13, 2015

    @cjihrig
    Contributor

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

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