-
Notifications
You must be signed in to change notification settings - Fork 1k
feat: Implement Lchown function for changing file ownership #5161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Itxaka
commented
Jan 7, 2026
- Added Lchown function to change the numeric uid and gid of a file or symbolic link.
- Included error handling to return *PathError for failed operations.
- Added unit tests for Lchown to verify behavior on different error scenarios.
- Added Lchown function to change the numeric uid and gid of a file or symbolic link. - Included error handling to return *PathError for failed operations. - Added unit tests for Lchown to verify behavior on different error scenarios.
|
I think this is ok, but not sure about the libc part. I was mostly guided by the existing chown implementation to provide this one :D |
dgryski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just need to update the test. I'm not sure why CI is failing with internal/itoa issues.
src/os/os_chmod_test.go
Outdated
| "runtime" | ||
| "testing" | ||
|
|
||
| "github.com/tinygo-org/tinygo/src/os" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The os package is already impred with . above. Remove.
src/os/os_chmod_test.go
Outdated
| f := newFile("TestLchown", t) | ||
| defer Remove(f.Name()) | ||
| defer f.Close() | ||
| link := filepath.Join(os.TempDir(), "TestLchownLink") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os.TempDir() -> TempDir()
src/os/os_chmod_test.go
Outdated
| defer Remove(f.Name()) | ||
| defer f.Close() | ||
| link := filepath.Join(os.TempDir(), "TestLchownLink") | ||
| _ = os.Symlink(f.Name(), link) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os.Symlink(...) -> Symlink(...)
|
Fixed, thanks for the heads up. Cant believe I blatantly copied the test case from the chown and manage to broke it 😆 |
dgryski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@Itxaka please note that I changed the merge target to https://tinygo.org/docs/guides/contributing/#how-to-use-our-github-repository Now squash/merging. Thanks @Itxaka for the addition and to @dgryski for review. |