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

podman: Change hardcoded libexec path #90379

Closed
wants to merge 1 commit into from

Conversation

afbjorklund
Copy link
Contributor

@afbjorklund afbjorklund commented Dec 3, 2021

Podman had hardcoded paths for brew, which means it doesn't work for user installations.

  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

Closes:

@afbjorklund
Copy link
Contributor Author

This was the error, on Linux: (/home/linuxbrew)

Error: unable to start host networking: "could not find \"gvproxy\" in one of [/usr/local/libexec/podman /usr/local/lib/podman /usr/libexec/podman /usr/lib/podman]"

@carlocab carlocab changed the title Remove hardcoded paths from podman installation podman: remove hardcoded paths Dec 3, 2021
Copy link
Member

@carlocab carlocab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR, @afbjorklund.

Please use the preferred commit-message style for homebrew/core. We put the name of the formula first in commit-message headings. Here's a quick summary from the style guide:

For new formulae:

At Homebrew, we like to put the name of the formula up front like so: foobar 7.3 (new formula).

For existing formulae:

The preferred commit message format for simple version updates is foobar 7.3 and for fixes is foobar: fix flibble matrix..

Refer to the commit style guide for more details. Also, when making further changes to your pull request, use the following guidelines to make sure that @BrewTestBot can merge your commits:

  • One formula per commit; one commit per formula.
  • Keep merge commits out of the pull request.

Comment on lines 37 to 38
# Remove hardcoded paths
patch :DATA
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this patch been upstreamed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, upstream says it should be fixed by downstream...

i.e. they hardcoded some common brew paths

Copy link
Contributor Author

@afbjorklund afbjorklund Dec 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The patch isn't strictly required, we can loop through all the unused paths first if preferred

Also the change is in a dependency (separate project), which is statically linked

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would the inreplace suffice without the patch? We don't carry patches that won't get accepted upstream. (With a handful of exceptions for patches that were made before this was made a policy, but even those could face the chopping block at some point.)

It also seems a bit weird to me for upstream to add Homebrew-specific paths that we would then remove here. Does a similar issue not affect other, non-Homebrew, users, who don't install into /usr or /usr/local?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See containers/podman#12161 (comment)

I did see that, but didn't we just establish above that this issue is not Homebrew-specific? Or was the conclusion above that this affects non-Homebrew users who install into non-standard locations incorrect?

The right thing would be for "catatonit" and "gvproxy" to be dependencies, not bundled.

See #87116 (comment). Though I'm not sure how having gvproxy be a dependency fixes the issue about hard-coded paths.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think they support Homebrew outside of standard prefix, or running on Linux (linuxbrew)
So all other Linux distributions have to patch the search paths in a similar way, or add symlinks.

