Skip to content
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

Avoid using syscall for errors on unix #201

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

catap
Copy link
Contributor

@catap catap commented Jun 8, 2024

syscall is deprecated and non updated library whcih should be replaced by new one with name x/sys.

Anyway, it may work on some platform and some errors migth be missed on some. A good example is OpenBSD which has lack of syscall.EBADMSG on amd64 and 386 but has on arm64.

Here I moved all errors to two files: one for unix which uses sys.unix, and one for everything else which uses syscall as fallback.

@tonistiigi tonistiigi closed this Oct 22, 2024
@tonistiigi tonistiigi reopened this Oct 22, 2024
//go:build !unix
// +build !unix

package fsutil
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wondering if these should live in an internal package, as (I think) we don't want consumers to be using these to match against (they're only do prevent having to split out the implementation further, correct?)

Copy link
Owner

@tonistiigi tonistiigi Oct 22, 2024

Choose a reason for hiding this comment

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

What's the point of returning typed errors if we don't want consumers to match against them?

I don't really see an issue with old code as well, but if we define these separately, then we should export them as well to let consumers know what they can match against.

Copy link
Collaborator

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

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

@catap There are some conflicts, can you rebase?

syscall is deprecated and non updated library whcih should be replaced
by new one with name x/sys.

Anyway, it may work on some platform and some errors migth be missed on
some. A good example is OpenBSD which has lack of syscall.EBADMSG on
amd64 and 386 but has on arm64.

Here I moved all errors to two files: one for unix which uses sys.unix,
and one for everything else which uses syscall as fallback.
@catap
Copy link
Contributor Author

catap commented Nov 3, 2024

@crazy-max here it is. I haven't tried to build it on go-1.22 but conflict was trivial and grep by patterns syscall.E and 'unix.E doesn't find any new places. So, it should be as fine as it was few months ago

crazy-max
crazy-max previously approved these changes Nov 4, 2024
@crazy-max crazy-max dismissed their stale review November 7, 2024 13:17

actually we could just play with build tags for this instead

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.

4 participants