Skip to content

Commit 79c4c73

Browse files
TrottBethGriggs
authored andcommitted
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. Backport-PR-URL: #34591 PR-URL: #32711 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 0a92721 commit 79c4c73

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

doc/api/deprecations.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2547,15 +2547,15 @@ To maintain existing behaviour `response.finished` should be replaced with
25472547
<!-- YAML
25482548
changes:
25492549
- version:
2550-
- v14.0.0
25512550
- REPLACEME
2551+
- v14.0.0
25522552
pr-url: https://github.com/nodejs/node/pull/32499
25532553
description: Documentation-only deprecation.
25542554
-->
25552555

25562556
Type: Documentation-only
25572557

2558-
Calling `process.umask()` with no arguments causes the process-wide umask to be
2558+
Calling `process.umask()` with no argument causes the process-wide umask to be
25592559
written twice. This introduces a race condition between threads, and is a
25602560
potential security vulnerability. There is no safe, cross-platform alternative
25612561
API.

doc/api/process.md

+17-10
Original file line numberDiff line numberDiff line change
@@ -2393,27 +2393,35 @@ documentation for the [`'warning'` event][process_warning] and the
23932393
[`emitWarning()` method][process_emit_warning] for more information about this
23942394
flag's behavior.
23952395

2396-
## `process.umask([mask])`
2396+
## `process.umask()`
23972397
<!-- YAML
23982398
added: v0.1.19
23992399
changes:
24002400
- version:
2401-
- v14.0.0
24022401
- REPLACEME
2402+
- v14.0.0
24032403
pr-url: https://github.com/nodejs/node/pull/32499
24042404
description: Calling `process.umask()` with no arguments is deprecated.
24052405
24062406
-->
24072407

2408-
> Stability: 0 - Deprecated. Calling `process.umask()` with no arguments is
2409-
> deprecated. No alternative is provided.
2408+
> Stability: 0 - Deprecated. Calling `process.umask()` with no argument causes
2409+
> the process-wide umask to be written twice. This introduces a race condition
2410+
> between threads, and is a potential security vulnerability. There is no safe,
2411+
> cross-platform alternative API.
2412+
2413+
`process.umask()` returns the Node.js process's file mode creation mask. Child
2414+
processes inherit the mask from the parent process.
2415+
2416+
## `process.umask(mask)`
2417+
<!-- YAML
2418+
added: v0.1.19
2419+
-->
24102420

24112421
* `mask` {string|integer}
24122422

2413-
The `process.umask()` method sets or returns the Node.js process's file mode
2414-
creation mask. Child processes inherit the mask from the parent process. Invoked
2415-
without an argument, the current mask is returned, otherwise the umask is set to
2416-
the argument value and the previous mask is returned.
2423+
`process.umask(mask)` sets the Node.js process's file mode creation mask. Child
2424+
processes inherit the mask from the parent process. Returns the previous mask.
24172425

24182426
```js
24192427
const newmask = 0o022;
@@ -2423,8 +2431,7 @@ console.log(
24232431
);
24242432
```
24252433

2426-
[`Worker`][] threads are able to read the umask, however attempting to set the
2427-
umask will result in a thrown exception.
2434+
In [`Worker`][] threads, `process.umask(mask)` will throw an exception.
24282435

24292436
## `process.uptime()`
24302437
<!-- YAML

0 commit comments

Comments
 (0)