From c21875b9ab528b0bd4d9d7beeac68f72ec284929 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 26 Mar 2020 01:07:31 -0400 Subject: [PATCH 1/3] doc: deprecate process.umask() with no arguments This commit introduces a documentation deprecation for calling process.umask() with no arguments. PR-URL: https://github.com/nodejs/node/pull/32499 Fixes: https://github.com/nodejs/node/issues/32321 Reviewed-By: Ben Noordhuis Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- doc/api/deprecations.md | 18 ++++++++++++++++++ doc/api/process.md | 10 ++++++++++ 2 files changed, 28 insertions(+) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 0d3f6a785be2aa..c850c5c16cf781 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2542,6 +2542,24 @@ accordingly instead to avoid the ambigiuty. To maintain existing behaviour `response.finished` should be replaced with `response.writableEnded`. + +### DEP0139: `process.umask()` with no arguments + + +Type: Documentation-only + +Calling `process.umask()` with no arguments causes the process-wide umask to be +written twice. This introduces a race condition between threads, and is a +potential security vulnerability. There is no safe, cross-platform alternative +API. + [`--http-parser=legacy`]: cli.html#cli_http_parser_library [`--pending-deprecation`]: cli.html#cli_pending_deprecation [`--throw-deprecation`]: cli.html#cli_throw_deprecation diff --git a/doc/api/process.md b/doc/api/process.md index 2fb0b77f7df702..d9b776fdbc9f04 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -2396,8 +2396,18 @@ flag's behavior. ## `process.umask([mask])` +> Stability: 0 - Deprecated. Calling `process.umask()` with no arguments is +> deprecated. No alternative is provided. + * `mask` {string|integer} The `process.umask()` method sets or returns the Node.js process's file mode From 0002ef994982814b5c0809df47c772ae2d599829 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 7 Apr 2020 16:17:14 -0700 Subject: [PATCH 2/3] doc: split process.umask() entry into two Split doc entries for process.umask() into one entry for process.umask() (which is deprecated) and another for `process.umask(mask)` which is not deprecated. PR-URL: https://github.com/nodejs/node/pull/32711 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- doc/api/deprecations.md | 2 +- doc/api/process.md | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index c850c5c16cf781..4ed0673d762e6d 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2555,7 +2555,7 @@ changes: Type: Documentation-only -Calling `process.umask()` with no arguments causes the process-wide umask to be +Calling `process.umask()` with no argument causes the process-wide umask to be written twice. This introduces a race condition between threads, and is a potential security vulnerability. There is no safe, cross-platform alternative API. diff --git a/doc/api/process.md b/doc/api/process.md index d9b776fdbc9f04..7ec92d8b0209ee 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -2393,7 +2393,7 @@ documentation for the [`'warning'` event][process_warning] and the [`emitWarning()` method][process_emit_warning] for more information about this flag's behavior. -## `process.umask([mask])` +## `process.umask()` -> Stability: 0 - Deprecated. Calling `process.umask()` with no arguments is -> deprecated. No alternative is provided. +> Stability: 0 - Deprecated. Calling `process.umask()` with no argument causes +> the process-wide umask to be written twice. This introduces a race condition +> between threads, and is a potential security vulnerability. There is no safe, +> cross-platform alternative API. + +`process.umask()` returns the Node.js process's file mode creation mask. Child +processes inherit the mask from the parent process. + +## `process.umask(mask)` + * `mask` {string|integer} -The `process.umask()` method sets or returns the Node.js process's file mode -creation mask. Child processes inherit the mask from the parent process. Invoked -without an argument, the current mask is returned, otherwise the umask is set to -the argument value and the previous mask is returned. +`process.umask(mask)` sets the Node.js process's file mode creation mask. Child +processes inherit the mask from the parent process. Returns the previous mask. ```js const newmask = 0o022; @@ -2423,8 +2431,7 @@ console.log( ); ``` -[`Worker`][] threads are able to read the umask, however attempting to set the -umask will result in a thrown exception. +In [`Worker`][] threads, `process.umask(mask)` will throw an exception. ## `process.uptime()` diff --git a/doc/api/process.md b/doc/api/process.md index 7ec92d8b0209ee..33a3debc0b53ea 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -2398,8 +2398,8 @@ flag's behavior. added: v0.1.19 changes: - version: - - v14.0.0 - REPLACEME + - v14.0.0 pr-url: https://github.com/nodejs/node/pull/32499 description: Calling `process.umask()` with no arguments is deprecated.