Repository navigation
fs.lchown should be undeprecated #19868
Description
Activity
@nodejs/fs thoughts on this?
@simevo you sure there's no alternative?
- addedfsIssues and PRs related to file-system APIs and the fs module.Issues and PRs related to file-system APIs and the fs module.
on Apr 7, 2018 I’m surprised to hear it’s deprecated and only implemented on some platforms, tbh.
Strange. I'm equally surprised to hear that it's implemented on Windows and not on Linux. I mean, it's
chown. How do you even not implementchownon linux? 😛@addaleax that said, if we decide to go ahead and add this functionality, I'd love to take a shot at it.
I don't think @simevo means it is implemented on Windows. As nodejs/node-v0.x-archive#7382, it is only implemented on macOS.
@anliting I just found that out myself, and needless to say, it makes a lot of sense.
Could we somehow implement this functionality on Windows too? I'd love if we could make this platform-independent somehow. Let me look into it.
Related: #16695
I’m surprised to hear it’s deprecated and only implemented on some platforms, tbh.
There is no way to implement it with old Linux kernels:
fchmodat()was added in 2.6.16 and it was until recently that we still still supported 2.6.9.2.6.18 is the baseline now so that's no longer a blocker.
Reacted by Nikita Skovoroda and An-Li Ting@bnoordhuis Sounds great!
Now that the baseline has moved, should someone start working on making it work on Linux? We'd probably have to un-
deprecatethe function before that though, wouldn't we?Also, does that mean it'd be
semver-major? Or would it besemver-minorbecause we're not really removing anything, just adding new functionality?Now that the baseline has moved, should someone start working on making it work on Linux?
Yes. It should be added to libuv first.
We'd probably have to un-deprecate the function before that though, wouldn't we?
No, the other way around. It was deprecated because it's platform-specific. It should be un-deprecated only when that's no longer true.
would it be semver-minor because we're not really removing anything, just adding new functionality?
Yep, I'd say so.
Great! I think @chris--young had been working on adding it to libuv? If there's no open PR regarding this in there, I could try looking into it, or submit an issue. That way, we could go with whichever way helps us ship this quicker.
I don't remember any libuv PRs. A quick search doesn't turn up anything either.
@bnoordhuis in that case, I'd make an issue on libuv and start looking into it myself as well.
Reacted by An-Li Ting, Tuan Anh Tran and mary marchiniHi please note that libuv now has lchown, see: libuv/libuv#1826 (comment)
fs.lchownis currently deprecatedBut
fs.lchowncan be helpful to address Time of check to time of use (TOCTOU) bugs, like this one,as it does not dereference symbolic links and merely changes the owner of the link.
Please undeprecate
fs.lchownand implement it on the linux platform.