Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os: refine tmpdir() trailing slash stripping #1673

Closed
wants to merge 1 commit into from
Closed

os: refine tmpdir() trailing slash stripping #1673

wants to merge 1 commit into from

Conversation

cjihrig
Copy link
Contributor

@cjihrig cjihrig commented May 11, 2015

os.tmpdir() began stripping trailing slashes in b57cc51. This causes problems if the temp directory is simply '/'. It also stripped trailing slashes without first determining which slash type is used by the current operating system. This commit only strips trailing slashes if another character precedes the slash. On Windows, it checks for ':', as not to strip slashes from something like 'C:\'.

Related to #1669.

os.tmpdir() began stripping trailing slashes in
b57cc51. This causes problems if
the temp directory is simply '/'. It also stripped trailing
slashes without first determining which slash type is used by
the current operating system. This commit only strips trailing
slashes if another character precedes the slash. On Windows, it
checks for ':', as not to strip slashes from something like 'C:\'.
@@ -22,6 +22,9 @@ exports.platform = function() {
return process.platform;
};

const trailingSlashRe = isWindows ? /[^:]\\$/
Copy link
Member

Choose a reason for hiding this comment

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

this seems like something that should live in path.js, it'd be nice if we could confine a lot of this platform path logic to one place and export it to wherever it's needed

@rvagg
Copy link
Member

rvagg commented May 11, 2015

lgtm

@Fishrock123 @chrisdickinson can one of you propose a release so we can get this in the wild asap? Note that there's a semver-major in the commit log--we either need to remove that tag from that PR or manually remove the indicator from the changelog; probably the former because this one is likely to be repeated with each npm update.

@Fishrock123
Copy link
Contributor

@rvagg you mean 64d3210? Yeah it looks like there isn't any context meta-data :s

@evanlucas evanlucas added the os Issues and PRs related to the os subsystem. label May 11, 2015
@Fishrock123
Copy link
Contributor

@tellnes
Copy link
Contributor

tellnes commented May 13, 2015

LGTM

cjihrig added a commit that referenced this pull request May 13, 2015
os.tmpdir() began stripping trailing slashes in
b57cc51. This causes problems if
the temp directory is simply '/'. It also stripped trailing
slashes without first determining which slash type is used by
the current operating system. This commit only strips trailing
slashes if another character precedes the slash. On Windows, it
checks for ':', as not to strip slashes from something like 'C:\'.
It also only strips slashes that are appropriate for the user's
operating system.

Fixes: #1669
PR-URL: #1673
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Christian Tellnes <christian@tellnes.no>
@cjihrig
Copy link
Contributor Author

cjihrig commented May 13, 2015

Landed in 7693705

@cjihrig cjihrig closed this May 13, 2015
@cjihrig cjihrig deleted the tmpdir branch May 13, 2015 14:20
Fishrock123 added a commit to Fishrock123/node that referenced this pull request May 15, 2015
PR-URL: nodejs#1679

Notable Changes:

* win,node-gyp: the delay-load hook for windows addons has now been
correctly enabled by default, it had wrongly defaulted to off in the
release version of 2.0.0 (Bert Belder) nodejs#1433
* os: tmpdir()'s trailing slash stripping has been refined to fix an
issue when the temp directory is at '/'. Also considers which slash is
used by the operating system. (cjihrig) nodejs#1673
* tls: default ciphers have been updated to use gcm and aes128 (Mike
MacCana) nodejs#1660
* build: v8 snapshots have been re-enabled by default as suggested by
the v8 team, since prior security issues have been resolved. This
should give some perf improvements to both startup and vm context
creation. (Trevor Norris) nodejs#1663
* src: fixed preload modules not working when other flags were used
before --require (Yosuke Furukawa) nodejs#1694
* dgram: fixed send()'s callback not being asynchronous (Yosuke
Furukawa) nodejs#1313
* readline: emitKeys now keeps buffering data until it has enough to
parse. This fixes an issue with parsing split escapes. (Alex Kocharin)
* cluster: works now properly emit 'disconnect' to cluser.worker (Oleg
Elifantiev) nodejs#1386
events: uncaught errors now provide some context (Evan Lucas) nodejs#1654
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os Issues and PRs related to the os subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants