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

build: do not hardcode paths outside of $prefix #16998

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

Conversation

intelfx
Copy link

@intelfx intelfx commented Jan 28, 2025

Motivation and Context

When making local builds of ZFS for debugging, it might be convenient to be able
to make several different builds of ZFS utils and install/run them side-by-side.

When doing so in process of debugging an unrelated change, I discovered that
even if configure is ran with --prefix= pointing to a user-writable directory,
make install always attempts to write some files to system-wide locations
(and thus fails without superuser privileges, not to mention the fact that you
generally do not want to overwrite system files with a dev build regardless).

Description

This fixes behavior of the build system when a prefix other than /usr
is provided.

Specifically, this change makes it possible to build ZFS utils with
--prefix= set to a user-writable directory (such as $HOME/...)
and successfully run make install without superuser privileges.

How Has This Been Tested?

  • build-tested on x86_64 Arch Linux
  • verified correctness of installation with prefix=/usr and prefix!=/usr

(NOTE: CI failures seem relevant, something seems to go wrong with other distros, I'll fix the problems but still would like a superficial review to confirm this is acceptable/reasonable)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

This fixes behavior of the build system when a prefix other than `/usr`
is provided.

Specifically, this change makes it possible to build ZFS utils with
`--prefix=` set to a user-writable directory (such as `$HOME/...`)
and successfully run `make install` without superuser privileges.

Signed-off-by: Ivan Shapovalov <[email protected]>
@intelfx intelfx changed the title config: do not hardcode paths outside of $prefix build: do not hardcode paths outside of $prefix Jan 28, 2025
@amotin
Copy link
Member

amotin commented Jan 28, 2025

@intelfx Linux builders are quite unhappy.

@intelfx
Copy link
Author

intelfx commented Jan 28, 2025

@intelfx Linux builders are quite unhappy.

Yes, I'll fix this. I'm just putting this out here as a PR to run CI on it because it's easier than setting up all those distros locally.

@amotin
Copy link
Member

amotin commented Jan 28, 2025

I'm just putting this out here as a PR to run CI on it because it's easier than setting up all those distros locally.

OK. If it take longer, you could run CI in your own clone or mark the PR as draft.

@ixhamza
Copy link
Member

ixhamza commented Jan 28, 2025

@intelfx - In case you're not aware, you can see the same tests running for each of your pushes in the GitHub Actions for your repository: https://github.com/intelfx/zfs/actions.

@intelfx
Copy link
Author

intelfx commented Jan 28, 2025

@intelfx - In case you're not aware, you can see the same tests running for each of your pushes in the GitHub Actions for your repository: https://github.com/intelfx/zfs/actions.

Yes, I was not aware. I assumed that typically CI runs (especially heavyweight ones) are limited to the parent repository to avoid abuse, so this is unexpected.

@amotin
Copy link
Member

amotin commented Jan 28, 2025

I assumed that typically CI runs are limited to the parent repository to avoid abuse.

As I understand you would only abuse your own limits, unrelated to OpenZFS. You can control whether to run CI on pushes to your own clone in its settings. By default I think it is enabled.

@robn
Copy link
Member

robn commented Jan 29, 2025

@intelfx superficial review looks great. Another thing I've wanted/hacked up/been getting around to for ages. I'll be happy to give it a more in-depth review once you're done!

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