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

unix: fix mkerrors.sh on OpenBSD by using strlcpy #163

Closed
wants to merge 1 commit into from

Conversation

oxzi
Copy link
Contributor

@oxzi oxzi commented Jun 5, 2023

On OpenBSD, strcpy causes an error message output that recommends the use of strlcpy[0]. Here, the result was that this output became part of the generated program code, causing gofmt to fail and create an empty zerrors_openbsd_GOARCH.go file.

An ifdef guard has been added within the C code which uses the desired strlcpy function under OpenBSD. Other operating systems continue to use strcpy.

[0] https://github.com/openbsd/src/blob/958bc3ae91838214c6d3bb7efc272663a5df7b01/lib/libc/string/strcpy.c#L34-L37

On OpenBSD, strcpy causes an error message output that recommends the
use of strlcpy[0]. Here, the result was that this output became part of
the generated program code, causing gofmt to fail and create an empty
zerrors_openbsd_GOARCH.go file.

An ifdef guard has been added within the C code which uses the desired
strlcpy function under OpenBSD. Other operating systems continue to use
strcpy.

[0] https://github.com/openbsd/src/blob/958bc3ae91838214c6d3bb7efc272663a5df7b01/lib/libc/string/strcpy.c#L34-L37
@oxzi
Copy link
Contributor Author

oxzi commented Jun 5, 2023

Somehow I have overlooked #147 until I just opened this PR. However, the other PR seems to be stalled and this one introduces no changes for other operating systems.

@gopherbot
Copy link

This PR (HEAD: 8c0f635) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/sys/+/501075 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link

Message from Ian Lance Taylor:

Patch Set 1:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/501075.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Alvar Penning:

Patch Set 1:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/501075.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Ian Lance Taylor:

Patch Set 1:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/501075.
After addressing review feedback, remember to publish your drafts!

@oxzi oxzi closed this Jun 14, 2023
@oxzi oxzi deleted the openbsd-mkerrors branch June 14, 2023 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants