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

Add more general BSD-friendly changes #1139

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Connor-GH
Copy link

@Connor-GH Connor-GH commented Oct 21, 2023

Portage is a package manager that allows the user the most choice on how to customize their system. Some users may want to use Portage in an environment where the GNU coreutils are not fully present or are not present at all. This patch allows for support for the linux version of the BSD find(1) and the BSD-native command to be used with etc-update and dispatch-conf.

The BSD version of find(1) when ported to Linux needs its arguments to be preceeded with "--". This commit adds this.
The BSD version of find(1) ported to Linux needs the "--" argument appended after the command name. This commit adds this.
bin/dispatch-conf Outdated Show resolved Hide resolved
bin/dispatch-conf Outdated Show resolved Hide resolved
@Connor-GH
Copy link
Author

You're right, but it's even worse than I expected. The BSD version of getopt follows POSIX semantics more closely than the GNU getopt, and the libc change/regression was only seen after porting to glibc. The people who maintain this version of the BSD utils, https://github.com/chimera-linux, use musl libc which possibly already follows the POSIX behavior. setting POSIXLY_CORRECT="1" environment variable fixes this behavior. Is it possible then that etc-update and dispatch-conf (or portage as a whole) set POSIXLY_CORRECT when using find, or would you rather leave it up to the user? I am thinking in terms of a potential app-alternatives/coreutils here.

@Connor-GH Connor-GH marked this pull request as draft October 22, 2023 13:56
@Connor-GH Connor-GH changed the title Add BSD find(1) support to etc-update and dispatch-conf Add more general BSD-friendly changes Oct 22, 2023
@floppym
Copy link
Contributor

floppym commented Oct 24, 2023

I would say that this BSD find should be patched to work properly with glibc without requiring callers to set POSIXLY_CORRECT in the environment.

@Connor-GH
Copy link
Author

I would say that this BSD find should be patched to work properly with glibc without requiring callers to set POSIXLY_CORRECT in the environment.

I ended up doing this in the gentoo repo I maintain for chimerautils. It sets POSIXLY_CORRECT to 1 internally for find, which doesn't leak out into the user's environment.

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