Bug 259710

Summary: Environment variable JAIL causes pkg -j to malfunction
Product: Ports & Packages Reporter: Richard Smith <bugs>
Component: Ports FrameworkAssignee: Mark Linimon <linimon>
Status: Closed Feedback Timeout    
Severity: Affects Some People    
Priority: ---    
Version: Latest   
Hardware: amd64   
OS: Any   

Description Richard Smith 2021-11-08 12:01:46 UTC
If an environment variable called JAIL is defined when invoking "pkg -j" to install a package (e.g. webp) into a jail (e.g. test), the POST-INSTALL script fails to run with the following error message:

    jexec: jail "test" not found
    pkg: POST-INSTALL script failed

Reproduced using:
    # env JAIL=test pkg -j test install webp

Same problem occurs with "delete" command and POST-DEINSTALL script. The problem is present in FreeBSD 12.1 and FreeBSD 13.0.
Comment 1 Baptiste Daroussin freebsd_committer freebsd_triage 2021-11-08 12:08:32 UTC
where does that "    jexec: jail "test" not found"

pkg is not issuing such error message, neither does libjail which is what pkg uses
Comment 2 Baptiste Daroussin freebsd_committer freebsd_triage 2021-11-08 12:10:13 UTC
Can you show me the output of:

env JAIL=test pkg -o DEBUG_SCRIPTS=true -j test install webp
Comment 3 Richard Smith 2021-11-08 12:50:52 UTC
# env JAIL=ballet pkg -o DEBUG_SCRIPTS=true -j ballet install webp
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	webp: 1.2.1

Number of packages to be installed: 1

The process will require 3 MiB more space.

Proceed with this action? [y/N]: y
[ballet.motoko.rdls.net] [1/1] Installing webp-1.2.1...
[ballet.motoko.rdls.net] [1/1] Extracting webp-1.2.1: 100%
+ set -- webp-1.2.1
+ /usr/sbin/service ldconfig restart
jexec: jail "ballet" not found
+ [ -z '' ]
+ exit 1
pkg: POST-INSTALL script failed
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2023-11-28 04:20:00 UTC
^Triage: try to reclassify.

To submitter: does this problem still recur with 14.0?