Closed awerner closed 1 year ago
Hi @awerner,
I cannot reproduce this issue:
# cat Makejail
INCLUDE options/network.makejail
INCLUDE gh+AppJail-makejails/nginx
COPY usr
SERVICE nginx reload
# ls -ld Makejail
-rw-r--r-- 1 root wheel 98 Jun 1 10:12 Makejail
# cat options/network.makejail
OPTION overwrite
# ls -ld options
drwxr-xr-x 2 root wheel 512 Jun 1 10:09 options
# ls -ld options/network.makejail
-rw-r--r-- 1 root wheel 17 Jun 1 10:09 options/network.makejail
# appjail makejail -f Makejail -j test
[00:00:01] [ info ] [test] Building test ...
[00:00:01] [ debug ] [test] Main Makejail: Makejail
[00:00:01] [ debug ] [test] Using method:file (args:Makejail) from Makejail.
[00:00:01] [ debug ] [test] Including /tmp/issue1/Makejail ...
[00:00:01] [ debug ] [test] Using method:file (args:options/network.makejail) from options/network.makejail.
[00:00:01] [ debug ] [test] Including /tmp/issue1/options/network.makejail ...
[00:00:01] [ debug ] [test] Using method:github (args:AppJail-makejails/nginx) from gh+AppJail-makejails/nginx.
[00:00:01] [ debug ] [test] Using global cache directory (git): /usr/local/appjail/cache/git
[00:00:01] [ debug ] [test] Updating /usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65 ...
[00:00:02] [ debug ] [test] Including /usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65/Makejail ...
[00:00:02] [ debug ] [test] Using method:file (args:options/options.makejail) from options/options.makejail.
[00:00:02] [ debug ] [test] Including /usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65/options/options.makejail ...
[00:00:03] [ debug ] [test] Makejail generated:
[00:00:03] [ debug ] [test] RAW cd -- "/tmp/issue1/options" # Makejail: /tmp/issue1/options/network.makejail
[00:00:03] [ debug ] [test] OPTION overwrite
[00:00:03] [ debug ] [test] RAW cd -- "/tmp/issue1" # Makejail: /tmp/issue1/Makejail
[00:00:03] [ debug ] [test] RAW cd -- "/usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65" # Makejail: /usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65/Makejail
[00:00:03] [ debug ] [test] RAW cd -- "/usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65/options" # Makejail: /usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65/options/options.makejail
[00:00:03] [ debug ] [test] OPTION resolv_conf
[00:00:03] [ debug ] [test] OPTION tzdata
[00:00:03] [ debug ] [test] OPTION overwrite
[00:00:03] [ debug ] [test] OPTION start
[00:00:03] [ debug ] [test] RAW cd -- "/usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65" # Makejail: /usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65/Makejail
[00:00:03] [ debug ] [test] PKG nginx
[00:00:03] [ debug ] [test] SYSRC nginx_enable=YES
[00:00:03] [ debug ] [test] SERVICE nginx start
[00:00:03] [ debug ] [test] RAW cd -- "/tmp/issue1" # Makejail: /tmp/issue1/Makejail
[00:00:03] [ debug ] [test] COPY usr
[00:00:03] [ debug ] [test] SERVICE nginx reload
[00:00:03] [ debug ] [test] Running makejail command (cmd): /usr/local/share/appjail/makejail/cmd/all/RAW (args:cd -- "/tmp/issue1/options" # Makejail: /tmp/issue1/options/network.makejail)
[00:00:03] [ debug ] [test] Running makejail command (cmd): /usr/local/share/appjail/makejail/cmd/build/OPTION (args:overwrite)
[00:00:03] [ debug ] [test] Running makejail command (cmd): /usr/local/share/appjail/makejail/cmd/all/RAW (args:cd -- "/tmp/issue1" # Makejail: /tmp/issue1/Makejail)
[00:00:03] [ debug ] [test] Running makejail command (cmd): /usr/local/share/appjail/makejail/cmd/all/RAW (args:cd -- "/usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65" # Makejail: /usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65/Makejail)
[00:00:03] [ debug ] [test] Running makejail command (cmd): /usr/local/share/appjail/makejail/cmd/all/RAW (args:cd -- "/usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65/options" # Makejail: /usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65/options/options.makejail)
[00:00:03] [ debug ] [test] Running makejail command (cmd): /usr/local/share/appjail/makejail/cmd/build/OPTION (args:resolv_conf)
[00:00:04] [ debug ] [test] Running makejail command (cmd): /usr/local/share/appjail/makejail/cmd/build/OPTION (args:tzdata)
[00:00:04] [ debug ] [test] Running makejail command (cmd): /usr/local/share/appjail/makejail/cmd/build/OPTION (args:overwrite)
[00:00:04] [ debug ] [test] Running makejail command (cmd): /usr/local/share/appjail/makejail/cmd/build/OPTION (args:start)
[00:00:04] [ debug ] [test] Running makejail command (cmd): /usr/local/share/appjail/makejail/cmd/all/RAW (args:cd -- "/usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65" # Makejail: /usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65/Makejail)
[00:00:04] [ debug ] [test] Running makejail command (cmd): /usr/local/share/appjail/makejail/cmd/all/PKG (args:nginx)
[00:00:05] [ debug ] [test] Running makejail command (cmd): /usr/local/share/appjail/makejail/cmd/all/SYSRC (args:nginx_enable=YES)
[00:00:05] [ debug ] [test] Running makejail command (cmd): /usr/local/share/appjail/makejail/cmd/all/SERVICE (args:nginx start)
[00:00:05] [ debug ] [test] Running makejail command (cmd): /usr/local/share/appjail/makejail/cmd/all/RAW (args:cd -- "/tmp/issue1" # Makejail: /tmp/issue1/Makejail)
[00:00:05] [ debug ] [test] Running makejail command (cmd): /usr/local/share/appjail/makejail/cmd/all/COPY (args:usr)
[00:00:06] [ debug ] [test] Running makejail command (cmd): /usr/local/share/appjail/makejail/cmd/all/SERVICE (args:nginx reload)
[00:00:06] [ debug ] [test] Running makejail command (write): /usr/local/share/appjail/makejail/write/build/OPTION (input:/usr/local/appjail/cache/tmp/.appjail/appjail.HvL4Y0MW)
[00:00:06] [ debug ] [test] Running makejail command (write): /usr/local/share/appjail/makejail/write/all/RAW (input:/usr/local/appjail/cache/tmp/.appjail/appjail.LIvctp0U/stages/build/0.RAW)
[00:00:06] [ debug ] [test] Running makejail command (write): /usr/local/share/appjail/makejail/write/all/RAW (input:/usr/local/appjail/cache/tmp/.appjail/appjail.LIvctp0U/stages/build/2.RAW)
[00:00:06] [ debug ] [test] Running makejail command (write): /usr/local/share/appjail/makejail/write/all/RAW (input:/usr/local/appjail/cache/tmp/.appjail/appjail.LIvctp0U/stages/build/3.RAW)
[00:00:06] [ debug ] [test] Running makejail command (write): /usr/local/share/appjail/makejail/write/all/RAW (input:/usr/local/appjail/cache/tmp/.appjail/appjail.LIvctp0U/stages/build/4.RAW)
[00:00:06] [ debug ] [test] Running makejail command (write): /usr/local/share/appjail/makejail/write/all/RAW (input:/usr/local/appjail/cache/tmp/.appjail/appjail.LIvctp0U/stages/build/9.RAW)
[00:00:06] [ debug ] [test] Running makejail command (write): /usr/local/share/appjail/makejail/write/all/PKG (input:/usr/local/appjail/cache/tmp/.appjail/appjail.LIvctp0U/stages/build/10.PKG)
[00:00:06] [ debug ] [test] Running makejail command (write): /usr/local/share/appjail/makejail/write/all/SYSRC (input:/usr/local/appjail/cache/tmp/.appjail/appjail.LIvctp0U/stages/build/11.SYSRC)
[00:00:06] [ debug ] [test] Running makejail command (write): /usr/local/share/appjail/makejail/write/all/SERVICE (input:/usr/local/appjail/cache/tmp/.appjail/appjail.LIvctp0U/stages/build/12.SERVICE)
[00:00:07] [ debug ] [test] Running makejail command (write): /usr/local/share/appjail/makejail/write/all/RAW (input:/usr/local/appjail/cache/tmp/.appjail/appjail.LIvctp0U/stages/build/13.RAW)
[00:00:07] [ debug ] [test] Running makejail command (write): /usr/local/share/appjail/makejail/write/all/COPY (input:/usr/local/appjail/cache/tmp/.appjail/appjail.LIvctp0U/stages/build/14.COPY)
[00:00:07] [ debug ] [test] Running makejail command (write): /usr/local/share/appjail/makejail/write/all/SERVICE (input:/usr/local/appjail/cache/tmp/.appjail/appjail.LIvctp0U/stages/build/15.SERVICE)
[00:00:07] [ debug ] [test] Buildscript generated:
[00:00:07] [ debug ] [test] . "${APPJAIL_CONFIG}"
[00:00:07] [ debug ] [test] . "${LIBDIR}/load"
[00:00:07] [ debug ] [test]
[00:00:07] [ debug ] [test] lib_load "${LIBDIR}/sysexits"
[00:00:07] [ debug ] [test] lib_load "${LIBDIR}/atexit"
[00:00:07] [ debug ] [test] lib_load "${LIBDIR}/log"
[00:00:07] [ debug ] [test] lib_load "${LIBDIR}/check_func"
[00:00:07] [ debug ] [test]
[00:00:07] [ debug ] [test] lib_atexit_init
[00:00:07] [ debug ] [test] set -e
[00:00:07] [ debug ] [test] "${APPJAIL_SCRIPT}" quick "${APPJAIL_JAILNAME}" "overwrite" "resolv_conf" "tzdata" "overwrite" "start"
[00:00:07] [ debug ] [test] cd -- "/tmp/issue1/options" # Makejail: /tmp/issue1/options/network.makejail
[00:00:07] [ debug ] [test] cd -- "/tmp/issue1" # Makejail: /tmp/issue1/Makejail
[00:00:07] [ debug ] [test] cd -- "/usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65" # Makejail: /usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65/Makejail
[00:00:07] [ debug ] [test] cd -- "/usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65/options" # Makejail: /usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65/options/options.makejail
[00:00:07] [ debug ] [test] cd -- "/usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65" # Makejail: /usr/local/appjail/cache/git/1682ec25677094ddd737a4f8da60e9d3b0be35535921653d55fa04f532e6be65/Makejail
[00:00:07] [ debug ] [test] "${APPJAIL_SCRIPT}" pkg jail "${APPJAIL_JAILNAME}" -- install -y -- "nginx"
[00:00:07] [ debug ] [test] "${APPJAIL_SCRIPT}" sysrc jail "${APPJAIL_JAILNAME}" -- "nginx_enable=YES"
[00:00:07] [ debug ] [test] "${APPJAIL_SCRIPT}" service jail "${APPJAIL_JAILNAME}" "nginx" "start"
[00:00:07] [ debug ] [test] cd -- "/tmp/issue1" # Makejail: /tmp/issue1/Makejail
[00:00:07] [ debug ] [test] cp -a -- "usr" "${APPJAIL_JAILDIR}/"
[00:00:07] [ debug ] [test] "${APPJAIL_SCRIPT}" service jail "${APPJAIL_JAILNAME}" "nginx" "reload"
[00:00:08] [ debug ] [test] quick parameters: overwrite resolv_conf tzdata overwrite start
[00:00:08] [ debug ] [test] Trying to remove test ...
[00:00:08] [ warn ] [test] test is not running.
[00:00:09] [ debug ] [test] Removing `test` jail...
[00:00:09] [ debug ] [test] Removing `noschg` flag...
[00:00:09] [ debug ] [test] Removing files...
[00:00:11] [ debug ] [test] test was removed.
[00:00:11] [ info ] [test] Creating a standard jail (thin) ...
[00:00:11] [ info ] [test] Creating a thinjail ...
[00:00:11] [ debug ] [test] Copying: cp -a "/usr/local/appjail/releases/amd64/13.2-RELEASE/default/release/.cshrc" "/usr/local/appjail/jails/test/jail"
[00:00:11] [ debug ] [test] Copying: cp -a "/usr/local/appjail/releases/amd64/13.2-RELEASE/default/release/.profile" "/usr/local/appjail/jails/test/jail"
[00:00:11] [ debug ] [test] Copying: cp -a "/usr/local/appjail/releases/amd64/13.2-RELEASE/default/release/COPYRIGHT" "/usr/local/appjail/jails/test/jail"
[00:00:11] [ debug ] [test] Copying: cp -a "/usr/local/appjail/releases/amd64/13.2-RELEASE/default/release/dev" "/usr/local/appjail/jails/test/jail"
[00:00:11] [ debug ] [test] Copying: cp -a "/usr/local/appjail/releases/amd64/13.2-RELEASE/default/release/etc" "/usr/local/appjail/jails/test/jail"
[00:00:11] [ debug ] [test] Copying: cp -a "/usr/local/appjail/releases/amd64/13.2-RELEASE/default/release/media" "/usr/local/appjail/jails/test/jail"
[00:00:11] [ debug ] [test] Copying: cp -a "/usr/local/appjail/releases/amd64/13.2-RELEASE/default/release/mnt" "/usr/local/appjail/jails/test/jail"
[00:00:12] [ debug ] [test] Copying: cp -a "/usr/local/appjail/releases/amd64/13.2-RELEASE/default/release/net" "/usr/local/appjail/jails/test/jail"
[00:00:12] [ debug ] [test] Copying: cp -a "/usr/local/appjail/releases/amd64/13.2-RELEASE/default/release/proc" "/usr/local/appjail/jails/test/jail"
[00:00:12] [ debug ] [test] Copying: cp -a "/usr/local/appjail/releases/amd64/13.2-RELEASE/default/release/root" "/usr/local/appjail/jails/test/jail"
[00:00:12] [ debug ] [test] Copying: cp -a "/usr/local/appjail/releases/amd64/13.2-RELEASE/default/release/tmp" "/usr/local/appjail/jails/test/jail"
[00:00:12] [ debug ] [test] Copying: cp -a "/usr/local/appjail/releases/amd64/13.2-RELEASE/default/release/usr/obj" "/usr/local/appjail/jails/test/jail/usr"
[00:00:12] [ debug ] [test] Copying: cp -a "/usr/local/appjail/releases/amd64/13.2-RELEASE/default/release/usr/tests" "/usr/local/appjail/jails/test/jail/usr"
[00:00:12] [ debug ] [test] Copying: cp -a "/usr/local/appjail/releases/amd64/13.2-RELEASE/default/release/var" "/usr/local/appjail/jails/test/jail"
[00:00:13] [ debug ] [test] Linking /.appjail/bin -> /usr/local/appjail/jails/test/jail/bin
[00:00:13] [ debug ] [test] Linking /.appjail/boot -> /usr/local/appjail/jails/test/jail/boot
[00:00:13] [ debug ] [test] Linking /.appjail/lib -> /usr/local/appjail/jails/test/jail/lib
[00:00:13] [ debug ] [test] Linking /.appjail/libexec -> /usr/local/appjail/jails/test/jail/libexec
[00:00:13] [ debug ] [test] Linking /.appjail/rescue -> /usr/local/appjail/jails/test/jail/rescue
[00:00:13] [ debug ] [test] Linking /.appjail/sbin -> /usr/local/appjail/jails/test/jail/sbin
[00:00:13] [ debug ] [test] Linking /.appjail/usr/bin -> /usr/local/appjail/jails/test/jail/usr/bin
[00:00:13] [ debug ] [test] Linking /.appjail/usr/include -> /usr/local/appjail/jails/test/jail/usr/include
[00:00:13] [ debug ] [test] Linking /.appjail/usr/lib -> /usr/local/appjail/jails/test/jail/usr/lib
[00:00:13] [ debug ] [test] Linking /.appjail/usr/lib32 -> /usr/local/appjail/jails/test/jail/usr/lib32
[00:00:13] [ debug ] [test] Linking /.appjail/usr/libdata -> /usr/local/appjail/jails/test/jail/usr/libdata
[00:00:13] [ debug ] [test] Linking /.appjail/usr/libexec -> /usr/local/appjail/jails/test/jail/usr/libexec
[00:00:13] [ debug ] [test] Linking /.appjail/usr/sbin -> /usr/local/appjail/jails/test/jail/usr/sbin
[00:00:13] [ debug ] [test] Linking /.appjail/usr/share -> /usr/local/appjail/jails/test/jail/usr/share
[00:00:13] [ debug ] [test] Linking /.appjail/usr/src -> /usr/local/appjail/jails/test/jail/usr/src
[00:00:14] [ info ] [test] Done.
[00:00:14] [ debug ] [test] Copying /etc/localtime as /usr/local/appjail/jails/test/jail/etc/localtime
[00:00:14] [ debug ] [test] Copying /etc/resolv.conf as /usr/local/appjail/jails/test/jail/etc/resolv.conf
[00:00:14] [ debug ] [test] Setting the boot flag to the test jail ...
[00:00:14] [ debug ] [test] Template generated:
[00:00:14] [ debug ] [test] exec.start: "/bin/sh /etc/rc"
[00:00:14] [ debug ] [test] exec.stop: "/bin/sh /etc/rc.shutdown jail"
[00:00:14] [ debug ] [test] mount.devfs
[00:00:15] [ debug ] [test] Done.
[00:00:16] [ debug ] [test] Locking test ...
[00:00:16] [ info ] [test] Starting test...
[00:00:17] [ debug ] [test] Using `/usr/local/appjail/jails/test/conf/template.conf` as the template.
[00:00:17] [ debug ] [test] Writing `/usr/local/appjail/jails/test/conf/template.conf` content to `/usr/local/appjail/cache/tmp/.appjail/appjail.Ya8KXctD` ...
[00:00:17] [ debug ] [test] Checking for parameters marked as required...
[00:00:17] [ debug ] [test] Running: date +%Y-%m-%d.log
[00:00:18] [ debug ] [test] exec.consolelog: /var/log/appjail/jails/test/console/2023-06-01.log
[00:00:18] [ debug ] [test] mount.fstab: /usr/local/appjail/jails/test/conf/fstab
[00:00:18] [ debug ] [test] host.hostname: test.appjail
[00:00:18] [ debug ] [test] Path: /usr/local/appjail/jails/test/jail
[00:00:19] [ debug ] [test] Resolving dependencies for test...
[00:00:19] [ debug ] [test] test appended to the `seen` list.
[00:00:19] [ debug ] [test] test appended to the `resolved` list.
[00:00:19] [ debug ] [test] Compiling template to `/usr/local/appjail/jails/test/conf/jail.conf` ...
[00:00:19] [ debug ] [test] jail.conf generated:
[00:00:19] [ debug ] [test] test {
[00:00:19] [ debug ] [test] exec.start = "/bin/sh /etc/rc";
[00:00:19] [ debug ] [test] exec.stop = "/bin/sh /etc/rc.shutdown jail";
[00:00:19] [ debug ] [test] mount.devfs;
[00:00:19] [ debug ] [test] exec.consolelog = "/var/log/appjail/jails/test/console/2023-06-01.log";
[00:00:19] [ debug ] [test] mount.fstab = "/usr/local/appjail/jails/test/conf/fstab";
[00:00:19] [ debug ] [test] host.hostname = "test.appjail";
[00:00:19] [ debug ] [test] path = "/usr/local/appjail/jails/test/jail";
[00:00:19] [ debug ] [test] }
[00:00:19] [ debug ] [test] Inspecting config.conf:
[00:00:19] [ debug ] [test] appjail_version: 2.5.1
[00:00:19] [ debug ] [test] birth: 1685628766
[00:00:19] [ debug ] [test] osarch: amd64
[00:00:19] [ debug ] [test] osversion: 13.2-RELEASE
[00:00:19] [ debug ] [test] jail_type: thin
[00:00:19] [ debug ] [test] release_name: default
[00:00:19] [ debug ] [test] Preparing a thinjail...
[00:00:19] [ debug ] [test] Checking for mounted file systems in `/usr/local/appjail/jails/test/jail` ...
[00:00:19] [ debug ] [test] Mounting: mount_nullfs -o ro "/usr/local/appjail/releases/amd64/13.2-RELEASE/default/release" "/usr/local/appjail/jails/test/jail/.appjail"
[00:00:20] [ debug ] [test] Creating...
test: created
[00:00:22] [ debug ] [test] Unlocking test ...
Updating FreeBSD repository catalogue...
pkg: http://pkg.freebsd.org/FreeBSD:13:amd64/quarterly/meta.txz: Non-recoverable resolver failure
repository FreeBSD has no meta file, using default settings
pkg: http://pkg.freebsd.org/FreeBSD:13:amd64/quarterly/packagesite.pkg: Non-recoverable resolver failure
pkg: http://pkg.freebsd.org/FreeBSD:13:amd64/quarterly/packagesite.txz: Non-recoverable resolver failure
Unable to update repository FreeBSD
Error updating repositories!
Note that the above error (Non-recoverable resolver failure
) is not related to this issue and occurs because options/network.makejail
does not have a network option.
Fascinating... is there anything else you might need to track this issue? Also, pay attention to how the output is scrambled here:
[00:00:00] [ debug ] [test] Including /root/makejails/Makejail ...
. from options/network.makejailng method:file (args:options/network.makejail
file does not exist or could not be read.k.makejail
So far, I have no idea what could cause this issue. Please keep up with the good work, this project is very promising :)
Alex
Yeah, it is very strange, but I reproduced this issue after thinking for a while. I used unixdos to convert a Makejail written with nvim(1)
to a DOS text format. This problem is because your editor uses \r\n
as newline, while Makejail needs \n
. Of course, I will do something about that, so I left this issue open after fixing it.
You can use dosunix as a workaround.
Thanks for appreciating the project!
Issue
When trying to use the INCLUDE statement in a Makejail file, an error is thrown suggesting that the file does not exist or could not be read. This occurs even when the file exists, is in the correct relative location, and is readable.
Environment
Steps to reproduce
options/network.makejail
with the following content:appjail makejail -f Makejail -j test
Expected behaviour
The INCLUDE statement should correctly include and process the specified file.
Actual behaviour
The program throws an error indicating that the file specified in the INCLUDE statement does not exist or cannot be read.
Additional Information
The
makejail_include
function in the makejail cmd appears to be responsible for handling the INCLUDE statement. The error might originate from this function.Please let me know if you need any further information.