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

[Bug]: Building with --prefix=/foo installs files to /foo/usr when it should not do so. #13242

Open
Ferroin opened this issue Jun 28, 2022 · 6 comments · May be fixed by #17308
Open

[Bug]: Building with --prefix=/foo installs files to /foo/usr when it should not do so. #13242

Ferroin opened this issue Jun 28, 2022 · 6 comments · May be fixed by #17308
Assignees
Labels
area/packaging Packaging and operating systems support bug os/bsd bsd os related issues os/macos macOS os related issues priority/medium

Comments

@Ferroin
Copy link
Member

Ferroin commented Jun 28, 2022

Bug description

When building the agent with a prefix, we install files into usr under that prefix, even though we should not be doing so.

For example, if installing to /usr/local as a prefix, the binaries end up in /usr/local/usr/bin and /usr/local/usr/sbin, instead of /usr/local/bin and /usr/local/sbin like they should.

Expected behavior

Installing in a prefix puts the files in the correct locations.

Steps to reproduce

  1. Install using an install prefix on any platform, or install using the kickstart script on FreeBSD or macOS.

Installation method

any

System info

n/a

Netdata build info

n/a

Additional info

Supersedes: #12430
Relevant to: #13230

Fixing this requires changes to the configure scripts themselves so that installing to a prefix puts anything that would normally go under /usr under the root of that prefix.

@Ferroin Ferroin added bug needs triage Issues which need to be manually labelled area/build Build system (autotools and cmake). and removed needs triage Issues which need to be manually labelled labels Jun 28, 2022
@Ferroin Ferroin assigned Ferroin and cpipilas and unassigned Ferroin Jun 28, 2022
@MikeJakubik
Copy link

MikeJakubik commented Jun 28, 2022

Also, keep in mind the var location is also technically wrong, it goes to /usr/local/var/run/netdata but no freebsd port that i know of uses anything like this and instead uses /var, i.e. /var/db/netdata, /var/run, /var/cache/netdata, or /var/log/netdata. This isn't as much of a deal as the other issue but thought id mention it.

@Ferroin
Copy link
Member Author

Ferroin commented Jun 28, 2022

Also, keep in mind the var location is also technically wrong, it goes to /usr/local/var/run/netdata but no freebsd port that i know of uses anything like this and instead uses /var, i.e. /var/db/netdata, /var/run, /var/cache/netdata, or /var/log/netdata. This isn't as much of a deal as the other issue but thought id mention it.

That’s a very good point, and we will actually need to fix it eventually, though it will likely be more involved than just patching the build system.

@MikeJakubik
Copy link

MikeJakubik commented Jun 28, 2022

That’s a very good point, and we will actually need to fix it eventually, though it will likely be more involved than just patching the build system.

If it helps, you can see how the port patches the installer to use appropriate directories here.

https://github.com/freebsd/freebsd-ports/tree/main/net-mgmt/netdata

More specifically this file

https://github.com/freebsd/freebsd-ports/blob/main/net-mgmt/netdata/files/patch-configure.ac

@cpipilas cpipilas added os/bsd bsd os related issues os/macos macOS os related issues labels Jun 29, 2022
@Ferroin
Copy link
Member Author

Ferroin commented Jul 27, 2022

Quick update on this. It looks like --prefix=/foo actually works correctly, the issue seems to actually be in how the install/build code is invoking the config script (specifically, we’re explicitly adding /usr when we should not be). Fixing that should be dead simple, but actually testing the fix is not likely to be trivial as I suspect we have some code that blindly assumes the /usr component in the prefix generation.

The /var issue mentioned above is probably also not as complicated as I first thought, but is likely more complicated than the general prefix issue.

@Ferroin Ferroin added area/packaging Packaging and operating systems support and removed area/build Build system (autotools and cmake). labels Jul 27, 2022
@Ferroin Ferroin assigned Ferroin and unassigned cpipilas Jul 27, 2022
@Dim-P
Copy link
Contributor

Dim-P commented Oct 31, 2022

Hey @Ferroin , do we have any planes on fixing this one? Also, do we need a separate ticket for the /var issue?

@Ferroin
Copy link
Member Author

Ferroin commented Oct 31, 2022

The /var thing should be it’s own thing, but is likely to be fixed in a manner similar to this. There’s also the issue of us using /var/run in preference to /run on Linux (we should always be using /run on Linux, not /var/run) as well.

I’ve got the beginnings of a fix for the /usr issue, but it still needs a lot of work (a number of things are still not quite working correctly). I hope to have a PR ready for that some time before the end of the month, but it’s not been an especially high priority issue so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/packaging Packaging and operating systems support bug os/bsd bsd os related issues os/macos macOS os related issues priority/medium
Projects
None yet
5 participants