Skip to content

Conversation

@Itxaka
Copy link

@Itxaka 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.
@Itxaka
Copy link
Author

Itxaka commented Jan 7, 2026

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

Copy link
Member

@dgryski dgryski left a 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.

"runtime"
"testing"

"github.com/tinygo-org/tinygo/src/os"
Copy link
Member

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.

f := newFile("TestLchown", t)
defer Remove(f.Name())
defer f.Close()
link := filepath.Join(os.TempDir(), "TestLchownLink")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.TempDir() -> TempDir()

defer Remove(f.Name())
defer f.Close()
link := filepath.Join(os.TempDir(), "TestLchownLink")
_ = os.Symlink(f.Name(), link)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.Symlink(...) -> Symlink(...)

@Itxaka Itxaka requested a review from dgryski January 9, 2026 17:57
@Itxaka
Copy link
Author

Itxaka commented Jan 9, 2026

Fixed, thanks for the heads up. Cant believe I blatantly copied the test case from the chown and manage to broke it 😆

Copy link
Member

@dgryski dgryski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@deadprogram deadprogram changed the base branch from release to dev January 10, 2026 08:29
@deadprogram
Copy link
Member

@Itxaka please note that I changed the merge target to dev as mentioned here:

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.

@deadprogram deadprogram merged commit ca36fba into tinygo-org:dev Jan 10, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants