[BUG] mount ALL broken
[MANDATORY] Describe the bug [MANDATORY] When trying to add a nullfs mount to ALL jails, bastille mangled the path resulting in invalid fstab entries.
[MANDATORY] Bastille and FreeBSD version (paste bastille -v && freebsd-version -kru output)
root@generic:/usr/local/bastille/jails # bastille -v && freebsd-version -kru
0.8.20210115
13.0-RELEASE
13.0-RELEASE
13.0-RELEASE
[MANDATORY] How did you install bastille? (port/pkg/git) pkg
[optional] Steps to reproduce?
- Create two or more Bastille jails
$ sudo bastille create jail0 13.0-RELEASE 127.1.2.3 $ sudo bastille create jail1 13.0-RELEASE 127.1.2.4
- Run a mount ALL
$ sudo bastille cmd ALL mkdir /m $ sudo bastille mount ALL /m /m nullfs rw 0 0
[optional] Expected behavior The mount is created exactly the same in each jail.
[optional] Additional context Instead of matching mounts, it succeeded on the first one. On the successive ones, an artifact from the previous jail works its way into the fstab and causes a mount failure.
Example:
freebsd@generic:/usr/local/bastille % sudo bastille mount ALL /m /m nullfs rw 0 0
[jail0]:
/m /usr/local/bastille/jails/jail0/root//m nullfs rw 0 0
[jail1]:
Added: /m /usr/local/bastille/jails/jail1/root//usr/local/bastille/jails/jail0/root//m nullfs rw 0 0
mount: /usr/local/bastille/jails/jail0/root/usr/local/bastille/jails/jail1: No such file or directory
Workaround: In order to resolve this, I cleared out the erroneous line from each fstab file and then ran the mount command for each jail separately.
Thank you for submitting this. Definitely looks like a bug.
Let me try and recreate; see what I can do.
I had a quick look into this and seems that the bastille mount command was written/tested pointing to a single jail rather than working with bastille ALL.
This command will work best with a for loop rewrite to let the variables carry the needed info once per item to avoid nesting.
P.S. ATM I have several PR's in my repository so I will have a quick review of them to avoid further repo conflicts. Also note that this does happens with FreeBSD 12.x as well when tested.
Regards
This issue has been fixed in the following PR 2c87c58a5b71f6753b79810f7a34144694e2b54f
Regards
This was also fixed in #395.
Hi, I was just looking through the issues to see if there is one I could help fix, this here is still open despite having been fixed. Would be nice if someone could close it :)
closing as fixed!!!!