Page MenuHomeFreeBSD

Makefile: Avoid sanitizing PATH on non-FreeBSD systems
ClosedPublic

Authored by jfree on Jan 9 2023, 5:53 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 20, 5:43 PM
Unknown Object (File)
Wed, Nov 20, 5:27 PM
Unknown Object (File)
Wed, Nov 20, 4:07 PM
Unknown Object (File)
Tue, Nov 12, 7:22 AM
Unknown Object (File)
Sat, Nov 9, 1:24 PM
Unknown Object (File)
Sat, Nov 9, 1:23 PM
Unknown Object (File)
Sat, Nov 9, 1:21 PM
Unknown Object (File)
Wed, Nov 6, 6:57 AM
Subscribers

Details

Summary

Allow the build process to find host binaries during the host-symlinks target when
cross-building on non-FreeBSD systems. Whilst most non-FreeBSD systems have all
the needed tools in /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin (the final
path added by host-symlinks itself), Homebrew for macOS on Arm defaults to
/opt/homebrew/bin, other more niche systems may also deviate and users may
expect tools in a customised PATH to be picked up, unlike on FreeBSD where we
want to ensure everything comes from base. In particular, (un)xz are needed
from Homebrew on macOS, and thus cannot be found on Arm without this.

Note that non-FreeBSD builds enforce BUILD_WITH_STRICT_TMPPATH, and so the
actual main build steps will still use a sanitised PATH.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

jfree requested review of this revision.Jan 9 2023, 5:53 PM
jfree updated this revision to Diff 114872.

Add context to diff

Thanks! This seems fine to me, but please wait for @jrtc27 to approve as well.

This revision is now accepted and ready to land.Jan 17 2023, 3:04 PM

I'd extend the commit message to the following, capturing the justification for the change:

Makefile: Avoid sanitizing PATH on non-FreeBSD systems

Allow the build process to find host binaries during the host-symlinks target when
cross-building on non-FreeBSD systems. Whilst most non-FreeBSD systems have all
the needed tools in /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin (the final
path added by host-symlinks itself), Homebrew for macOS on Arm defaults to
/opt/homebrew/bin, other more niche systems may also deviate and users may
expect tools in a customised PATH to be picked up, unlike on FreeBSD where we
want to ensure everything comes from base. In particular, (un)xz are needed
from Homebrew on macOS, and thus cannot be found on Arm without this.

Note that non-FreeBSD builds enforce BUILD_WITH_STRICT_TMPPATH, and so the
actual main build steps will still use a sanitised PATH.
Makefile
220

This should have a brief comment

jfree retitled this revision from Avoid sanitizing PATH on non-FreeBSD systems to Makefile: Avoid sanitizing PATH on non-FreeBSD systems.Jan 18 2023, 3:32 PM
jfree edited the summary of this revision. (Show Details)

I'd extend the commit message to the following, capturing the justification for the change:

Makefile: Avoid sanitizing PATH on non-FreeBSD systems

Allow the build process to find host binaries during the host-symlinks target when
cross-building on non-FreeBSD systems. Whilst most non-FreeBSD systems have all
the needed tools in /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin (the final
path added by host-symlinks itself), Homebrew for macOS on Arm defaults to
/opt/homebrew/bin, other more niche systems may also deviate and users may
expect tools in a customised PATH to be picked up, unlike on FreeBSD where we
want to ensure everything comes from base. In particular, (un)xz are needed
from Homebrew on macOS, and thus cannot be found on Arm without this.

Note that non-FreeBSD builds enforce BUILD_WITH_STRICT_TMPPATH, and so the
actual main build steps will still use a sanitised PATH.

Thanks for writing this up. I should have added a description like this from the start.
I am not a FreeBSD committer yet, so I am not capable of committing this to src.
Would one of you be willing to do that? @jrtc27 @arichardson

Thanks :)

I'd extend the commit message to the following, capturing the justification for the change:

Makefile: Avoid sanitizing PATH on non-FreeBSD systems

Allow the build process to find host binaries during the host-symlinks target when
cross-building on non-FreeBSD systems. Whilst most non-FreeBSD systems have all
the needed tools in /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin (the final
path added by host-symlinks itself), Homebrew for macOS on Arm defaults to
/opt/homebrew/bin, other more niche systems may also deviate and users may
expect tools in a customised PATH to be picked up, unlike on FreeBSD where we
want to ensure everything comes from base. In particular, (un)xz are needed
from Homebrew on macOS, and thus cannot be found on Arm without this.

Note that non-FreeBSD builds enforce BUILD_WITH_STRICT_TMPPATH, and so the
actual main build steps will still use a sanitised PATH.

Thanks for writing this up. I should have added a description like this from the start.
I am not a FreeBSD committer yet, so I am not capable of committing this to src.
Would one of you be willing to do that? @jrtc27 @arichardson

Thanks :)

Will try testing this change later today and will commit then. Thanks for the patch!

Makefile
224

Now that $PATH is no longer set to a known value it might contains spaces so I think we have to quote this variable.

Makefile
267

And here

595

and here

Also no need to upload a new patch, those are notes to myself for testing later :)

@jfree One more thing, could you give me an email address for committing? I see some commits in tree with Jake Freeland <jfree@FreeBSD.org>, is that correct?

@jfree One more thing, could you give me an email address for committing? I see some commits in tree with Jake Freeland <jfree@FreeBSD.org>, is that correct?

Yes, <jfree@FreeBSD.org> is correct. Thanks.

Makefile
220

Still waiting on this

Add brief comment describing why PATH should only be sanitized on FreeBSD

This revision now requires review to proceed.Jan 19 2023, 10:21 PM
This revision is now accepted and ready to land.Jan 19 2023, 10:22 PM