Presumably if gvproxy was a system dependency, it would be able to find it in some path...
Currently it is a separate package on Ubuntu - with a hardcoded path leading to Podman. :-(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it seems the standalone gvproxy path was already tried (and rejected), so "libexec" it is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think they support Homebrew outside of standard prefix, or running on Linux (linuxbrew)

Those are not separate projects anymore so they really just support half of Homebrew.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be "fun" to see FreeBSDBrew, just like there was some stuff done for DarwinPorts

Basically we tried to run the basic system without the Apple bits, to keep it portable...
And without hardcoding "if apple else gnu". It was surprisingly difficult to do, though.

@afbjorklund
Copy link
Contributor Author

I changed the commit, but the PR headline wasn't updated

Comment on lines 37 to 38
# Remove hardcoded paths
patch :DATA
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would the inreplace suffice without the patch? We don't carry patches that won't get accepted upstream. (With a handful of exceptions for patches that were made before this was made a policy, but even those could face the chopping block at some point.)

It also seems a bit weird to me for upstream to add Homebrew-specific paths that we would then remove here. Does a similar issue not affect other, non-Homebrew, users, who don't install into /usr or /usr/local?

Formula/podman.rb Outdated Show resolved Hide resolved
The path to helper binaries were hardcoded, so it didn't
work for home directory and other relocated installations.

Also the "gvproxy" program has been moved from a subdirectory
to the top libexec directory in Homebrew, so set the new path.

Signed-off-by: Anders F Björklund <[email protected]>
@afbjorklund
Copy link
Contributor Author

afbjorklund commented Dec 3, 2021

Removed all the patches, so now it just changes the hardcoded prefix to the one in the cellar.

anders@ubuntu:/home/linuxbrew$ ./.linuxbrew/bin/podman-remote machine start
INFO[0000] waiting for clients...                       
INFO[0000] listening tcp://0.0.0.0:7777                 
INFO[0000] new connection from @ to /run/user/1000/podman/qemu_podman-machine-default.sock 
Waiting for VM ...
Machine "podman-machine-default" started successfully

@afbjorklund afbjorklund changed the title podman: remove hardcoded paths podman: Change hardcoded libexec path Dec 3, 2021
@SMillerDev
Copy link
Member

Is this also submitted as a patch upstream?

@afbjorklund
Copy link
Contributor Author

afbjorklund commented Dec 5, 2021

Is this also submitted as a patch upstream?

Patches were removed, upstream has all the "usual" homebrew search paths hardcoded.

It's not possible to patch the dynamic part upstream, so it has to be edited downstream...

      system "make", "gvproxy"
      libexec.install "bin/gvproxy"
    inreplace "vendor/github.com/containers/common/pkg/config/config_linux.go", "/usr/local/libexec/podman", libexec
    inreplace "vendor/github.com/containers/common/pkg/config/config_darwin.go", "/usr/local/libexec/podman", libexec

Upstream says that it is homebrew's problem, that it allows users to relocate the prefix:

var defaultHelperBinariesDir = []string{
	// Homebrew install paths
	"/usr/local/opt/podman/libexec",
	"/opt/homebrew/bin",
	"/opt/homebrew/opt/podman/libexec",
	"/usr/local/bin",
	// default paths
	"/usr/local/libexec/podman",
	"/usr/local/lib/podman",
	"/usr/libexec/podman",
	"/usr/lib/podman",
}

It doesn't support linuxbrew, user will have to add some configuration before it starts.

@SMillerDev
Copy link
Member

Upstream says that it is homebrew's problem, that it allows users to relocate the prefix

What about people who want to install their software outside of homebrew? This seems like a really shortsighted idea to me.

@afbjorklund
Copy link
Contributor Author

afbjorklund commented Dec 5, 2021

Upstream says that it is homebrew's problem, that it allows users to relocate the prefix

What about people who want to install their software outside of homebrew? This seems like a really shortsighted idea to me.

Currently you have to either patch it, or supply default configuration...

Basically it supports both prefixes, /usr and /usr/local. (Like Bob)


Any other location of the helper binaries, is left to the packager's discretion:

https://github.com/macports/macports-ports/blob/master/sysutils/podman/files/patch-defaultHelperBinariesDir-for-MacPorts.diff

@afbjorklund
Copy link
Contributor Author

afbjorklund commented Dec 6, 2021

Preferrably, "gvproxy" should be relocated to the default path (i.e. under the prefix)

--- a/Formula/podman.rb
+++ b/Formula/podman.rb
@@ -38,7 +38,7 @@ class Podman < Formula
     ENV["CGO_ENABLED"] = "1"
     os = OS.kernel_name.downcase
 
-    inreplace "vendor/github.com/containers/common/pkg/config/config_#{os}.go", "/usr/local/libexec/podman", libexec
+    inreplace "vendor/github.com/containers/common/pkg/config/config_#{os}.go", "/usr/local/libexec/podman", libexec/"podman"
 
     system "make", "podman-remote-#{os}"
     if OS.mac?
@@ -50,7 +50,7 @@ class Podman < Formula
 
     resource("gvproxy").stage do
       system "make", "gvproxy"
-      libexec.install "bin/gvproxy"
+      (libexec/"podman").install "bin/gvproxy"
     end
 
     if build.head?

That would make it more similar to other platforms and to the default /usr config.

Also makes the top directory less cluttered, when the other helpers are added too ?

/usr/libexec/podman/catatonit
/usr/libexec/podman/conmon
/usr/libexec/podman/gvproxy

@github-actions
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Dec 28, 2021
@github-actions github-actions bot closed this Jan 4, 2022
@gibfahn gibfahn mentioned this pull request Jan 25, 2022
6 tasks
carlocab pushed a commit to gibfahn/homebrew-core that referenced this pull request Jan 27, 2022
BrewTestBot pushed a commit that referenced this pull request Jan 27, 2022
Applies the patch suggested in #90379 (comment).

Refs: #90379

Closes #93794.

Signed-off-by: Carlo Cabrera <[email protected]>
Signed-off-by: BrewTestBot <[email protected]>
@github-actions github-actions bot added the outdated PR was locked due to age label Feb 4, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
go Go use is a significant feature of the PR or issue outdated PR was locked due to age stale No recent activity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants