Bug 275738 - sysutils/iocage: console crash for <existing jail>/
Summary: sysutils/iocage: console crash for <existing jail>/
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Michael Gmelin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-13 05:53 UTC by Alexey Vyskubov
Modified: 2024-02-28 16:48 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (grembo)


Attachments
fix for the crash (1.46 KB, patch)
2024-02-27 11:56 UTC, Alexey Vyskubov
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Vyskubov 2023-12-13 05:53:26 UTC
Hello,

I have reported this bug upstream (https://github.com/iocage/iocage/issues/1298) but given that the latest iocage commit happened two years ago, I'm reporting it here as well.

iocage 1.2 from the latest port tree, FreeBSD 14.0-p2

iocage console <existing jail>/ crashes (if / is appended after the name of the existing jail).
Comment 1 Alexey Vyskubov 2024-02-27 11:56:13 UTC
Created attachment 248789 [details]
fix for the crash

The attached patch is not a proper fix but fixes the crash. Now iocage console <existing jail>/ will do the same as iocage console <existing jail> instead of crashing.
Comment 2 Michael Gmelin freebsd_committer freebsd_triage 2024-02-27 16:18:00 UTC
Hi Alexey,

Thank you for opening this.

I wonder if a more correct fix would be to fail with jail not found in case of using "myjail/" instead of "myjail" (seems cleaner to me, as iocage otherwise does partial matches, but, e.g., myjailX will not match myjail).

Especially since this does not only affect the console command, but all commands.

What do you think?

Best
Comment 3 Alexey Vyskubov 2024-02-27 16:38:12 UTC
It will be cleaner but it is not trivial. The point here is that iocage tries some directory check to determine if jail exists, so both .../myjail and .../myjail/ give positive results. I'll think about what to do.
Comment 4 Michael Gmelin freebsd_committer freebsd_triage 2024-02-27 17:04:47 UTC
I have an idea and will commit a fix soon.
Comment 5 commit-hook freebsd_committer freebsd_triage 2024-02-27 17:52:53 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=65eb9ca8f37ffb5888cce55d0d2cdeec3f2f8a24

commit 65eb9ca8f37ffb5888cce55d0d2cdeec3f2f8a24
Author:     Michael Gmelin <grembo@FreeBSD.org>
AuthorDate: 2024-02-27 17:39:39 +0000
Commit:     Michael Gmelin <grembo@FreeBSD.org>
CommitDate: 2024-02-27 17:52:07 +0000

    sysutils/iocage: Fix handling of slashes in jail param

    PR:             275738
    Reported by:    alexey@ocaml.nl

 sysutils/iocage/Makefile | 11 +++++++++--
 sysutils/iocage/distinfo |  4 +++-
 2 files changed, 12 insertions(+), 3 deletions(-)
Comment 6 Michael Gmelin freebsd_committer freebsd_triage 2024-02-28 16:48:38 UTC
@Alexey I think this solves the issue in a clean enough way. Please re-open in case you disagree.