From 2e07d4596c0923bb27d4f4aa13356220bcc3c060 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sat, 23 Jun 2018 16:26:29 -0400 Subject: [PATCH] fs: undeprecate lchown() uv_fs_lchown() exists, as of libuv 1.21.0. fs.lchown() can now be undeprecated. This commit also adds tests, as there were none. PR-URL: https://github.com/nodejs/node/pull/21498 Fixes: https://github.com/nodejs/node/issues/19868 Reviewed-By: Wyatt Preul --- doc/api/deprecations.md | 16 ------ doc/api/documentation.md | 5 -- doc/api/fs.md | 17 ++++-- lib/fs.js | 41 ++++++------- lib/internal/fs/promises.js | 11 ++-- src/node_file.cc | 32 ++++++++++- test/parallel/test-fs-lchown.js | 67 ++++++++++++++++++++++ test/parallel/test-fs-null-bytes.js | 3 + test/parallel/test-trace-events-fs-sync.js | 3 + 9 files changed, 140 insertions(+), 55 deletions(-) create mode 100644 test/parallel/test-fs-lchown.js diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 40b48e8bef2dbc..6882f41625f6fc 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -351,20 +351,6 @@ Type: Documentation-only The [`fs.lchmodSync(path, mode)`][] API is deprecated. - -### DEP0037: fs.lchown(path, uid, gid, callback) - -Type: Documentation-only - -The [`fs.lchown(path, uid, gid, callback)`][] API is deprecated. - - -### DEP0038: fs.lchownSync(path, uid, gid) - -Type: Documentation-only - -The [`fs.lchownSync(path, uid, gid)`][] API is deprecated. - ### DEP0039: require.extensions @@ -1037,8 +1023,6 @@ The option `produceCachedData` has been deprecated. Use [`fs.exists(path, callback)`]: fs.html#fs_fs_exists_path_callback [`fs.lchmod(path, mode, callback)`]: fs.html#fs_fs_lchmod_path_mode_callback [`fs.lchmodSync(path, mode)`]: fs.html#fs_fs_lchmodsync_path_mode -[`fs.lchown(path, uid, gid, callback)`]: fs.html#fs_fs_lchown_path_uid_gid_callback -[`fs.lchownSync(path, uid, gid)`]: fs.html#fs_fs_lchownsync_path_uid_gid [`fs.read()`]: fs.html#fs_fs_read_fd_buffer_offset_length_position_callback [`fs.readSync()`]: fs.html#fs_fs_readsync_fd_buffer_offset_length_position [`fs.stat()`]: fs.html#fs_fs_stat_path_callback diff --git a/doc/api/documentation.md b/doc/api/documentation.md index a5909e3268d947..f9fa9591af9805 100644 --- a/doc/api/documentation.md +++ b/doc/api/documentation.md @@ -83,10 +83,6 @@ which simply wrap a syscall, like [`fs.open()`][], will document that. The docs link to the corresponding man pages (short for manual pages) which describe how the syscalls work. -Some syscalls, like lchown(2), are BSD-specific. That means, for -example, that [`fs.lchown()`][] only works on macOS and other BSD-derived -systems, and is not available on Linux. - Most Unix syscalls have Windows equivalents, but behavior may differ on Windows relative to Linux and macOS. For an example of the subtle ways in which it's sometimes impossible to replace Unix syscall semantics on Windows, see [Node @@ -95,6 +91,5 @@ issue 4760](https://github.com/nodejs/node/issues/4760). [`'warning'`]: process.html#process_event_warning [`stderr`]: process.html#process_process_stderr [`fs.open()`]: fs.html#fs_fs_open_path_flags_mode_callback -[`fs.lchown()`]: fs.html#fs_fs_lchown_path_uid_gid_callback [submit an issue]: https://github.com/nodejs/node/issues/new [the contributing guide]: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md diff --git a/doc/api/fs.md b/doc/api/fs.md index e244f01097cef3..111c6b4deaebbf 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -1903,8 +1903,10 @@ Synchronous lchmod(2). Returns `undefined`. ## fs.lchown(path, uid, gid, callback) * `path` {string|Buffer|URL} @@ -3899,7 +3904,11 @@ no arguments upon success. This method is only implemented on macOS. ### fsPromises.lchown(path, uid, gid) * `path` {string|Buffer|URL} @@ -3908,7 +3917,7 @@ deprecated: v10.0.0 * Returns: {Promise} Changes the ownership on a symbolic link then resolves the `Promise` with -no arguments upon success. This method is only implemented on macOS. +no arguments upon success. ### fsPromises.link(existingPath, newPath)