Skip to content

fs.lchown should be undeprecated #19868

Description

@simevo

fs.lchown is currently deprecated

But fs.lchown can 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.lchown and implement it on the linux platform.

Activity

  1. ryzokuken commented on Apr 7, 2018

    @ryzokuken
    Contributor

    @nodejs/fs thoughts on this?

    @simevo you sure there's no alternative?

  2. added
    fsIssues and PRs related to file-system APIs and the fs module.
    on Apr 7, 2018
  3. addaleax commented on Apr 7, 2018

    @addaleax
    Member

    I’m surprised to hear it’s deprecated and only implemented on some platforms, tbh.

  4. ryzokuken commented on Apr 7, 2018

    @ryzokuken
    Contributor

    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 implement chown on linux? 😛

    @addaleax that said, if we decide to go ahead and add this functionality, I'd love to take a shot at it.

  5. anliting commented on Apr 7, 2018

    @anliting

    @ryzokuken

    I don't think @simevo means it is implemented on Windows. As nodejs/node-v0.x-archive#7382, it is only implemented on macOS.

  6. ryzokuken commented on Apr 7, 2018

    @ryzokuken
    Contributor

    @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.

  7. bnoordhuis commented on Apr 7, 2018

    @bnoordhuis
    Member

    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.

  8. ryzokuken commented on Apr 7, 2018

    @ryzokuken
    Contributor

    @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-deprecate the function before that though, wouldn't we?

    Also, does that mean it'd be semver-major? Or would it be semver-minor because we're not really removing anything, just adding new functionality?

  9. bnoordhuis commented on Apr 7, 2018

    @bnoordhuis
    Member

    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.

  10. ryzokuken commented on Apr 7, 2018

    @ryzokuken
    Contributor

    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.

  11. bnoordhuis commented on Apr 7, 2018

    @bnoordhuis
    Member

    I don't remember any libuv PRs. A quick search doesn't turn up anything either.

  12. ryzokuken commented on Apr 7, 2018

    @ryzokuken
    Contributor

    @bnoordhuis in that case, I'd make an issue on libuv and start looking into it myself as well.

  13. simevo commented on Jun 19, 2018

    @simevo
    Author

    Hi please note that libuv now has lchown, see: libuv/libuv#1826 (comment)

  14. added a commit that references this issue on Jun 25, 2018
  15. added a commit that references this issue on Jun 27, 2018
  16. added a commit that references this issue on Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fsIssues and PRs related to file-system APIs and the fs module.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions