Commit Graph

7408 Commits

Author SHA1 Message Date
Brent Baude
0cba15e256 Merge pull request #28910 from Honny1/fix-hang
Fix client hangs on stale SSH connections
2026-06-15 13:01:31 -05:00
Jan Rodák
f1d0ded43c Convert if/else to switch for transport name comparison
Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-06-12 10:12:49 +02:00
Jan Rodák
454a1dea45 Replace deprecated PatternMatcher.Matches with MatchesResult
Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-06-12 10:12:49 +02:00
Jan Rodák
b294a92a25 Add reasons to all staticcheck suppressions
Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-06-12 10:12:40 +02:00
Jan Rodák
ae825f6234 Fix client hangs on stale SSH connections
Wrap ssh.DialNet in a goroutine so it respects context cancellation,
skip retries on context/timeout errors, and invalidate the cached
connection on failure.

Fixes: https://github.com/containers/podman/issues/28453

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-06-11 16:10:25 +02:00
Matt Heon
735d0b0093 Merge pull request #28903 from Luap99/fix-chrootarchive-remote
fix podman-remote save -f oci-dir/docker-dir
2026-06-11 09:58:56 -04:00
Matej Vašek
7607c3ec82 fix: style
Signed-off-by: Matej Vašek <matejvasek@gmail.com>
2026-06-11 12:56:31 +02:00
Matej Vašek
db70e73056 fix: compat API image push err meg propagation
When returning error http code (e.g. 4xx, 5xx) the body needs to contain
a JSON that has a key "message" in it,
we must not use jsonmessage.JSONMessage.

The JSON of shape jsonmessage.JSONMessage is used only when client
already received 200.

Signed-off-by: Matej Vašek <matejvasek@gmail.com>
2026-06-11 12:56:29 +02:00
Paul Holzinger
fd07b9c6ec fix podman-remote save -f oci-dir/docker-dir
With podman-remote we do not enter a our user namespace like we do with
local podman so we keep running with the real user id.

So if we then try to use chrootarchive as normal user it fails with:
creating mount namespace before pivot: operation not permitted

So simply revert back to the normal archive code.

Now the more interesting thing is we do have a test
"podman save to directory with oci format" but it never runs
rootless+remote in our CI system with our current matrix as we wanted to
reduce jobs.
So rethink the matrix and add one such job as this shows it is needed.

Fixes: 25aee24cbd ("use chrootarchive over plain archive package")

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-06-10 18:47:02 +02:00
Paul Holzinger
cefaa0ee44 Merge pull request #28712 from elezar/info-cdi-devices
info: report configured and discovered CDI devices
2026-06-10 14:34:35 +02:00
Jan Rodák
d55b0a0664 Merge pull request #28889 from Luap99/port-conflict
pkg/specgen: fix port conflict on host assignment
2026-06-10 09:44:50 +02:00
Kir Kolyshkin
3c4068bcd6 deps: bump go-criu to v8.2.0
I guess this was not done by renovate/dependabot because of major
version bump.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-06-09 11:51:46 -07:00
Miloslav Trmač
5f5c128abe Merge pull request #28874 from kila-star1127/issue_25067
fix ssh config parsing for HostName
2026-06-09 20:49:25 +02:00
Paul Holzinger
19c579826a pkg/specgen: fix port conflict on host assignment
This fixes two problems when parsing ports.

First, check for host port conflicts. When we are given the same ip:host
port combo twice then we need to reject that as invalid, the backend
cannot bind the same port twice and thus we always get a runtime
failure. Failing early in the create code path is much better.

Second, when assigning random ports for expose we still have to check
for proper conflicts. The first error was using allUsedContainerPortsMap
to check for conflicts but this holds container side ports, we need to
ensure there are no conflicts on the host port.

Then there was the other issue that the array in the map was copied and
accessed by value on lookup. And because the code did not reassign the
value it then failed to actually update the correct ports.
To address that I switch the map to store the array by reference which
will avoid the bigger copies as we only need to update the pointer now.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-06-09 16:12:35 +02:00
crawfordxx
d0f97989ad machine: escape % as %% in proxy values written to systemd unit conf
systemd interprets % as specifier characters in unit configuration files
(e.g. %H, %u, %40). Proxy environment variable values that contain
percent-encoded URL characters (such as %40 for @ in usernames) cause
systemd to emit warnings and fail to parse the generated
/etc/systemd/system.conf.d/default-env.conf:

  system.conf.d/default-env.conf:2: Failed to resolve specifiers in
  HTTP_PROXY=http://user%40example.com@proxy:3128

Fix by adding a bash variable substitution that doubles every % to %%
before writing to the systemd unit conf files. The profile.d and
environment.d destinations do not need this escaping and continue to
use the original value.

Fixes #28698

Signed-off-by: crawfordxx <crawfordxx@users.noreply.github.com>
2026-06-06 12:04:48 +08:00
Jannik Glückert
b0cb2bb011 fix ssh config parsing for HostName
A later invocation to url.Parse() needs a preceding scheme,
otherwise the hostname just gets discarded.

Fixes #25067

Signed-off-by: Jannik Glückert <jannik.glueckert@gmail.com>
Signed-off-by: KILA <32559459+kila-star1127@users.noreply.github.com>
2026-06-05 18:10:07 +00:00
Paul Holzinger
486bacd3e4 Merge pull request #28335 from axel7083/refactor/quadlet-applications
refactor: podman quadlet sub-command
2026-06-05 17:55:51 +02:00
Paul Holzinger
2d369caca7 Merge pull request #28823 from inknos/run-4472
machine: share virtiofs systemd unit generation
2026-06-03 19:13:51 +02:00
Paul Holzinger
fab963e01c Merge pull request #28693 from kolyshkin/change-label
bump selinux to v1.15.1, use SetProcessKind
2026-06-03 18:42:58 +02:00
Brent Baude
e32fc614df Merge pull request #28800 from danishprakash/remote-log-path
specgen: move log_path handling over to the server
2026-06-03 08:59:54 -05:00
Giuseppe Scrivano
1a76d464fd cmd, commit: change --pause default to true
Pause the container by default during commit.  It is safer as it
avoids conflicts, and potentially security issues, when another
process is accessing the container rootfs.

Originally this was not done because it was a breaking change and
rootless containers weren't able to use the freezer cgroup controller.
Now that we support only cgroup v2, there is no gap anymore with
root (exotic configurations can still use --pause=false).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2026-06-03 07:28:22 +02:00
Danish Prakash
bad0a715ee specgen: move log_path handling over to the server
log_path is currently set at the client side and is ignored by
the server in a remote session. This leads to either incorrect log_path
being considered by the server or not honored at all. Move the handling
from client to the server, in line with other flags such as log_driver.

Signed-off-by: Danish Prakash <contact@danishpraka.sh>
2026-06-03 09:22:50 +05:30
Kir Kolyshkin
ad7b6be2b9 bump selinux to v1.15.1, use SetProcessKind
I was not able to find any external users of pkg/selinux but kept it
for now (and marked as deprecated) so we can remove it later.

PS pkg/selinux adds go:fix directives which are not (yet) recognized
by the gocheckcompilerdirectives linter, so add a temporary exception).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-06-02 11:18:34 -07:00
Nicola Sella
d6cf6e8495 machine: share virtiofs systemd unit generation
Make GenerateSystemDFilesForVirtiofsMounts an agnostic function
and move the code from apple to pkg/machine/volume_systemd.go

MountVolumesToVM  is now a no-op matching the AppleHV and
LibKrun behaviour.

Continues from PR: https://github.com/podman-container-tools/podman/pull/28736

Fixes: https://redhat.atlassian.net/browse/RUN-4742

Signed-off-by: Nicola Sella <nsella@redhat.com>
2026-06-02 14:47:08 +02:00
axel7083
496646f0da feat: update podman quadlet sub-command
Fixes: #28118
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
2026-06-02 09:52:49 +00:00
Evan Lezar
e740848eb9 info: report configured and discovered CDI devices
Add CDI information to podman info and podman system info.

The host info now includes the configured CDI spec directories and the
currently discovered CDI devices. The devices are resolved when the info
endpoint is called and there is no need to refresh these in the background.

Also map the same data into the Docker-compatible /info response as CDISpecDirs and DiscoveredDevices.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
2026-06-01 21:45:41 +02:00
Tom Sweeney
8b1e46170b Adjust API calls for compression
Add the various compression API calls as created by @nalind in #28807

Signed-off-by: Tom Sweeney <tsweeney@redhat.com>
2026-05-29 09:10:50 -04:00
Paul Holzinger
13c6b5d786 pkg/bindings/generator: fall back to golangci-lint from $PATH
Commit cf021c4ba9 switched the logic to also allow golangci-lint in
$PATH but forgot to update the call here.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-05-28 20:38:49 +02:00
Nicola Sella
e59b9dae8f api/libpod: fix r_limits cleared on update
Returnin nil when input is empty, to skip rlimit replacement
when r_limits is not present in the request.

Fixes: https://issues.redhat.com/browse/RHEL-178653

Signed-off-by: Nicola Sella <nsella@redhat.com>
2026-05-27 13:32:31 +02:00
Brent Baude
e581ddc253 Merge pull request #28731 from lstocchi/hyperv_enhancements
Fixes for Hyper-V user experience
2026-05-26 10:30:18 -05:00
Paul Holzinger
22c5f3fa55 Merge pull request #28527 from vyasgun/pr/krunkit-timesync
machine: add vfkit timesync device for Apple VMs
2026-05-26 12:23:04 +02:00
Paul Holzinger
1c6d8a0a89 Merge pull request #28759 from kolyshkin/modernize-3
Assorted go modernize fixes
2026-05-26 12:20:31 +02:00
Jan Rodák
5b98ee331f Merge pull request #28641 from jiwahn/feat/container-annotation-filter
Feat/container annotation filter
2026-05-26 12:00:40 +02:00
Jan Rodák
751f7c316d Merge pull request #28714 from christopherbii/main
Fix Missing HostConfig field from API response
2026-05-26 10:26:46 +02:00
lstocchi
f96cbda1b0 hyperv: propagate detailed error from Hyper-V permission checks
Change isHyperVAdminMember from returning a bool to returning an error so that callers surface the specific failure reason — particularly distinguishing "not in the group" from "in the group but session not updated" (new ErrHypervUserSessionNotUpdated sentinel). This gives users actionable guidance instead of a generic permission error.

Signed-off-by: lstocchi <lstocchi@redhat.com>
2026-05-25 00:10:18 +02:00
Kir Kolyshkin
d4f60b5826 libpod: some modernize fixes for freebsd and darwin
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-05-22 14:15:49 -07:00
Kir Kolyshkin
bf78f80b00 Replace strings.Split(..)[0] with strings.Cut
These places were ignored by modernize, so I did some grepping and
editing.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-05-22 13:08:56 -07:00
Kir Kolyshkin
b4d0747baa pkg/systemd/parser: use slices.Backward
Suggested by modernize (aka go fix).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-05-22 12:28:16 -07:00
Kir Kolyshkin
7797dcb2ab pkg/domain/infra/abi: modernize
Use slices.Contains instead of for loop. Suggested by modernize
(aka go fix).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-05-22 12:26:59 -07:00
Kir Kolyshkin
121948d69e pkg/rootless: modernize
Using modernize (aka go fix) from Go 1.26.3, implement the following
changes:

