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: remove trailing slash from os.tmpdir() by tellnes · Pull Request #747 · nodejs/node

Conversation

@tellnes

@tellnes tellnes commented Feb 6, 2015

Copy link
Copy Markdown
Contributor

This commit makes os.tmpdir() behave consistently on all platforms. It
changes os.tmpdir() to always return a path without trailing slash.

Semver: Major
Fixes: #715

Sorry, something went wrong.

Uh oh!

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

All reactions
xaka
xaka reviewed Feb 6, 2015
View reviewed changes
Comment thread lib/os.js Outdated

@xaka xaka Feb 6, 2015

Copy link
Copy Markdown

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.

  1. What about more that one trailing slash if someone is messing up with env variables?
  2. What about using path.normalize to take care of all possible scenarios?

Sorry, something went wrong.

Uh oh!

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

All reactions

@tellnes tellnes Feb 6, 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.

  1. Can be easily fixed by s/if/while.
  2. path.normalize does not remove trailing slashes.

Sorry, something went wrong.

Uh oh!

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

All reactions

@tellnes tellnes Feb 6, 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.

Maybe this:

path = require('path').normalize(path);
if (/[\\\/]$/.test(path))
  path = path.substr(0, path.length - 1);

(And of course putting the require call outside the function)

Sorry, something went wrong.

Uh oh!

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

All reactions

@bnoordhuis bnoordhuis Mar 21, 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.

Suggestion: path = path.slice(0, -1);

Sorry, something went wrong.

Uh oh!

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

All reactions
@micnic micnic added os Issues and PRs related to the os subsystem. semver-major PRs that contain breaking changes and should be released in the next major version. labels Feb 6, 2015
@xaka

xaka commented Feb 6, 2015

Copy link
Copy Markdown

One very important thing to think about. While __dirname isn't affected by user, os.tempdir() is, because it depends on env variable. Now imagine situation when user sets it wrong, io.js "fixes" it implicitly and it helps your program A to run, but at the same time another program B, written in another language, fails and you have no clue what's going on and why something works and something doesn't. What if program B depends on results of program A, both sharing the same env variables, but as program B doesn't know how to fix trailing slash, it's going to crash. I see how DevOps life might get in trouble here. Probably it's not a big deal, but who knows.

All reactions

Sorry, something went wrong.

Uh oh!

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

@rvagg

rvagg commented Feb 7, 2015

Copy link
Copy Markdown
Member

collaborators: please hold off on merging this even if you think it's a good idea, a semver-major change is kind of a big deal at this stage still.

All reactions

Sorry, something went wrong.

Uh oh!

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

@chrisdickinson chrisdickinson mentioned this pull request Mar 4, 2015
Major version bump #1061
Closed
@bnoordhuis
Working on v2.0.0
bc1fe3a
@bnoordhuis

bnoordhuis commented Mar 21, 2015

Copy link
Copy Markdown
Member

LGTM with a suggestion and no strong opinion on using path.normalize().

@tellnes Can you land it on the 'next' branch?

All reactions

Sorry, something went wrong.

Uh oh!

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

@tellnes
os: remove trailing slash from os.tmpdir()
bb97b70
This commit makes `os.tmpdir()` behave consistently on all platforms. It
changes `os.tmpdir()` to always return a path without trailing slash.

Semver: major
Fixes: nodejs#715
PR-URL: nodejs#747
Reviewed-By: Ben Noordhuis <[email protected]>
@tellnes
tellnes force-pushed the tmpdir branch from 82412e1 to bb97b70 Compare March 21, 2015 14:29
@tellnes

tellnes commented Mar 21, 2015

Copy link
Copy Markdown
Contributor Author

I'm getting some errors in test/sequential/test-fs-watch.js, so I'll wait on landing this untill I have investigated those.

All reactions

Sorry, something went wrong.

Uh oh!

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

@tellnes

tellnes commented Mar 22, 2015

Copy link
Copy Markdown
Contributor Author

I can't reproduce the errors, so it was probably something flaky.

Landed in bb97b70

All reactions

Sorry, something went wrong.

Uh oh!

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

@tellnes tellnes closed this Mar 22, 2015
tellnes added a commit that referenced this pull request Apr 28, 2015
@tellnes @chrisdickinson
os: remove trailing slash from os.tmpdir()
b57cc51
This commit makes `os.tmpdir()` behave consistently on all platforms. It
changes `os.tmpdir()` to always return a path without trailing slash.

Semver: major
Fixes: #715
PR-URL: #747
Reviewed-By: Ben Noordhuis <[email protected]>
@rvagg rvagg mentioned this pull request Apr 29, 2015
Release proposal: v2.0.0 #1532
Closed
@Fishrock123 Fishrock123 added this to the 2.0.0 milestone Apr 29, 2015
rvagg added a commit that referenced this pull request May 4, 2015
@rvagg
2015-05-04 io.js v2.0.0 Release
7c89c4c
PR-URL: #1532

Notable Changes:

* crypto: significantly reduced memory usage for TLS (Fedor Indutny & Сковорода
  Никита Андреевич) #1529
* net: socket.connect() now accepts a 'lookup' option for a custom DNS
  resolution mechanism, defaults to dns.lookup() (Evan Lucas) #1505
* npm: Upgrade npm to 2.9.0. See the v2.8.4 and v2.9.0 release notes for
  details. Notable items:
  - Add support for default author field to make npm init -y work without
    user-input (@othiym23) npm/npm/d8eee6cf9d
  - Include local modules in npm outdated and npm update (@ArnaudRinquin)
    npm/npm#7426
  - The prefix used before the version number on npm version is now configurable
    via tag-version-prefix (@kkragenbrink) npm/npm#8014
* os: os.tmpdir() is now cross-platform consistent and will no longer returns a
  path with a trailling slash on any platform (Christian Tellnes) #747
* process:
  - process.nextTick() performance has been improved by between 2-42% across the
    benchmark suite, notable because this is heavily used across core (Brian White) #1548
  - New process.geteuid(), process.seteuid(id), process.getegid() and
    process.setegid(id) methods allow you to get and set effective UID and GID
    of the process (Evan Lucas) #1536
* repl:
  - REPL history can be persisted across sessions if the NODE_REPL_HISTORY_FILE
    environment variable is set to a user accessible file,
    NODE_REPL_HISTORY_SIZE can set the maximum history size and defaults to 1000
    (Chris Dickinson) #1513
  - The REPL can be placed in to one of three modes using the NODE_REPL_MODE
    environment variable: sloppy, strict or magic (default); the new magic mode
    will automatically run "strict mode only" statements in strict mode
    (Chris Dickinson) #1513
* smalloc: the 'smalloc' module has been deprecated due to changes coming in V8
  4.4 that will render it unusable
* util: add Promise, Map and Set inspection support (Christopher Monsanto) #1471
* V8: upgrade to 4.2.77.18, see the ChangeLog for full details. Notable items:
  - Classes have moved out of staging; the class keyword is now usable in strict
    mode without flags
  - Object literal enhancements have moved out of staging; shorthand method and
    property syntax is now usable ({ method() { }, property })
  - Rest parameters (function(...args) {}) are implemented in staging behind the
    --harmony-rest-parameters flag
  - Computed property names ({['foo'+'bar']:'bam'}) are implemented in staging
    behind the --harmony-computed-property-names flag
  - Unicode escapes ('\u{xxxx}') are implemented in staging behind the
    --harmony_unicode flag and the --harmony_unicode_regexps flag for use in
    regular expressions
* Windows:
  - Random process termination on Windows fixed (Fedor Indutny) #1512 / #1563
  - The delay-load hook introduced to fix issues with process naming (iojs.exe /
    node.exe) has been made opt-out for native add-ons. Native add-ons should
    include 'win_delay_load_hook': 'false' in their binding.gyp to disable this
    feature if they experience problems . (Bert Belder) #1433
* Governance:
  - Rod Vagg (@rvagg) was added to the Technical Committee (TC)
  - Jeremiah Senkpiel (@Fishrock123) was added to the Technical Committee (TC)
@ghost ghost mentioned this pull request May 10, 2015
Please give the trailing slash back to os.tmpdir() #1669
Closed
@leonardoadame leonardoadame mentioned this pull request Dec 3, 2023
[Snyk] Fix for 1 vulnerabilities leonardoadame/node#477
Open
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

os Issues and PRs related to the os subsystem. semver-major PRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Milestone

2.0.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

6 participants

@tellnes @xaka @rvagg @bnoordhuis @Fishrock123 @micnic
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.