tinygo icon indicating copy to clipboard operation
tinygo copied to clipboard

os/Chown

Open leongross opened this issue 1 year ago • 6 comments
trafficstars

Add os.Chown()

leongross avatar Mar 28 '24 15:03 leongross

To design meaningful test cases for chown, I think you would need multiple users with different uids and gids and a user who has permission to change ownership of a file to this, a super user. In my opinion, there are 2 ways to integrate this:

  1. update the container image for the CI so that there are accounts with said properties
  2. mocking the file system and permissions

The problem I see with solution 2 is that the implementation of chown relies on the syscall chown, so I wouldn't know how to mock that.

I would appreciate your input on that @rminnich

EDIT: Maybe I am mistaken but as I see it, golang does not do any of the described tests but checks for an error of an invalid gid, maybe this is the way to go here as well?

leongross avatar Apr 03 '24 16:04 leongross

@deadprogram do you have an opinion on that?

leongross avatar Apr 10 '24 12:04 leongross

@deadprogram

leongross avatar Apr 22 '24 20:04 leongross

@rminnich

leongross avatar Apr 26 '24 09:04 leongross

@leongross can you please rebase this PR against the latest dev? Thanks!

deadprogram avatar Jun 15 '24 09:06 deadprogram

@deadprogram rebase done, but noq quite sure where the runtime panic originates. Do you know anything about this?

leongross avatar Jun 16 '24 11:06 leongross

@deadprogram @aykevl

leongross avatar Jul 09 '24 11:07 leongross

@leongross looks like some CI fails on this PR. You probably also need to rebase against latest dev.

deadprogram avatar Jul 18 '24 15:07 deadprogram

The old errors should be fixed except for the ci (failing probably due to https://github.com/tinygo-org/tinygo/issues/4347). Could you review it? @deadprogram

leongross avatar Jul 19 '24 13:07 leongross

@deadprogram I think this was the last fix now, mind to review?

leongross avatar Jul 20 '24 21:07 leongross

Thanks for the additions @leongross and too @rminnich and @aykevl for review.

Now squash/merging.

deadprogram avatar Jul 21 '24 08:07 deadprogram