> pkg/rootless/rootless_linux.go:319:30: fmtappendf: Replace []byte(fmt.Sprintf...) with fmt.Appendf (modernize)
> 		err = os.WriteFile(uidMap, []byte(fmt.Sprintf("%d %d 1\n", 0, os.Geteuid())), 0o666)
> 		                           ^
> pkg/rootless/rootless_linux.go:339:30: fmtappendf: Replace []byte(fmt.Sprintf...) with fmt.Appendf (modernize)
> 		err = os.WriteFile(gidMap, []byte(fmt.Sprintf("%d %d 1\n", 0, os.Getegid())), 0o666)
> 		                           ^
> pkg/rootless/rootless_linux.go:381:6: rangeint: for loop can be modernized using range over int (modernize)
> 	for sig := 0; sig < numSig; sig++ {
> 	    ^
> pkg/rootless/rootless_linux.go:432:24: stringsseq: Ranging over SplitSeq is more efficient (modernize)
> 	for _, entry := range bytes.Split(data, []byte{0}) {
> 	                      ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-05-22 12:25:21 -07:00
Daniel J Walsh
f524bce46a Merge pull request #28753 from kolyshkin/os-is
Stop using os.Is{Exist,NotExist,Permission} checks
2026-05-22 05:18:45 -04:00
Tom Sweeney
3fb897f154 Merge pull request #28747 from kolyshkin/lint-nits
Remove unused nolint annotations
2026-05-21 19:58:34 -04:00
Kir Kolyshkin
7f7b35356f Replace os.Is* error checks with errors.Is
Using os.Is{Exist,NotExist,Permission} checks is not recommended in the
new code (see official documentation). While using it in the existing
code is OK, it may still result in a subtle errors later (for a specific
example of that, see [1]).

Replace those with errors.Is.

Generated by:

	gofmt -r 'os.IsExist(a) -> errors.Is(a, os.ErrExist)' -w .
	gofmt -r 'os.IsNotExist(a) -> errors.Is(a, os.ErrNotExist)' -w .
	gofmt -r 'os.IsPermission(a) -> errors.Is(a, os.ErrPermission)' -w .
	goimports -w .
	git diff vendor test/tools/vendor | patch -p1 -R

[1]: https://github.com/opencontainers/runc/pull/5061
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-05-21 13:09:42 -07:00
Paul Holzinger
23cc1a30fb Merge pull request #28735 from mvanhorn/fix/28298-podman-io-community-trailing-slash
docs(api): drop trailing slash on podman.io/community contact URL
2026-05-21 07:56:03 +02:00
Kir Kolyshkin
a7886d1fe8 Remove unused nolint annotations
The interfacer linter was removed a few years ago.

Remove the annotations as well.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-05-20 15:02:25 -07:00
Christopher Bii
a53c10ced0 compat API: populate HostConfig in container list response
- Populate the Docker-compatible container summary HostConfig from the
  container inspect data
- Remove the unused ContainerCreateConfig wrapper from the compat
  handler
- Add APIv2 test

Signed-off-by: Christopher Bii <christopherbii@hyub.org>
2026-05-20 03:27:14 -04:00
Gunjan Vyas
250e5f9914 use constant for timesync port and update mac_env.sh to print krunkit version
Signed-off-by: Gunjan Vyas <vyasgun20@gmail.com>
2026-05-20 12:56:50 +05:30
Brent Baude
6ef4d68da4 Merge pull request #28723 from SebTardif/fix/close-directory-handle-registries-d
pkg/trust: fix directory handle leak in loadAndMergeConfig
2026-05-19 15:58:39 -05:00
Brent Baude
3c4fb923f0 Merge pull request #28724 from SebTardif/fix/close-leaked-file-handles
Close leaked file handles in container config, CRIU stats, and playbook read
2026-05-19 15:56:27 -05:00
Matt Van Horn
f2a51888f3 docs(api): drop trailing slash on podman.io/community contact URL
The swagger spec generated from pkg/api/server/doc.go sets the contact
URL to https://podman.io/community/. That URL now returns 404, while
https://podman.io/community (no trailing slash) returns 200 and is what
the live site links to from its own navigation. Issue #28298 reports
the link as broken at the top of the rendered API reference, which is
where ReDoc surfaces the contact field.

Drop the trailing slash so the contact link in the generated swagger
spec resolves.

Signed-off-by: Matt Van Horn <mvanhorn@gmail.com>
2026-05-19 02:48:35 -07:00