container/dispatcher: stub.Call initialisation helper function
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Test / Create distribution (push) Successful in 34s
				
			
		
			
				
	
				Test / Sandbox (push) Successful in 2m11s
				
			
		
			
				
	
				Test / Hakurei (push) Successful in 3m19s
				
			
		
			
				
	
				Test / Hpkg (push) Successful in 3m34s
				
			
		
			
				
	
				Test / Sandbox (race detector) (push) Successful in 4m33s
				
			
		
			
				
	
				Test / Hakurei (race detector) (push) Successful in 5m28s
				
			
		
			
				
	
				Test / Flake checks (push) Successful in 1m39s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Test / Create distribution (push) Successful in 34s
				
			Test / Sandbox (push) Successful in 2m11s
				
			Test / Hakurei (push) Successful in 3m19s
				
			Test / Hpkg (push) Successful in 3m34s
				
			Test / Sandbox (race detector) (push) Successful in 4m33s
				
			Test / Hakurei (race detector) (push) Successful in 5m28s
				
			Test / Flake checks (push) Successful in 1m39s
				
			This keeps composites analysis happy without making the test cases (too) bloated. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
		
							parent
							
								
									49600a6f46
								
							
						
					
					
						commit
						1b5d20a39b
					
				| @ -20,21 +20,21 @@ func TestAutoEtcOp(t *testing.T) { | ||||
| 		{"mkdirAll", new(Params), &AutoEtcOp{ | ||||
| 			Prefix: "81ceabb30d37bbdb3868004629cb84e9", | ||||
| 		}, nil, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/etc/", os.FileMode(0755)}, nil, stub.UniqueError(3)}, | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/etc/", os.FileMode(0755)}, nil, stub.UniqueError(3)), | ||||
| 		}, stub.UniqueError(3)}, | ||||
| 
 | ||||
| 		{"readdir", new(Params), &AutoEtcOp{ | ||||
| 			Prefix: "81ceabb30d37bbdb3868004629cb84e9", | ||||
| 		}, nil, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/etc/", os.FileMode(0755)}, nil, nil}, | ||||
| 			{"readdir", stub.ExpectArgs{"/sysroot/etc/.host/81ceabb30d37bbdb3868004629cb84e9"}, stubDir(), stub.UniqueError(2)}, | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/etc/", os.FileMode(0755)}, nil, nil), | ||||
| 			call("readdir", stub.ExpectArgs{"/sysroot/etc/.host/81ceabb30d37bbdb3868004629cb84e9"}, stubDir(), stub.UniqueError(2)), | ||||
| 		}, stub.UniqueError(2)}, | ||||
| 
 | ||||
| 		{"symlink", new(Params), &AutoEtcOp{ | ||||
| 			Prefix: "81ceabb30d37bbdb3868004629cb84e9", | ||||
| 		}, nil, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/etc/", os.FileMode(0755)}, nil, nil}, | ||||
| 			{"readdir", stub.ExpectArgs{"/sysroot/etc/.host/81ceabb30d37bbdb3868004629cb84e9"}, stubDir(".host", | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/etc/", os.FileMode(0755)}, nil, nil), | ||||
| 			call("readdir", stub.ExpectArgs{"/sysroot/etc/.host/81ceabb30d37bbdb3868004629cb84e9"}, stubDir(".host", | ||||
| 				"alsa", "bash_logout", "bashrc", "binfmt.d", "dbus-1", "default", "dhcpcd.exit-hook", "fonts", | ||||
| 				"fstab", "fuse.conf", "group", "host.conf", "hostname", "hosts", "hsurc", "inputrc", "issue", "kbd", | ||||
| 				"locale.conf", "login.defs", "lsb-release", "lvm", "machine-id", "man_db.conf", "mdadm.conf", | ||||
| @ -42,15 +42,15 @@ func TestAutoEtcOp(t *testing.T) { | ||||
| 				"nsswitch.conf", "os-release", "pam", "pam.d", "passwd", "pipewire", "pki", "polkit-1", "profile", | ||||
| 				"protocols", "resolv.conf", "resolvconf.conf", "rpc", "services", "set-environment", "shadow", "shells", | ||||
| 				"ssh", "ssl", "static", "subgid", "subuid", "sudoers", "sway", "sysctl.d", "systemd", "terminfo", | ||||
| 				"tmpfiles.d", "udev", "vconsole.conf", "X11", "xdg", "zoneinfo"), nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/alsa", "/sysroot/etc/alsa"}, nil, stub.UniqueError(1)}, | ||||
| 				"tmpfiles.d", "udev", "vconsole.conf", "X11", "xdg", "zoneinfo"), nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/alsa", "/sysroot/etc/alsa"}, nil, stub.UniqueError(1)), | ||||
| 		}, stub.UniqueError(1)}, | ||||
| 
 | ||||
| 		{"symlink mtab", new(Params), &AutoEtcOp{ | ||||
| 			Prefix: "81ceabb30d37bbdb3868004629cb84e9", | ||||
| 		}, nil, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/etc/", os.FileMode(0755)}, nil, nil}, | ||||
| 			{"readdir", stub.ExpectArgs{"/sysroot/etc/.host/81ceabb30d37bbdb3868004629cb84e9"}, stubDir(".host", | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/etc/", os.FileMode(0755)}, nil, nil), | ||||
| 			call("readdir", stub.ExpectArgs{"/sysroot/etc/.host/81ceabb30d37bbdb3868004629cb84e9"}, stubDir(".host", | ||||
| 				"alsa", "bash_logout", "bashrc", "binfmt.d", "dbus-1", "default", "dhcpcd.exit-hook", "fonts", | ||||
| 				"fstab", "fuse.conf", "group", "host.conf", "hostname", "hosts", "hsurc", "inputrc", "issue", "kbd", | ||||
| 				"locale.conf", "login.defs", "lsb-release", "lvm", "machine-id", "man_db.conf", "mdadm.conf", | ||||
| @ -58,41 +58,41 @@ func TestAutoEtcOp(t *testing.T) { | ||||
| 				"nsswitch.conf", "os-release", "pam", "pam.d", "passwd", "pipewire", "pki", "polkit-1", "profile", | ||||
| 				"protocols", "resolv.conf", "resolvconf.conf", "rpc", "services", "set-environment", "shadow", "shells", | ||||
| 				"ssh", "ssl", "static", "subgid", "subuid", "sudoers", "sway", "sysctl.d", "systemd", "terminfo", | ||||
| 				"tmpfiles.d", "udev", "vconsole.conf", "X11", "xdg", "zoneinfo"), nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/alsa", "/sysroot/etc/alsa"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/bash_logout", "/sysroot/etc/bash_logout"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/bashrc", "/sysroot/etc/bashrc"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/binfmt.d", "/sysroot/etc/binfmt.d"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/dbus-1", "/sysroot/etc/dbus-1"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/default", "/sysroot/etc/default"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/dhcpcd.exit-hook", "/sysroot/etc/dhcpcd.exit-hook"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/fonts", "/sysroot/etc/fonts"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/fstab", "/sysroot/etc/fstab"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/fuse.conf", "/sysroot/etc/fuse.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/host.conf", "/sysroot/etc/host.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/hostname", "/sysroot/etc/hostname"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/hosts", "/sysroot/etc/hosts"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/hsurc", "/sysroot/etc/hsurc"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/inputrc", "/sysroot/etc/inputrc"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/issue", "/sysroot/etc/issue"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/kbd", "/sysroot/etc/kbd"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/locale.conf", "/sysroot/etc/locale.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/login.defs", "/sysroot/etc/login.defs"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/lsb-release", "/sysroot/etc/lsb-release"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/lvm", "/sysroot/etc/lvm"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/machine-id", "/sysroot/etc/machine-id"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/man_db.conf", "/sysroot/etc/man_db.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/mdadm.conf", "/sysroot/etc/mdadm.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/modprobe.d", "/sysroot/etc/modprobe.d"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/modules-load.d", "/sysroot/etc/modules-load.d"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{"/proc/mounts", "/sysroot/etc/mtab"}, nil, stub.UniqueError(0)}, | ||||
| 				"tmpfiles.d", "udev", "vconsole.conf", "X11", "xdg", "zoneinfo"), nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/alsa", "/sysroot/etc/alsa"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/bash_logout", "/sysroot/etc/bash_logout"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/bashrc", "/sysroot/etc/bashrc"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/binfmt.d", "/sysroot/etc/binfmt.d"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/dbus-1", "/sysroot/etc/dbus-1"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/default", "/sysroot/etc/default"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/dhcpcd.exit-hook", "/sysroot/etc/dhcpcd.exit-hook"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/fonts", "/sysroot/etc/fonts"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/fstab", "/sysroot/etc/fstab"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/fuse.conf", "/sysroot/etc/fuse.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/host.conf", "/sysroot/etc/host.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/hostname", "/sysroot/etc/hostname"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/hosts", "/sysroot/etc/hosts"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/hsurc", "/sysroot/etc/hsurc"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/inputrc", "/sysroot/etc/inputrc"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/issue", "/sysroot/etc/issue"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/kbd", "/sysroot/etc/kbd"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/locale.conf", "/sysroot/etc/locale.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/login.defs", "/sysroot/etc/login.defs"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/lsb-release", "/sysroot/etc/lsb-release"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/lvm", "/sysroot/etc/lvm"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/machine-id", "/sysroot/etc/machine-id"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/man_db.conf", "/sysroot/etc/man_db.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/mdadm.conf", "/sysroot/etc/mdadm.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/modprobe.d", "/sysroot/etc/modprobe.d"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/modules-load.d", "/sysroot/etc/modules-load.d"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{"/proc/mounts", "/sysroot/etc/mtab"}, nil, stub.UniqueError(0)), | ||||
| 		}, stub.UniqueError(0)}, | ||||
| 
 | ||||
| 		{"success nested", new(Params), &AutoEtcOp{ | ||||
| 			Prefix: "81ceabb30d37bbdb3868004629cb84e9", | ||||
| 		}, nil, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/etc/", os.FileMode(0755)}, nil, nil}, | ||||
| 			{"readdir", stub.ExpectArgs{"/sysroot/etc/.host/81ceabb30d37bbdb3868004629cb84e9"}, stubDir(".host", | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/etc/", os.FileMode(0755)}, nil, nil), | ||||
| 			call("readdir", stub.ExpectArgs{"/sysroot/etc/.host/81ceabb30d37bbdb3868004629cb84e9"}, stubDir(".host", | ||||
| 				"alsa", "bash_logout", "bashrc", "binfmt.d", "dbus-1", "default", "dhcpcd.exit-hook", "fonts", | ||||
| 				"fstab", "fuse.conf", "group", "host.conf", "hostname", "hosts", "hsurc", "inputrc", "issue", "kbd", | ||||
| 				"locale.conf", "login.defs", "lsb-release", "lvm", "machine-id", "man_db.conf", "mdadm.conf", | ||||
| @ -100,79 +100,79 @@ func TestAutoEtcOp(t *testing.T) { | ||||
| 				"nsswitch.conf", "os-release", "pam", "pam.d", "passwd", "pipewire", "pki", "polkit-1", "profile", | ||||
| 				"protocols", "resolv.conf", "resolvconf.conf", "rpc", "services", "set-environment", "shadow", "shells", | ||||
| 				"ssh", "ssl", "static", "subgid", "subuid", "sudoers", "sway", "sysctl.d", "systemd", "terminfo", | ||||
| 				"tmpfiles.d", "udev", "vconsole.conf", "X11", "xdg", "zoneinfo"), nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/alsa", "/sysroot/etc/alsa"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/bash_logout", "/sysroot/etc/bash_logout"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/bashrc", "/sysroot/etc/bashrc"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/binfmt.d", "/sysroot/etc/binfmt.d"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/dbus-1", "/sysroot/etc/dbus-1"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/default", "/sysroot/etc/default"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/dhcpcd.exit-hook", "/sysroot/etc/dhcpcd.exit-hook"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/fonts", "/sysroot/etc/fonts"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/fstab", "/sysroot/etc/fstab"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/fuse.conf", "/sysroot/etc/fuse.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/host.conf", "/sysroot/etc/host.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/hostname", "/sysroot/etc/hostname"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/hosts", "/sysroot/etc/hosts"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/hsurc", "/sysroot/etc/hsurc"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/inputrc", "/sysroot/etc/inputrc"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/issue", "/sysroot/etc/issue"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/kbd", "/sysroot/etc/kbd"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/locale.conf", "/sysroot/etc/locale.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/login.defs", "/sysroot/etc/login.defs"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/lsb-release", "/sysroot/etc/lsb-release"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/lvm", "/sysroot/etc/lvm"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/machine-id", "/sysroot/etc/machine-id"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/man_db.conf", "/sysroot/etc/man_db.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/mdadm.conf", "/sysroot/etc/mdadm.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/modprobe.d", "/sysroot/etc/modprobe.d"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/modules-load.d", "/sysroot/etc/modules-load.d"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{"/proc/mounts", "/sysroot/etc/mtab"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/nanorc", "/sysroot/etc/nanorc"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/netgroup", "/sysroot/etc/netgroup"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/nix", "/sysroot/etc/nix"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/nixos", "/sysroot/etc/nixos"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/NIXOS", "/sysroot/etc/NIXOS"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/nscd.conf", "/sysroot/etc/nscd.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/nsswitch.conf", "/sysroot/etc/nsswitch.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/os-release", "/sysroot/etc/os-release"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/pam", "/sysroot/etc/pam"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/pam.d", "/sysroot/etc/pam.d"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/pipewire", "/sysroot/etc/pipewire"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/pki", "/sysroot/etc/pki"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/polkit-1", "/sysroot/etc/polkit-1"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/profile", "/sysroot/etc/profile"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/protocols", "/sysroot/etc/protocols"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/resolv.conf", "/sysroot/etc/resolv.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/resolvconf.conf", "/sysroot/etc/resolvconf.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/rpc", "/sysroot/etc/rpc"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/services", "/sysroot/etc/services"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/set-environment", "/sysroot/etc/set-environment"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/shadow", "/sysroot/etc/shadow"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/shells", "/sysroot/etc/shells"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/ssh", "/sysroot/etc/ssh"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/ssl", "/sysroot/etc/ssl"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/static", "/sysroot/etc/static"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/subgid", "/sysroot/etc/subgid"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/subuid", "/sysroot/etc/subuid"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/sudoers", "/sysroot/etc/sudoers"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/sway", "/sysroot/etc/sway"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/sysctl.d", "/sysroot/etc/sysctl.d"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/systemd", "/sysroot/etc/systemd"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/terminfo", "/sysroot/etc/terminfo"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/tmpfiles.d", "/sysroot/etc/tmpfiles.d"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/udev", "/sysroot/etc/udev"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/vconsole.conf", "/sysroot/etc/vconsole.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/X11", "/sysroot/etc/X11"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/xdg", "/sysroot/etc/xdg"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/zoneinfo", "/sysroot/etc/zoneinfo"}, nil, nil}, | ||||
| 				"tmpfiles.d", "udev", "vconsole.conf", "X11", "xdg", "zoneinfo"), nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/alsa", "/sysroot/etc/alsa"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/bash_logout", "/sysroot/etc/bash_logout"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/bashrc", "/sysroot/etc/bashrc"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/binfmt.d", "/sysroot/etc/binfmt.d"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/dbus-1", "/sysroot/etc/dbus-1"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/default", "/sysroot/etc/default"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/dhcpcd.exit-hook", "/sysroot/etc/dhcpcd.exit-hook"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/fonts", "/sysroot/etc/fonts"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/fstab", "/sysroot/etc/fstab"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/fuse.conf", "/sysroot/etc/fuse.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/host.conf", "/sysroot/etc/host.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/hostname", "/sysroot/etc/hostname"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/hosts", "/sysroot/etc/hosts"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/hsurc", "/sysroot/etc/hsurc"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/inputrc", "/sysroot/etc/inputrc"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/issue", "/sysroot/etc/issue"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/kbd", "/sysroot/etc/kbd"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/locale.conf", "/sysroot/etc/locale.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/login.defs", "/sysroot/etc/login.defs"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/lsb-release", "/sysroot/etc/lsb-release"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/lvm", "/sysroot/etc/lvm"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/machine-id", "/sysroot/etc/machine-id"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/man_db.conf", "/sysroot/etc/man_db.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/mdadm.conf", "/sysroot/etc/mdadm.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/modprobe.d", "/sysroot/etc/modprobe.d"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/modules-load.d", "/sysroot/etc/modules-load.d"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{"/proc/mounts", "/sysroot/etc/mtab"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/nanorc", "/sysroot/etc/nanorc"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/netgroup", "/sysroot/etc/netgroup"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/nix", "/sysroot/etc/nix"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/nixos", "/sysroot/etc/nixos"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/NIXOS", "/sysroot/etc/NIXOS"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/nscd.conf", "/sysroot/etc/nscd.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/nsswitch.conf", "/sysroot/etc/nsswitch.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/os-release", "/sysroot/etc/os-release"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/pam", "/sysroot/etc/pam"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/pam.d", "/sysroot/etc/pam.d"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/pipewire", "/sysroot/etc/pipewire"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/pki", "/sysroot/etc/pki"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/polkit-1", "/sysroot/etc/polkit-1"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/profile", "/sysroot/etc/profile"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/protocols", "/sysroot/etc/protocols"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/resolv.conf", "/sysroot/etc/resolv.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/resolvconf.conf", "/sysroot/etc/resolvconf.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/rpc", "/sysroot/etc/rpc"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/services", "/sysroot/etc/services"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/set-environment", "/sysroot/etc/set-environment"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/shadow", "/sysroot/etc/shadow"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/shells", "/sysroot/etc/shells"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/ssh", "/sysroot/etc/ssh"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/ssl", "/sysroot/etc/ssl"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/static", "/sysroot/etc/static"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/subgid", "/sysroot/etc/subgid"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/subuid", "/sysroot/etc/subuid"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/sudoers", "/sysroot/etc/sudoers"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/sway", "/sysroot/etc/sway"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/sysctl.d", "/sysroot/etc/sysctl.d"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/systemd", "/sysroot/etc/systemd"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/terminfo", "/sysroot/etc/terminfo"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/tmpfiles.d", "/sysroot/etc/tmpfiles.d"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/udev", "/sysroot/etc/udev"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/vconsole.conf", "/sysroot/etc/vconsole.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/X11", "/sysroot/etc/X11"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/xdg", "/sysroot/etc/xdg"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/zoneinfo", "/sysroot/etc/zoneinfo"}, nil, nil), | ||||
| 		}, nil}, | ||||
| 
 | ||||
| 		{"success", new(Params), &AutoEtcOp{ | ||||
| 			Prefix: "81ceabb30d37bbdb3868004629cb84e9", | ||||
| 		}, nil, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/etc/", os.FileMode(0755)}, nil, nil}, | ||||
| 			{"readdir", stub.ExpectArgs{"/sysroot/etc/.host/81ceabb30d37bbdb3868004629cb84e9"}, stubDir( | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/etc/", os.FileMode(0755)}, nil, nil), | ||||
| 			call("readdir", stub.ExpectArgs{"/sysroot/etc/.host/81ceabb30d37bbdb3868004629cb84e9"}, stubDir( | ||||
| 				"alsa", "bash_logout", "bashrc", "binfmt.d", "dbus-1", "default", "dhcpcd.exit-hook", "fonts", | ||||
| 				"fstab", "fuse.conf", "group", "host.conf", "hostname", "hosts", "hsurc", "inputrc", "issue", "kbd", | ||||
| 				"locale.conf", "login.defs", "lsb-release", "lvm", "machine-id", "man_db.conf", "mdadm.conf", | ||||
| @ -180,72 +180,72 @@ func TestAutoEtcOp(t *testing.T) { | ||||
| 				"nsswitch.conf", "os-release", "pam", "pam.d", "passwd", "pipewire", "pki", "polkit-1", "profile", | ||||
| 				"protocols", "resolv.conf", "resolvconf.conf", "rpc", "services", "set-environment", "shadow", "shells", | ||||
| 				"ssh", "ssl", "static", "subgid", "subuid", "sudoers", "sway", "sysctl.d", "systemd", "terminfo", | ||||
| 				"tmpfiles.d", "udev", "vconsole.conf", "X11", "xdg", "zoneinfo"), nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/alsa", "/sysroot/etc/alsa"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/bash_logout", "/sysroot/etc/bash_logout"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/bashrc", "/sysroot/etc/bashrc"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/binfmt.d", "/sysroot/etc/binfmt.d"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/dbus-1", "/sysroot/etc/dbus-1"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/default", "/sysroot/etc/default"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/dhcpcd.exit-hook", "/sysroot/etc/dhcpcd.exit-hook"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/fonts", "/sysroot/etc/fonts"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/fstab", "/sysroot/etc/fstab"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/fuse.conf", "/sysroot/etc/fuse.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/host.conf", "/sysroot/etc/host.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/hostname", "/sysroot/etc/hostname"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/hosts", "/sysroot/etc/hosts"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/hsurc", "/sysroot/etc/hsurc"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/inputrc", "/sysroot/etc/inputrc"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/issue", "/sysroot/etc/issue"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/kbd", "/sysroot/etc/kbd"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/locale.conf", "/sysroot/etc/locale.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/login.defs", "/sysroot/etc/login.defs"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/lsb-release", "/sysroot/etc/lsb-release"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/lvm", "/sysroot/etc/lvm"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/machine-id", "/sysroot/etc/machine-id"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/man_db.conf", "/sysroot/etc/man_db.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/mdadm.conf", "/sysroot/etc/mdadm.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/modprobe.d", "/sysroot/etc/modprobe.d"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/modules-load.d", "/sysroot/etc/modules-load.d"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{"/proc/mounts", "/sysroot/etc/mtab"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/nanorc", "/sysroot/etc/nanorc"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/netgroup", "/sysroot/etc/netgroup"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/nix", "/sysroot/etc/nix"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/nixos", "/sysroot/etc/nixos"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/NIXOS", "/sysroot/etc/NIXOS"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/nscd.conf", "/sysroot/etc/nscd.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/nsswitch.conf", "/sysroot/etc/nsswitch.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/os-release", "/sysroot/etc/os-release"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/pam", "/sysroot/etc/pam"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/pam.d", "/sysroot/etc/pam.d"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/pipewire", "/sysroot/etc/pipewire"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/pki", "/sysroot/etc/pki"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/polkit-1", "/sysroot/etc/polkit-1"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/profile", "/sysroot/etc/profile"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/protocols", "/sysroot/etc/protocols"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/resolv.conf", "/sysroot/etc/resolv.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/resolvconf.conf", "/sysroot/etc/resolvconf.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/rpc", "/sysroot/etc/rpc"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/services", "/sysroot/etc/services"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/set-environment", "/sysroot/etc/set-environment"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/shadow", "/sysroot/etc/shadow"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/shells", "/sysroot/etc/shells"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/ssh", "/sysroot/etc/ssh"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/ssl", "/sysroot/etc/ssl"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/static", "/sysroot/etc/static"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/subgid", "/sysroot/etc/subgid"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/subuid", "/sysroot/etc/subuid"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/sudoers", "/sysroot/etc/sudoers"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/sway", "/sysroot/etc/sway"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/sysctl.d", "/sysroot/etc/sysctl.d"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/systemd", "/sysroot/etc/systemd"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/terminfo", "/sysroot/etc/terminfo"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/tmpfiles.d", "/sysroot/etc/tmpfiles.d"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/udev", "/sysroot/etc/udev"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/vconsole.conf", "/sysroot/etc/vconsole.conf"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/X11", "/sysroot/etc/X11"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/xdg", "/sysroot/etc/xdg"}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/zoneinfo", "/sysroot/etc/zoneinfo"}, nil, nil}, | ||||
| 				"tmpfiles.d", "udev", "vconsole.conf", "X11", "xdg", "zoneinfo"), nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/alsa", "/sysroot/etc/alsa"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/bash_logout", "/sysroot/etc/bash_logout"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/bashrc", "/sysroot/etc/bashrc"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/binfmt.d", "/sysroot/etc/binfmt.d"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/dbus-1", "/sysroot/etc/dbus-1"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/default", "/sysroot/etc/default"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/dhcpcd.exit-hook", "/sysroot/etc/dhcpcd.exit-hook"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/fonts", "/sysroot/etc/fonts"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/fstab", "/sysroot/etc/fstab"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/fuse.conf", "/sysroot/etc/fuse.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/host.conf", "/sysroot/etc/host.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/hostname", "/sysroot/etc/hostname"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/hosts", "/sysroot/etc/hosts"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/hsurc", "/sysroot/etc/hsurc"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/inputrc", "/sysroot/etc/inputrc"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/issue", "/sysroot/etc/issue"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/kbd", "/sysroot/etc/kbd"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/locale.conf", "/sysroot/etc/locale.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/login.defs", "/sysroot/etc/login.defs"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/lsb-release", "/sysroot/etc/lsb-release"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/lvm", "/sysroot/etc/lvm"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/machine-id", "/sysroot/etc/machine-id"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/man_db.conf", "/sysroot/etc/man_db.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/mdadm.conf", "/sysroot/etc/mdadm.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/modprobe.d", "/sysroot/etc/modprobe.d"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/modules-load.d", "/sysroot/etc/modules-load.d"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{"/proc/mounts", "/sysroot/etc/mtab"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/nanorc", "/sysroot/etc/nanorc"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/netgroup", "/sysroot/etc/netgroup"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/nix", "/sysroot/etc/nix"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/nixos", "/sysroot/etc/nixos"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/NIXOS", "/sysroot/etc/NIXOS"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/nscd.conf", "/sysroot/etc/nscd.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/nsswitch.conf", "/sysroot/etc/nsswitch.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/os-release", "/sysroot/etc/os-release"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/pam", "/sysroot/etc/pam"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/pam.d", "/sysroot/etc/pam.d"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/pipewire", "/sysroot/etc/pipewire"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/pki", "/sysroot/etc/pki"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/polkit-1", "/sysroot/etc/polkit-1"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/profile", "/sysroot/etc/profile"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/protocols", "/sysroot/etc/protocols"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/resolv.conf", "/sysroot/etc/resolv.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/resolvconf.conf", "/sysroot/etc/resolvconf.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/rpc", "/sysroot/etc/rpc"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/services", "/sysroot/etc/services"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/set-environment", "/sysroot/etc/set-environment"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/shadow", "/sysroot/etc/shadow"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/shells", "/sysroot/etc/shells"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/ssh", "/sysroot/etc/ssh"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/ssl", "/sysroot/etc/ssl"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/static", "/sysroot/etc/static"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/subgid", "/sysroot/etc/subgid"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/subuid", "/sysroot/etc/subuid"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/sudoers", "/sysroot/etc/sudoers"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/sway", "/sysroot/etc/sway"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/sysctl.d", "/sysroot/etc/sysctl.d"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/systemd", "/sysroot/etc/systemd"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/terminfo", "/sysroot/etc/terminfo"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/tmpfiles.d", "/sysroot/etc/tmpfiles.d"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/udev", "/sysroot/etc/udev"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/vconsole.conf", "/sysroot/etc/vconsole.conf"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/X11", "/sysroot/etc/X11"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/xdg", "/sysroot/etc/xdg"}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{".host/81ceabb30d37bbdb3868004629cb84e9/zoneinfo", "/sysroot/etc/zoneinfo"}, nil, nil), | ||||
| 		}, nil}, | ||||
| 	}) | ||||
| 
 | ||||
|  | ||||
| @ -21,99 +21,99 @@ func TestAutoRootOp(t *testing.T) { | ||||
| 			Host:  MustAbs("/"), | ||||
| 			Flags: BindWritable, | ||||
| 		}, []stub.Call{ | ||||
| 			{"readdir", stub.ExpectArgs{"/"}, stubDir(), stub.UniqueError(2)}, | ||||
| 			call("readdir", stub.ExpectArgs{"/"}, stubDir(), stub.UniqueError(2)), | ||||
| 		}, stub.UniqueError(2), nil, nil}, | ||||
| 
 | ||||
| 		{"early", &Params{ParentPerm: 0750}, &AutoRootOp{ | ||||
| 			Host:  MustAbs("/"), | ||||
| 			Flags: BindWritable, | ||||
| 		}, []stub.Call{ | ||||
| 			{"readdir", stub.ExpectArgs{"/"}, stubDir("bin", "dev", "etc", "home", "lib64", | ||||
| 				"lost+found", "mnt", "nix", "proc", "root", "run", "srv", "sys", "tmp", "usr", "var"), nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/bin"}, "", stub.UniqueError(1)}, | ||||
| 			call("readdir", stub.ExpectArgs{"/"}, stubDir("bin", "dev", "etc", "home", "lib64", | ||||
| 				"lost+found", "mnt", "nix", "proc", "root", "run", "srv", "sys", "tmp", "usr", "var"), nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/bin"}, "", stub.UniqueError(1)), | ||||
| 		}, stub.UniqueError(1), nil, nil}, | ||||
| 
 | ||||
| 		{"apply", &Params{ParentPerm: 0750}, &AutoRootOp{ | ||||
| 			Host:  MustAbs("/"), | ||||
| 			Flags: BindWritable, | ||||
| 		}, []stub.Call{ | ||||
| 			{"readdir", stub.ExpectArgs{"/"}, stubDir("bin", "dev", "etc", "home", "lib64", | ||||
| 				"lost+found", "mnt", "nix", "proc", "root", "run", "srv", "sys", "tmp", "usr", "var"), nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/bin"}, "/usr/bin", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/home"}, "/home", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/lib64"}, "/lib64", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/lost+found"}, "/lost+found", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/nix"}, "/nix", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/root"}, "/root", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/run"}, "/run", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/srv"}, "/srv", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/sys"}, "/sys", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/usr"}, "/usr", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/var"}, "/var", nil}, | ||||
| 			call("readdir", stub.ExpectArgs{"/"}, stubDir("bin", "dev", "etc", "home", "lib64", | ||||
| 				"lost+found", "mnt", "nix", "proc", "root", "run", "srv", "sys", "tmp", "usr", "var"), nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/bin"}, "/usr/bin", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/home"}, "/home", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/lib64"}, "/lib64", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/lost+found"}, "/lost+found", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/nix"}, "/nix", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/root"}, "/root", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/run"}, "/run", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/srv"}, "/srv", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/sys"}, "/sys", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/usr"}, "/usr", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/var"}, "/var", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/usr/bin"), MustAbs("/bin"), MustAbs("/bin"), BindWritable}}}, nil, nil}, | ||||
| 			{"stat", stub.ExpectArgs{"/host/usr/bin"}, isDirFi(false), stub.UniqueError(0)}, | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/usr/bin"), MustAbs("/bin"), MustAbs("/bin"), BindWritable}}}, nil, nil), | ||||
| 			call("stat", stub.ExpectArgs{"/host/usr/bin"}, isDirFi(false), stub.UniqueError(0)), | ||||
| 		}, stub.UniqueError(0)}, | ||||
| 
 | ||||
| 		{"success pd", &Params{ParentPerm: 0750}, &AutoRootOp{ | ||||
| 			Host:  MustAbs("/"), | ||||
| 			Flags: BindWritable, | ||||
| 		}, []stub.Call{ | ||||
| 			{"readdir", stub.ExpectArgs{"/"}, stubDir("bin", "dev", "etc", "home", "lib64", | ||||
| 				"lost+found", "mnt", "nix", "proc", "root", "run", "srv", "sys", "tmp", "usr", "var"), nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/bin"}, "/usr/bin", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/home"}, "/home", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/lib64"}, "/lib64", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/lost+found"}, "/lost+found", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/nix"}, "/nix", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/root"}, "/root", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/run"}, "/run", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/srv"}, "/srv", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/sys"}, "/sys", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/usr"}, "/usr", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/var"}, "/var", nil}, | ||||
| 			call("readdir", stub.ExpectArgs{"/"}, stubDir("bin", "dev", "etc", "home", "lib64", | ||||
| 				"lost+found", "mnt", "nix", "proc", "root", "run", "srv", "sys", "tmp", "usr", "var"), nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/bin"}, "/usr/bin", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/home"}, "/home", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/lib64"}, "/lib64", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/lost+found"}, "/lost+found", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/nix"}, "/nix", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/root"}, "/root", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/run"}, "/run", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/srv"}, "/srv", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/sys"}, "/sys", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/usr"}, "/usr", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/var"}, "/var", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/usr/bin"), MustAbs("/bin"), MustAbs("/bin"), BindWritable}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/usr/bin"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/bin", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/usr/bin", "/sysroot/bin", uintptr(0x4004), false}, nil, nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/home"), MustAbs("/home"), MustAbs("/home"), BindWritable}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/home"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/home", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/home", "/sysroot/home", uintptr(0x4004), false}, nil, nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/lib64"), MustAbs("/lib64"), MustAbs("/lib64"), BindWritable}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/lib64"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/lib64", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/lib64", "/sysroot/lib64", uintptr(0x4004), false}, nil, nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/lost+found"), MustAbs("/lost+found"), MustAbs("/lost+found"), BindWritable}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/lost+found"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/lost+found", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/lost+found", "/sysroot/lost+found", uintptr(0x4004), false}, nil, nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/nix"), MustAbs("/nix"), MustAbs("/nix"), BindWritable}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/nix"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/nix", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/nix", "/sysroot/nix", uintptr(0x4004), false}, nil, nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/root"), MustAbs("/root"), MustAbs("/root"), BindWritable}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/root"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/root", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/root", "/sysroot/root", uintptr(0x4004), false}, nil, nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/run"), MustAbs("/run"), MustAbs("/run"), BindWritable}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/run"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/run", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/run", "/sysroot/run", uintptr(0x4004), false}, nil, nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/srv"), MustAbs("/srv"), MustAbs("/srv"), BindWritable}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/srv"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/srv", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/srv", "/sysroot/srv", uintptr(0x4004), false}, nil, nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/sys"), MustAbs("/sys"), MustAbs("/sys"), BindWritable}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/sys"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/sys", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/sys", "/sysroot/sys", uintptr(0x4004), false}, nil, nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/usr"), MustAbs("/usr"), MustAbs("/usr"), BindWritable}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/usr"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/usr", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/usr", "/sysroot/usr", uintptr(0x4004), false}, nil, nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var"), MustAbs("/var"), MustAbs("/var"), BindWritable}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/var"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/var", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/var", "/sysroot/var", uintptr(0x4004), false}, nil, nil}, | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/usr/bin"), MustAbs("/bin"), MustAbs("/bin"), BindWritable}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/usr/bin"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/bin", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/usr/bin", "/sysroot/bin", uintptr(0x4004), false}, nil, nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/home"), MustAbs("/home"), MustAbs("/home"), BindWritable}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/home"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/home", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/home", "/sysroot/home", uintptr(0x4004), false}, nil, nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/lib64"), MustAbs("/lib64"), MustAbs("/lib64"), BindWritable}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/lib64"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/lib64", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/lib64", "/sysroot/lib64", uintptr(0x4004), false}, nil, nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/lost+found"), MustAbs("/lost+found"), MustAbs("/lost+found"), BindWritable}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/lost+found"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/lost+found", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/lost+found", "/sysroot/lost+found", uintptr(0x4004), false}, nil, nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/nix"), MustAbs("/nix"), MustAbs("/nix"), BindWritable}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/nix"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/nix", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/nix", "/sysroot/nix", uintptr(0x4004), false}, nil, nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/root"), MustAbs("/root"), MustAbs("/root"), BindWritable}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/root"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/root", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/root", "/sysroot/root", uintptr(0x4004), false}, nil, nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/run"), MustAbs("/run"), MustAbs("/run"), BindWritable}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/run"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/run", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/run", "/sysroot/run", uintptr(0x4004), false}, nil, nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/srv"), MustAbs("/srv"), MustAbs("/srv"), BindWritable}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/srv"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/srv", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/srv", "/sysroot/srv", uintptr(0x4004), false}, nil, nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/sys"), MustAbs("/sys"), MustAbs("/sys"), BindWritable}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/sys"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/sys", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/sys", "/sysroot/sys", uintptr(0x4004), false}, nil, nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/usr"), MustAbs("/usr"), MustAbs("/usr"), BindWritable}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/usr"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/usr", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/usr", "/sysroot/usr", uintptr(0x4004), false}, nil, nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var"), MustAbs("/var"), MustAbs("/var"), BindWritable}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/var"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/var", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/var", "/sysroot/var", uintptr(0x4004), false}, nil, nil), | ||||
| 		}, nil}, | ||||
| 
 | ||||
| 		{"success", &Params{ParentPerm: 0750}, &AutoRootOp{ | ||||
| 			Host: MustAbs("/var/lib/planterette/base/debian:f92c9052"), | ||||
| 		}, []stub.Call{ | ||||
| 			{"readdir", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052"}, stubDir("bin", "dev", "etc", "home", "lib64", | ||||
| 				"lost+found", "mnt", "nix", "proc", "root", "run", "srv", "sys", "tmp", "usr", "var"), nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/bin"}, "/var/lib/planterette/base/debian:f92c9052/usr/bin", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/home"}, "/var/lib/planterette/base/debian:f92c9052/home", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/lib64"}, "/var/lib/planterette/base/debian:f92c9052/lib64", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/lost+found"}, "/var/lib/planterette/base/debian:f92c9052/lost+found", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/nix"}, "/var/lib/planterette/base/debian:f92c9052/nix", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/root"}, "/var/lib/planterette/base/debian:f92c9052/root", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/run"}, "/var/lib/planterette/base/debian:f92c9052/run", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/srv"}, "/var/lib/planterette/base/debian:f92c9052/srv", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/sys"}, "/var/lib/planterette/base/debian:f92c9052/sys", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/usr"}, "/var/lib/planterette/base/debian:f92c9052/usr", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/var"}, "/var/lib/planterette/base/debian:f92c9052/var", nil}, | ||||
| 			call("readdir", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052"}, stubDir("bin", "dev", "etc", "home", "lib64", | ||||
| 				"lost+found", "mnt", "nix", "proc", "root", "run", "srv", "sys", "tmp", "usr", "var"), nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/bin"}, "/var/lib/planterette/base/debian:f92c9052/usr/bin", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/home"}, "/var/lib/planterette/base/debian:f92c9052/home", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/lib64"}, "/var/lib/planterette/base/debian:f92c9052/lib64", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/lost+found"}, "/var/lib/planterette/base/debian:f92c9052/lost+found", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/nix"}, "/var/lib/planterette/base/debian:f92c9052/nix", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/root"}, "/var/lib/planterette/base/debian:f92c9052/root", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/run"}, "/var/lib/planterette/base/debian:f92c9052/run", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/srv"}, "/var/lib/planterette/base/debian:f92c9052/srv", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/sys"}, "/var/lib/planterette/base/debian:f92c9052/sys", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/usr"}, "/var/lib/planterette/base/debian:f92c9052/usr", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052/var"}, "/var/lib/planterette/base/debian:f92c9052/var", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/usr/bin"), MustAbs("/var/lib/planterette/base/debian:f92c9052/bin"), MustAbs("/bin"), 0}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/usr/bin"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/bin", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/usr/bin", "/sysroot/bin", uintptr(0x4005), false}, nil, nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/home"), MustAbs("/var/lib/planterette/base/debian:f92c9052/home"), MustAbs("/home"), 0}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/home"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/home", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/home", "/sysroot/home", uintptr(0x4005), false}, nil, nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/lib64"), MustAbs("/var/lib/planterette/base/debian:f92c9052/lib64"), MustAbs("/lib64"), 0}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/lib64"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/lib64", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/lib64", "/sysroot/lib64", uintptr(0x4005), false}, nil, nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/lost+found"), MustAbs("/var/lib/planterette/base/debian:f92c9052/lost+found"), MustAbs("/lost+found"), 0}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/lost+found"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/lost+found", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/lost+found", "/sysroot/lost+found", uintptr(0x4005), false}, nil, nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/nix"), MustAbs("/var/lib/planterette/base/debian:f92c9052/nix"), MustAbs("/nix"), 0}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/nix"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/nix", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/nix", "/sysroot/nix", uintptr(0x4005), false}, nil, nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/root"), MustAbs("/var/lib/planterette/base/debian:f92c9052/root"), MustAbs("/root"), 0}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/root"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/root", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/root", "/sysroot/root", uintptr(0x4005), false}, nil, nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/run"), MustAbs("/var/lib/planterette/base/debian:f92c9052/run"), MustAbs("/run"), 0}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/run"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/run", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/run", "/sysroot/run", uintptr(0x4005), false}, nil, nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/srv"), MustAbs("/var/lib/planterette/base/debian:f92c9052/srv"), MustAbs("/srv"), 0}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/srv"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/srv", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/srv", "/sysroot/srv", uintptr(0x4005), false}, nil, nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/sys"), MustAbs("/var/lib/planterette/base/debian:f92c9052/sys"), MustAbs("/sys"), 0}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/sys"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/sys", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/sys", "/sysroot/sys", uintptr(0x4005), false}, nil, nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/usr"), MustAbs("/var/lib/planterette/base/debian:f92c9052/usr"), MustAbs("/usr"), 0}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/usr"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/usr", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/usr", "/sysroot/usr", uintptr(0x4005), false}, nil, nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/var"), MustAbs("/var/lib/planterette/base/debian:f92c9052/var"), MustAbs("/var"), 0}}}, nil, nil}, {"stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/var"}, isDirFi(true), nil}, {"mkdirAll", stub.ExpectArgs{"/sysroot/var", os.FileMode(0700)}, nil, nil}, {"bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/var", "/sysroot/var", uintptr(0x4005), false}, nil, nil}, | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/usr/bin"), MustAbs("/var/lib/planterette/base/debian:f92c9052/bin"), MustAbs("/bin"), 0}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/usr/bin"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/bin", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/usr/bin", "/sysroot/bin", uintptr(0x4005), false}, nil, nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/home"), MustAbs("/var/lib/planterette/base/debian:f92c9052/home"), MustAbs("/home"), 0}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/home"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/home", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/home", "/sysroot/home", uintptr(0x4005), false}, nil, nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/lib64"), MustAbs("/var/lib/planterette/base/debian:f92c9052/lib64"), MustAbs("/lib64"), 0}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/lib64"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/lib64", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/lib64", "/sysroot/lib64", uintptr(0x4005), false}, nil, nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/lost+found"), MustAbs("/var/lib/planterette/base/debian:f92c9052/lost+found"), MustAbs("/lost+found"), 0}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/lost+found"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/lost+found", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/lost+found", "/sysroot/lost+found", uintptr(0x4005), false}, nil, nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/nix"), MustAbs("/var/lib/planterette/base/debian:f92c9052/nix"), MustAbs("/nix"), 0}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/nix"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/nix", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/nix", "/sysroot/nix", uintptr(0x4005), false}, nil, nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/root"), MustAbs("/var/lib/planterette/base/debian:f92c9052/root"), MustAbs("/root"), 0}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/root"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/root", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/root", "/sysroot/root", uintptr(0x4005), false}, nil, nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/run"), MustAbs("/var/lib/planterette/base/debian:f92c9052/run"), MustAbs("/run"), 0}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/run"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/run", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/run", "/sysroot/run", uintptr(0x4005), false}, nil, nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/srv"), MustAbs("/var/lib/planterette/base/debian:f92c9052/srv"), MustAbs("/srv"), 0}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/srv"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/srv", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/srv", "/sysroot/srv", uintptr(0x4005), false}, nil, nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/sys"), MustAbs("/var/lib/planterette/base/debian:f92c9052/sys"), MustAbs("/sys"), 0}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/sys"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/sys", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/sys", "/sysroot/sys", uintptr(0x4005), false}, nil, nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/usr"), MustAbs("/var/lib/planterette/base/debian:f92c9052/usr"), MustAbs("/usr"), 0}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/usr"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/usr", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/usr", "/sysroot/usr", uintptr(0x4005), false}, nil, nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"%s %s", []any{"mounting", &BindMountOp{MustAbs("/var/lib/planterette/base/debian:f92c9052/var"), MustAbs("/var/lib/planterette/base/debian:f92c9052/var"), MustAbs("/var"), 0}}}, nil, nil), call("stat", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/var"}, isDirFi(true), nil), call("mkdirAll", stub.ExpectArgs{"/sysroot/var", os.FileMode(0700)}, nil, nil), call("bindMount", stub.ExpectArgs{"/host/var/lib/planterette/base/debian:f92c9052/var", "/sysroot/var", uintptr(0x4005), false}, nil, nil), | ||||
| 		}, nil}, | ||||
| 	}) | ||||
| 
 | ||||
|  | ||||
| @ -214,7 +214,7 @@ var containerTestCases = []struct { | ||||
| 		1000, 100, nil, 0, seccomp.PresetExt}, | ||||
| 	{"custom rules", true, true, true, false, | ||||
| 		emptyOps, emptyMnt, | ||||
| 		1, 31, []seccomp.NativeRule{{seccomp.ScmpSyscall(syscall.SYS_SETUID), seccomp.ScmpErrno(syscall.EPERM), nil}}, 0, seccomp.PresetExt}, | ||||
| 		1, 31, []seccomp.NativeRule{{Syscall: seccomp.ScmpSyscall(syscall.SYS_SETUID), Errno: seccomp.ScmpErrno(syscall.EPERM)}}, 0, seccomp.PresetExt}, | ||||
| 
 | ||||
| 	{"tmpfs", true, false, false, true, | ||||
| 		earlyOps(new(container.Ops). | ||||
|  | ||||
| @ -128,6 +128,12 @@ func checkOpMeta(t *testing.T, testCases []opMetaTestCase) { | ||||
| 	}) | ||||
| } | ||||
| 
 | ||||
| // call initialises a [stub.Call]. | ||||
| // This keeps composites analysis happy without making the test cases too bloated. | ||||
| func call(name string, args stub.ExpectArgs, ret any, err error) stub.Call { | ||||
| 	return stub.Call{Name: name, Args: args, Ret: ret, Err: err} | ||||
| } | ||||
| 
 | ||||
| type simpleTestCase struct { | ||||
| 	name    string | ||||
| 	f       func(k syscallDispatcher) error | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -15,7 +15,7 @@ func TestBindMountOp(t *testing.T) { | ||||
| 			Source: MustAbs("/bin/"), | ||||
| 			Target: MustAbs("/bin/"), | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/bin/"}, "", syscall.ENOENT}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/bin/"}, "", syscall.ENOENT), | ||||
| 		}, syscall.ENOENT, nil, nil}, | ||||
| 
 | ||||
| 		{"skip optional", new(Params), &BindMountOp{ | ||||
| @ -23,7 +23,7 @@ func TestBindMountOp(t *testing.T) { | ||||
| 			Target: MustAbs("/bin/"), | ||||
| 			Flags:  BindOptional, | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/bin/"}, "", syscall.ENOENT}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/bin/"}, "", syscall.ENOENT), | ||||
| 		}, nil, nil, nil}, | ||||
| 
 | ||||
| 		{"success optional", new(Params), &BindMountOp{ | ||||
| @ -31,11 +31,11 @@ func TestBindMountOp(t *testing.T) { | ||||
| 			Target: MustAbs("/bin/"), | ||||
| 			Flags:  BindOptional, | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/bin/"}, "/usr/bin", nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/bin/"}, "/usr/bin", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"stat", stub.ExpectArgs{"/host/usr/bin"}, isDirFi(true), nil}, | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/bin", os.FileMode(0700)}, nil, nil}, | ||||
| 			{"bindMount", stub.ExpectArgs{"/host/usr/bin", "/sysroot/bin", uintptr(0x4005), false}, nil, nil}, | ||||
| 			call("stat", stub.ExpectArgs{"/host/usr/bin"}, isDirFi(true), nil), | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/bin", os.FileMode(0700)}, nil, nil), | ||||
| 			call("bindMount", stub.ExpectArgs{"/host/usr/bin", "/sysroot/bin", uintptr(0x4005), false}, nil, nil), | ||||
| 		}, nil}, | ||||
| 
 | ||||
| 		{"ensureFile device", new(Params), &BindMountOp{ | ||||
| @ -43,10 +43,10 @@ func TestBindMountOp(t *testing.T) { | ||||
| 			Target: MustAbs("/dev/null"), | ||||
| 			Flags:  BindWritable | BindDevice, | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/dev/null"}, "/dev/null", nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/dev/null"}, "/dev/null", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"stat", stub.ExpectArgs{"/host/dev/null"}, isDirFi(false), nil}, | ||||
| 			{"ensureFile", stub.ExpectArgs{"/sysroot/dev/null", os.FileMode(0444), os.FileMode(0700)}, nil, stub.UniqueError(5)}, | ||||
| 			call("stat", stub.ExpectArgs{"/host/dev/null"}, isDirFi(false), nil), | ||||
| 			call("ensureFile", stub.ExpectArgs{"/sysroot/dev/null", os.FileMode(0444), os.FileMode(0700)}, nil, stub.UniqueError(5)), | ||||
| 		}, stub.UniqueError(5)}, | ||||
| 
 | ||||
| 		{"mkdirAll ensure", new(Params), &BindMountOp{ | ||||
| @ -54,7 +54,7 @@ func TestBindMountOp(t *testing.T) { | ||||
| 			Target: MustAbs("/bin/"), | ||||
| 			Flags:  BindEnsure, | ||||
| 		}, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/bin/", os.FileMode(0700)}, nil, stub.UniqueError(4)}, | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/bin/", os.FileMode(0700)}, nil, stub.UniqueError(4)), | ||||
| 		}, stub.UniqueError(4), nil, nil}, | ||||
| 
 | ||||
| 		{"success ensure", new(Params), &BindMountOp{ | ||||
| @ -62,12 +62,12 @@ func TestBindMountOp(t *testing.T) { | ||||
| 			Target: MustAbs("/usr/bin/"), | ||||
| 			Flags:  BindEnsure, | ||||
| 		}, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/bin/", os.FileMode(0700)}, nil, nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/bin/"}, "/usr/bin", nil}, | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/bin/", os.FileMode(0700)}, nil, nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/bin/"}, "/usr/bin", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"stat", stub.ExpectArgs{"/host/usr/bin"}, isDirFi(true), nil}, | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/usr/bin", os.FileMode(0700)}, nil, nil}, | ||||
| 			{"bindMount", stub.ExpectArgs{"/host/usr/bin", "/sysroot/usr/bin", uintptr(0x4005), false}, nil, nil}, | ||||
| 			call("stat", stub.ExpectArgs{"/host/usr/bin"}, isDirFi(true), nil), | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/usr/bin", os.FileMode(0700)}, nil, nil), | ||||
| 			call("bindMount", stub.ExpectArgs{"/host/usr/bin", "/sysroot/usr/bin", uintptr(0x4005), false}, nil, nil), | ||||
| 		}, nil}, | ||||
| 
 | ||||
| 		{"success device ro", new(Params), &BindMountOp{ | ||||
| @ -75,11 +75,11 @@ func TestBindMountOp(t *testing.T) { | ||||
| 			Target: MustAbs("/dev/null"), | ||||
| 			Flags:  BindDevice, | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/dev/null"}, "/dev/null", nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/dev/null"}, "/dev/null", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"stat", stub.ExpectArgs{"/host/dev/null"}, isDirFi(false), nil}, | ||||
| 			{"ensureFile", stub.ExpectArgs{"/sysroot/dev/null", os.FileMode(0444), os.FileMode(0700)}, nil, nil}, | ||||
| 			{"bindMount", stub.ExpectArgs{"/host/dev/null", "/sysroot/dev/null", uintptr(0x4001), false}, nil, nil}, | ||||
| 			call("stat", stub.ExpectArgs{"/host/dev/null"}, isDirFi(false), nil), | ||||
| 			call("ensureFile", stub.ExpectArgs{"/sysroot/dev/null", os.FileMode(0444), os.FileMode(0700)}, nil, nil), | ||||
| 			call("bindMount", stub.ExpectArgs{"/host/dev/null", "/sysroot/dev/null", uintptr(0x4001), false}, nil, nil), | ||||
| 		}, nil}, | ||||
| 
 | ||||
| 		{"success device", new(Params), &BindMountOp{ | ||||
| @ -87,59 +87,59 @@ func TestBindMountOp(t *testing.T) { | ||||
| 			Target: MustAbs("/dev/null"), | ||||
| 			Flags:  BindWritable | BindDevice, | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/dev/null"}, "/dev/null", nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/dev/null"}, "/dev/null", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"stat", stub.ExpectArgs{"/host/dev/null"}, isDirFi(false), nil}, | ||||
| 			{"ensureFile", stub.ExpectArgs{"/sysroot/dev/null", os.FileMode(0444), os.FileMode(0700)}, nil, nil}, | ||||
| 			{"bindMount", stub.ExpectArgs{"/host/dev/null", "/sysroot/dev/null", uintptr(0x4000), false}, nil, nil}, | ||||
| 			call("stat", stub.ExpectArgs{"/host/dev/null"}, isDirFi(false), nil), | ||||
| 			call("ensureFile", stub.ExpectArgs{"/sysroot/dev/null", os.FileMode(0444), os.FileMode(0700)}, nil, nil), | ||||
| 			call("bindMount", stub.ExpectArgs{"/host/dev/null", "/sysroot/dev/null", uintptr(0x4000), false}, nil, nil), | ||||
| 		}, nil}, | ||||
| 
 | ||||
| 		{"evalSymlinks", new(Params), &BindMountOp{ | ||||
| 			Source: MustAbs("/bin/"), | ||||
| 			Target: MustAbs("/bin/"), | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/bin/"}, "/usr/bin", stub.UniqueError(3)}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/bin/"}, "/usr/bin", stub.UniqueError(3)), | ||||
| 		}, stub.UniqueError(3), nil, nil}, | ||||
| 
 | ||||
| 		{"stat", new(Params), &BindMountOp{ | ||||
| 			Source: MustAbs("/bin/"), | ||||
| 			Target: MustAbs("/bin/"), | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/bin/"}, "/usr/bin", nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/bin/"}, "/usr/bin", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"stat", stub.ExpectArgs{"/host/usr/bin"}, isDirFi(true), stub.UniqueError(2)}, | ||||
| 			call("stat", stub.ExpectArgs{"/host/usr/bin"}, isDirFi(true), stub.UniqueError(2)), | ||||
| 		}, stub.UniqueError(2)}, | ||||
| 
 | ||||
| 		{"mkdirAll", new(Params), &BindMountOp{ | ||||
| 			Source: MustAbs("/bin/"), | ||||
| 			Target: MustAbs("/bin/"), | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/bin/"}, "/usr/bin", nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/bin/"}, "/usr/bin", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"stat", stub.ExpectArgs{"/host/usr/bin"}, isDirFi(true), nil}, | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/bin", os.FileMode(0700)}, nil, stub.UniqueError(1)}, | ||||
| 			call("stat", stub.ExpectArgs{"/host/usr/bin"}, isDirFi(true), nil), | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/bin", os.FileMode(0700)}, nil, stub.UniqueError(1)), | ||||
| 		}, stub.UniqueError(1)}, | ||||
| 
 | ||||
| 		{"bindMount", new(Params), &BindMountOp{ | ||||
| 			Source: MustAbs("/bin/"), | ||||
| 			Target: MustAbs("/bin/"), | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/bin/"}, "/usr/bin", nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/bin/"}, "/usr/bin", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"stat", stub.ExpectArgs{"/host/usr/bin"}, isDirFi(true), nil}, | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/bin", os.FileMode(0700)}, nil, nil}, | ||||
| 			{"bindMount", stub.ExpectArgs{"/host/usr/bin", "/sysroot/bin", uintptr(0x4005), false}, nil, stub.UniqueError(0)}, | ||||
| 			call("stat", stub.ExpectArgs{"/host/usr/bin"}, isDirFi(true), nil), | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/bin", os.FileMode(0700)}, nil, nil), | ||||
| 			call("bindMount", stub.ExpectArgs{"/host/usr/bin", "/sysroot/bin", uintptr(0x4005), false}, nil, stub.UniqueError(0)), | ||||
| 		}, stub.UniqueError(0)}, | ||||
| 
 | ||||
| 		{"success", new(Params), &BindMountOp{ | ||||
| 			Source: MustAbs("/bin/"), | ||||
| 			Target: MustAbs("/bin/"), | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/bin/"}, "/usr/bin", nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/bin/"}, "/usr/bin", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"stat", stub.ExpectArgs{"/host/usr/bin"}, isDirFi(true), nil}, | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/bin", os.FileMode(0700)}, nil, nil}, | ||||
| 			{"bindMount", stub.ExpectArgs{"/host/usr/bin", "/sysroot/bin", uintptr(0x4005), false}, nil, nil}, | ||||
| 			call("stat", stub.ExpectArgs{"/host/usr/bin"}, isDirFi(true), nil), | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/bin", os.FileMode(0700)}, nil, nil), | ||||
| 			call("bindMount", stub.ExpectArgs{"/host/usr/bin", "/sysroot/bin", uintptr(0x4005), false}, nil, nil), | ||||
| 		}, nil}, | ||||
| 	}) | ||||
| 
 | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -13,7 +13,7 @@ func TestMkdirOp(t *testing.T) { | ||||
| 			Path: MustAbs("/.hakurei"), | ||||
| 			Perm: 0500, | ||||
| 		}, nil, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/.hakurei", os.FileMode(0500)}, nil, nil}, | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/.hakurei", os.FileMode(0500)}, nil, nil), | ||||
| 		}, nil}, | ||||
| 	}) | ||||
| 
 | ||||
|  | ||||
| @ -54,11 +54,11 @@ func TestMountOverlayOp(t *testing.T) { | ||||
| 			}, | ||||
| 			Upper: MustAbs("/"), | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052"}, "/var/lib/planterette/base/debian:f92c9052", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/app/org.chromium.Chromium@debian:f92c9052"}, "/var/lib/planterette/app/org.chromium.Chromium@debian:f92c9052", nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052"}, "/var/lib/planterette/base/debian:f92c9052", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/app/org.chromium.Chromium@debian:f92c9052"}, "/var/lib/planterette/app/org.chromium.Chromium@debian:f92c9052", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot", os.FileMode(0705)}, nil, nil}, | ||||
| 			{"mkdirTemp", stub.ExpectArgs{"/", "overlay.upper.*"}, "overlay.upper.32768", stub.UniqueError(6)}, | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot", os.FileMode(0705)}, nil, nil), | ||||
| 			call("mkdirTemp", stub.ExpectArgs{"/", "overlay.upper.*"}, "overlay.upper.32768", stub.UniqueError(6)), | ||||
| 		}, stub.UniqueError(6)}, | ||||
| 
 | ||||
| 		{"mkdirTemp work ephemeral", &Params{ParentPerm: 0705}, &MountOverlayOp{ | ||||
| @ -69,12 +69,12 @@ func TestMountOverlayOp(t *testing.T) { | ||||
| 			}, | ||||
| 			Upper: MustAbs("/"), | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052"}, "/var/lib/planterette/base/debian:f92c9052", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/app/org.chromium.Chromium@debian:f92c9052"}, "/var/lib/planterette/app/org.chromium.Chromium@debian:f92c9052", nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052"}, "/var/lib/planterette/base/debian:f92c9052", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/app/org.chromium.Chromium@debian:f92c9052"}, "/var/lib/planterette/app/org.chromium.Chromium@debian:f92c9052", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot", os.FileMode(0705)}, nil, nil}, | ||||
| 			{"mkdirTemp", stub.ExpectArgs{"/", "overlay.upper.*"}, "overlay.upper.32768", nil}, | ||||
| 			{"mkdirTemp", stub.ExpectArgs{"/", "overlay.work.*"}, "overlay.work.32768", stub.UniqueError(5)}, | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot", os.FileMode(0705)}, nil, nil), | ||||
| 			call("mkdirTemp", stub.ExpectArgs{"/", "overlay.upper.*"}, "overlay.upper.32768", nil), | ||||
| 			call("mkdirTemp", stub.ExpectArgs{"/", "overlay.work.*"}, "overlay.work.32768", stub.UniqueError(5)), | ||||
| 		}, stub.UniqueError(5)}, | ||||
| 
 | ||||
| 		{"success ephemeral", &Params{ParentPerm: 0705}, &MountOverlayOp{ | ||||
| @ -85,19 +85,19 @@ func TestMountOverlayOp(t *testing.T) { | ||||
| 			}, | ||||
| 			Upper: MustAbs("/"), | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052"}, "/var/lib/planterette/base/debian:f92c9052", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/app/org.chromium.Chromium@debian:f92c9052"}, "/var/lib/planterette/app/org.chromium.Chromium@debian:f92c9052", nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/base/debian:f92c9052"}, "/var/lib/planterette/base/debian:f92c9052", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/var/lib/planterette/app/org.chromium.Chromium@debian:f92c9052"}, "/var/lib/planterette/app/org.chromium.Chromium@debian:f92c9052", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot", os.FileMode(0705)}, nil, nil}, | ||||
| 			{"mkdirTemp", stub.ExpectArgs{"/", "overlay.upper.*"}, "overlay.upper.32768", nil}, | ||||
| 			{"mkdirTemp", stub.ExpectArgs{"/", "overlay.work.*"}, "overlay.work.32768", nil}, | ||||
| 			{"mount", stub.ExpectArgs{"overlay", "/sysroot", "overlay", uintptr(0), "" + | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot", os.FileMode(0705)}, nil, nil), | ||||
| 			call("mkdirTemp", stub.ExpectArgs{"/", "overlay.upper.*"}, "overlay.upper.32768", nil), | ||||
| 			call("mkdirTemp", stub.ExpectArgs{"/", "overlay.work.*"}, "overlay.work.32768", nil), | ||||
| 			call("mount", stub.ExpectArgs{"overlay", "/sysroot", "overlay", uintptr(0), "" + | ||||
| 				"upperdir=overlay.upper.32768," + | ||||
| 				"workdir=overlay.work.32768," + | ||||
| 				"lowerdir=" + | ||||
| 				`/host/var/lib/planterette/base/debian\:f92c9052:` + | ||||
| 				`/host/var/lib/planterette/app/org.chromium.Chromium@debian\:f92c9052,` + | ||||
| 				"userxattr"}, nil, nil}, | ||||
| 				"userxattr"}, nil, nil), | ||||
| 		}, nil}, | ||||
| 
 | ||||
| 		{"short lower ro", &Params{ParentPerm: 0755}, &MountOverlayOp{ | ||||
| @ -106,9 +106,9 @@ func TestMountOverlayOp(t *testing.T) { | ||||
| 				MustAbs("/mnt-root/nix/.ro-store"), | ||||
| 			}, | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store"}, "/mnt-root/nix/.ro-store", nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store"}, "/mnt-root/nix/.ro-store", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/nix/store", os.FileMode(0755)}, nil, nil}, | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/nix/store", os.FileMode(0755)}, nil, nil), | ||||
| 		}, &OverlayArgumentError{OverlayReadonlyLower, zeroString}}, | ||||
| 
 | ||||
| 		{"success ro noPrefix", &Params{ParentPerm: 0755}, &MountOverlayOp{ | ||||
| @ -119,15 +119,15 @@ func TestMountOverlayOp(t *testing.T) { | ||||
| 			}, | ||||
| 			noPrefix: true, | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store"}, "/mnt-root/nix/.ro-store", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store0"}, "/mnt-root/nix/.ro-store0", nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store"}, "/mnt-root/nix/.ro-store", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store0"}, "/mnt-root/nix/.ro-store0", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/nix/store", os.FileMode(0755)}, nil, nil}, | ||||
| 			{"mount", stub.ExpectArgs{"overlay", "/nix/store", "overlay", uintptr(0), "" + | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/nix/store", os.FileMode(0755)}, nil, nil), | ||||
| 			call("mount", stub.ExpectArgs{"overlay", "/nix/store", "overlay", uintptr(0), "" + | ||||
| 				"lowerdir=" + | ||||
| 				"/host/mnt-root/nix/.ro-store:" + | ||||
| 				"/host/mnt-root/nix/.ro-store0," + | ||||
| 				"userxattr"}, nil, nil}, | ||||
| 				"userxattr"}, nil, nil), | ||||
| 		}, nil}, | ||||
| 
 | ||||
| 		{"success ro", &Params{ParentPerm: 0755}, &MountOverlayOp{ | ||||
| @ -137,15 +137,15 @@ func TestMountOverlayOp(t *testing.T) { | ||||
| 				MustAbs("/mnt-root/nix/.ro-store0"), | ||||
| 			}, | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store"}, "/mnt-root/nix/.ro-store", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store0"}, "/mnt-root/nix/.ro-store0", nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store"}, "/mnt-root/nix/.ro-store", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store0"}, "/mnt-root/nix/.ro-store0", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/nix/store", os.FileMode(0755)}, nil, nil}, | ||||
| 			{"mount", stub.ExpectArgs{"overlay", "/sysroot/nix/store", "overlay", uintptr(0), "" + | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/nix/store", os.FileMode(0755)}, nil, nil), | ||||
| 			call("mount", stub.ExpectArgs{"overlay", "/sysroot/nix/store", "overlay", uintptr(0), "" + | ||||
| 				"lowerdir=" + | ||||
| 				"/host/mnt-root/nix/.ro-store:" + | ||||
| 				"/host/mnt-root/nix/.ro-store0," + | ||||
| 				"userxattr"}, nil, nil}, | ||||
| 				"userxattr"}, nil, nil), | ||||
| 		}, nil}, | ||||
| 
 | ||||
| 		{"nil lower", &Params{ParentPerm: 0700}, &MountOverlayOp{ | ||||
| @ -153,10 +153,10 @@ func TestMountOverlayOp(t *testing.T) { | ||||
| 			Upper:  MustAbs("/mnt-root/nix/.rw-store/upper"), | ||||
| 			Work:   MustAbs("/mnt-root/nix/.rw-store/work"), | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/upper"}, "/mnt-root/nix/.rw-store/.upper", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/work"}, "/mnt-root/nix/.rw-store/.work", nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/upper"}, "/mnt-root/nix/.rw-store/.upper", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/work"}, "/mnt-root/nix/.rw-store/.work", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/nix/store", os.FileMode(0700)}, nil, nil}, | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/nix/store", os.FileMode(0700)}, nil, nil), | ||||
| 		}, &OverlayArgumentError{OverlayEmptyLower, zeroString}}, | ||||
| 
 | ||||
| 		{"evalSymlinks upper", &Params{ParentPerm: 0700}, &MountOverlayOp{ | ||||
| @ -165,7 +165,7 @@ func TestMountOverlayOp(t *testing.T) { | ||||
| 			Upper:  MustAbs("/mnt-root/nix/.rw-store/upper"), | ||||
| 			Work:   MustAbs("/mnt-root/nix/.rw-store/work"), | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/upper"}, "/mnt-root/nix/.rw-store/.upper", stub.UniqueError(4)}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/upper"}, "/mnt-root/nix/.rw-store/.upper", stub.UniqueError(4)), | ||||
| 		}, stub.UniqueError(4), nil, nil}, | ||||
| 
 | ||||
| 		{"evalSymlinks work", &Params{ParentPerm: 0700}, &MountOverlayOp{ | ||||
| @ -174,8 +174,8 @@ func TestMountOverlayOp(t *testing.T) { | ||||
| 			Upper:  MustAbs("/mnt-root/nix/.rw-store/upper"), | ||||
| 			Work:   MustAbs("/mnt-root/nix/.rw-store/work"), | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/upper"}, "/mnt-root/nix/.rw-store/.upper", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/work"}, "/mnt-root/nix/.rw-store/.work", stub.UniqueError(3)}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/upper"}, "/mnt-root/nix/.rw-store/.upper", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/work"}, "/mnt-root/nix/.rw-store/.work", stub.UniqueError(3)), | ||||
| 		}, stub.UniqueError(3), nil, nil}, | ||||
| 
 | ||||
| 		{"evalSymlinks lower", &Params{ParentPerm: 0700}, &MountOverlayOp{ | ||||
| @ -184,9 +184,9 @@ func TestMountOverlayOp(t *testing.T) { | ||||
| 			Upper:  MustAbs("/mnt-root/nix/.rw-store/upper"), | ||||
| 			Work:   MustAbs("/mnt-root/nix/.rw-store/work"), | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/upper"}, "/mnt-root/nix/.rw-store/.upper", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/work"}, "/mnt-root/nix/.rw-store/.work", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store"}, "/mnt-root/nix/ro-store", stub.UniqueError(2)}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/upper"}, "/mnt-root/nix/.rw-store/.upper", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/work"}, "/mnt-root/nix/.rw-store/.work", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store"}, "/mnt-root/nix/ro-store", stub.UniqueError(2)), | ||||
| 		}, stub.UniqueError(2), nil, nil}, | ||||
| 
 | ||||
| 		{"mkdirAll", &Params{ParentPerm: 0700}, &MountOverlayOp{ | ||||
| @ -195,11 +195,11 @@ func TestMountOverlayOp(t *testing.T) { | ||||
| 			Upper:  MustAbs("/mnt-root/nix/.rw-store/upper"), | ||||
| 			Work:   MustAbs("/mnt-root/nix/.rw-store/work"), | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/upper"}, "/mnt-root/nix/.rw-store/.upper", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/work"}, "/mnt-root/nix/.rw-store/.work", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store"}, "/mnt-root/nix/ro-store", nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/upper"}, "/mnt-root/nix/.rw-store/.upper", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/work"}, "/mnt-root/nix/.rw-store/.work", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store"}, "/mnt-root/nix/ro-store", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/nix/store", os.FileMode(0700)}, nil, stub.UniqueError(1)}, | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/nix/store", os.FileMode(0700)}, nil, stub.UniqueError(1)), | ||||
| 		}, stub.UniqueError(1)}, | ||||
| 
 | ||||
| 		{"mount", &Params{ParentPerm: 0700}, &MountOverlayOp{ | ||||
| @ -208,12 +208,12 @@ func TestMountOverlayOp(t *testing.T) { | ||||
| 			Upper:  MustAbs("/mnt-root/nix/.rw-store/upper"), | ||||
| 			Work:   MustAbs("/mnt-root/nix/.rw-store/work"), | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/upper"}, "/mnt-root/nix/.rw-store/.upper", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/work"}, "/mnt-root/nix/.rw-store/.work", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store"}, "/mnt-root/nix/ro-store", nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/upper"}, "/mnt-root/nix/.rw-store/.upper", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/work"}, "/mnt-root/nix/.rw-store/.work", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store"}, "/mnt-root/nix/ro-store", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/nix/store", os.FileMode(0700)}, nil, nil}, | ||||
| 			{"mount", stub.ExpectArgs{"overlay", "/sysroot/nix/store", "overlay", uintptr(0), "upperdir=/host/mnt-root/nix/.rw-store/.upper,workdir=/host/mnt-root/nix/.rw-store/.work,lowerdir=/host/mnt-root/nix/ro-store,userxattr"}, nil, stub.UniqueError(0)}, | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/nix/store", os.FileMode(0700)}, nil, nil), | ||||
| 			call("mount", stub.ExpectArgs{"overlay", "/sysroot/nix/store", "overlay", uintptr(0), "upperdir=/host/mnt-root/nix/.rw-store/.upper,workdir=/host/mnt-root/nix/.rw-store/.work,lowerdir=/host/mnt-root/nix/ro-store,userxattr"}, nil, stub.UniqueError(0)), | ||||
| 		}, stub.UniqueError(0)}, | ||||
| 
 | ||||
| 		{"success single layer", &Params{ParentPerm: 0700}, &MountOverlayOp{ | ||||
| @ -222,16 +222,16 @@ func TestMountOverlayOp(t *testing.T) { | ||||
| 			Upper:  MustAbs("/mnt-root/nix/.rw-store/upper"), | ||||
| 			Work:   MustAbs("/mnt-root/nix/.rw-store/work"), | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/upper"}, "/mnt-root/nix/.rw-store/.upper", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/work"}, "/mnt-root/nix/.rw-store/.work", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store"}, "/mnt-root/nix/ro-store", nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/upper"}, "/mnt-root/nix/.rw-store/.upper", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/work"}, "/mnt-root/nix/.rw-store/.work", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store"}, "/mnt-root/nix/ro-store", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/nix/store", os.FileMode(0700)}, nil, nil}, | ||||
| 			{"mount", stub.ExpectArgs{"overlay", "/sysroot/nix/store", "overlay", uintptr(0), "" + | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/nix/store", os.FileMode(0700)}, nil, nil), | ||||
| 			call("mount", stub.ExpectArgs{"overlay", "/sysroot/nix/store", "overlay", uintptr(0), "" + | ||||
| 				"upperdir=/host/mnt-root/nix/.rw-store/.upper," + | ||||
| 				"workdir=/host/mnt-root/nix/.rw-store/.work," + | ||||
| 				"lowerdir=/host/mnt-root/nix/ro-store," + | ||||
| 				"userxattr"}, nil, nil}, | ||||
| 				"userxattr"}, nil, nil), | ||||
| 		}, nil}, | ||||
| 
 | ||||
| 		{"success", &Params{ParentPerm: 0700}, &MountOverlayOp{ | ||||
| @ -246,16 +246,16 @@ func TestMountOverlayOp(t *testing.T) { | ||||
| 			Upper: MustAbs("/mnt-root/nix/.rw-store/upper"), | ||||
| 			Work:  MustAbs("/mnt-root/nix/.rw-store/work"), | ||||
| 		}, []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/upper"}, "/mnt-root/nix/.rw-store/.upper", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/work"}, "/mnt-root/nix/.rw-store/.work", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store"}, "/mnt-root/nix/ro-store", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store0"}, "/mnt-root/nix/ro-store0", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store1"}, "/mnt-root/nix/ro-store1", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store2"}, "/mnt-root/nix/ro-store2", nil}, | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store3"}, "/mnt-root/nix/ro-store3", nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/upper"}, "/mnt-root/nix/.rw-store/.upper", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.rw-store/work"}, "/mnt-root/nix/.rw-store/.work", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store"}, "/mnt-root/nix/ro-store", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store0"}, "/mnt-root/nix/ro-store0", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store1"}, "/mnt-root/nix/ro-store1", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store2"}, "/mnt-root/nix/ro-store2", nil), | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/mnt-root/nix/.ro-store3"}, "/mnt-root/nix/ro-store3", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/nix/store", os.FileMode(0700)}, nil, nil}, | ||||
| 			{"mount", stub.ExpectArgs{"overlay", "/sysroot/nix/store", "overlay", uintptr(0), "" + | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/nix/store", os.FileMode(0700)}, nil, nil), | ||||
| 			call("mount", stub.ExpectArgs{"overlay", "/sysroot/nix/store", "overlay", uintptr(0), "" + | ||||
| 				"upperdir=/host/mnt-root/nix/.rw-store/.upper," + | ||||
| 				"workdir=/host/mnt-root/nix/.rw-store/.work," + | ||||
| 				"lowerdir=" + | ||||
| @ -264,7 +264,7 @@ func TestMountOverlayOp(t *testing.T) { | ||||
| 				"/host/mnt-root/nix/ro-store1:" + | ||||
| 				"/host/mnt-root/nix/ro-store2:" + | ||||
| 				"/host/mnt-root/nix/ro-store3," + | ||||
| 				"userxattr"}, nil, nil}, | ||||
| 				"userxattr"}, nil, nil), | ||||
| 		}, nil}, | ||||
| 	}) | ||||
| 
 | ||||
|  | ||||
| @ -19,58 +19,58 @@ func TestTmpfileOp(t *testing.T) { | ||||
| 			Path: samplePath, | ||||
| 			Data: sampleData, | ||||
| 		}, nil, nil, []stub.Call{ | ||||
| 			{"createTemp", stub.ExpectArgs{"/", "tmp.*"}, newCheckedFile(t, "tmp.32768", sampleDataString, nil), stub.UniqueError(5)}, | ||||
| 			call("createTemp", stub.ExpectArgs{"/", "tmp.*"}, newCheckedFile(t, "tmp.32768", sampleDataString, nil), stub.UniqueError(5)), | ||||
| 		}, stub.UniqueError(5)}, | ||||
| 
 | ||||
| 		{"Write", &Params{ParentPerm: 0700}, &TmpfileOp{ | ||||
| 			Path: samplePath, | ||||
| 			Data: sampleData, | ||||
| 		}, nil, nil, []stub.Call{ | ||||
| 			{"createTemp", stub.ExpectArgs{"/", "tmp.*"}, writeErrOsFile{stub.UniqueError(4)}, nil}, | ||||
| 			call("createTemp", stub.ExpectArgs{"/", "tmp.*"}, writeErrOsFile{stub.UniqueError(4)}, nil), | ||||
| 		}, stub.UniqueError(4)}, | ||||
| 
 | ||||
| 		{"Close", &Params{ParentPerm: 0700}, &TmpfileOp{ | ||||
| 			Path: samplePath, | ||||
| 			Data: sampleData, | ||||
| 		}, nil, nil, []stub.Call{ | ||||
| 			{"createTemp", stub.ExpectArgs{"/", "tmp.*"}, newCheckedFile(t, "tmp.32768", sampleDataString, stub.UniqueError(3)), nil}, | ||||
| 			call("createTemp", stub.ExpectArgs{"/", "tmp.*"}, newCheckedFile(t, "tmp.32768", sampleDataString, stub.UniqueError(3)), nil), | ||||
| 		}, stub.UniqueError(3)}, | ||||
| 
 | ||||
| 		{"ensureFile", &Params{ParentPerm: 0700}, &TmpfileOp{ | ||||
| 			Path: samplePath, | ||||
| 			Data: sampleData, | ||||
| 		}, nil, nil, []stub.Call{ | ||||
| 			{"createTemp", stub.ExpectArgs{"/", "tmp.*"}, newCheckedFile(t, "tmp.32768", sampleDataString, nil), nil}, | ||||
| 			{"ensureFile", stub.ExpectArgs{"/sysroot/etc/passwd", os.FileMode(0444), os.FileMode(0700)}, nil, stub.UniqueError(2)}, | ||||
| 			call("createTemp", stub.ExpectArgs{"/", "tmp.*"}, newCheckedFile(t, "tmp.32768", sampleDataString, nil), nil), | ||||
| 			call("ensureFile", stub.ExpectArgs{"/sysroot/etc/passwd", os.FileMode(0444), os.FileMode(0700)}, nil, stub.UniqueError(2)), | ||||
| 		}, stub.UniqueError(2)}, | ||||
| 
 | ||||
| 		{"bindMount", &Params{ParentPerm: 0700}, &TmpfileOp{ | ||||
| 			Path: samplePath, | ||||
| 			Data: sampleData, | ||||
| 		}, nil, nil, []stub.Call{ | ||||
| 			{"createTemp", stub.ExpectArgs{"/", "tmp.*"}, newCheckedFile(t, "tmp.32768", sampleDataString, nil), nil}, | ||||
| 			{"ensureFile", stub.ExpectArgs{"/sysroot/etc/passwd", os.FileMode(0444), os.FileMode(0700)}, nil, nil}, | ||||
| 			{"bindMount", stub.ExpectArgs{"tmp.32768", "/sysroot/etc/passwd", uintptr(0x5), false}, nil, stub.UniqueError(1)}, | ||||
| 			call("createTemp", stub.ExpectArgs{"/", "tmp.*"}, newCheckedFile(t, "tmp.32768", sampleDataString, nil), nil), | ||||
| 			call("ensureFile", stub.ExpectArgs{"/sysroot/etc/passwd", os.FileMode(0444), os.FileMode(0700)}, nil, nil), | ||||
| 			call("bindMount", stub.ExpectArgs{"tmp.32768", "/sysroot/etc/passwd", uintptr(0x5), false}, nil, stub.UniqueError(1)), | ||||
| 		}, stub.UniqueError(1)}, | ||||
| 
 | ||||
| 		{"remove", &Params{ParentPerm: 0700}, &TmpfileOp{ | ||||
| 			Path: samplePath, | ||||
| 			Data: sampleData, | ||||
| 		}, nil, nil, []stub.Call{ | ||||
| 			{"createTemp", stub.ExpectArgs{"/", "tmp.*"}, newCheckedFile(t, "tmp.32768", sampleDataString, nil), nil}, | ||||
| 			{"ensureFile", stub.ExpectArgs{"/sysroot/etc/passwd", os.FileMode(0444), os.FileMode(0700)}, nil, nil}, | ||||
| 			{"bindMount", stub.ExpectArgs{"tmp.32768", "/sysroot/etc/passwd", uintptr(0x5), false}, nil, nil}, | ||||
| 			{"remove", stub.ExpectArgs{"tmp.32768"}, nil, stub.UniqueError(0)}, | ||||
| 			call("createTemp", stub.ExpectArgs{"/", "tmp.*"}, newCheckedFile(t, "tmp.32768", sampleDataString, nil), nil), | ||||
| 			call("ensureFile", stub.ExpectArgs{"/sysroot/etc/passwd", os.FileMode(0444), os.FileMode(0700)}, nil, nil), | ||||
| 			call("bindMount", stub.ExpectArgs{"tmp.32768", "/sysroot/etc/passwd", uintptr(0x5), false}, nil, nil), | ||||
| 			call("remove", stub.ExpectArgs{"tmp.32768"}, nil, stub.UniqueError(0)), | ||||
| 		}, stub.UniqueError(0)}, | ||||
| 
 | ||||
| 		{"success", &Params{ParentPerm: 0700}, &TmpfileOp{ | ||||
| 			Path: samplePath, | ||||
| 			Data: sampleData, | ||||
| 		}, nil, nil, []stub.Call{ | ||||
| 			{"createTemp", stub.ExpectArgs{"/", "tmp.*"}, newCheckedFile(t, "tmp.32768", sampleDataString, nil), nil}, | ||||
| 			{"ensureFile", stub.ExpectArgs{"/sysroot/etc/passwd", os.FileMode(0444), os.FileMode(0700)}, nil, nil}, | ||||
| 			{"bindMount", stub.ExpectArgs{"tmp.32768", "/sysroot/etc/passwd", uintptr(0x5), false}, nil, nil}, | ||||
| 			{"remove", stub.ExpectArgs{"tmp.32768"}, nil, nil}, | ||||
| 			call("createTemp", stub.ExpectArgs{"/", "tmp.*"}, newCheckedFile(t, "tmp.32768", sampleDataString, nil), nil), | ||||
| 			call("ensureFile", stub.ExpectArgs{"/sysroot/etc/passwd", os.FileMode(0444), os.FileMode(0700)}, nil, nil), | ||||
| 			call("bindMount", stub.ExpectArgs{"tmp.32768", "/sysroot/etc/passwd", uintptr(0x5), false}, nil, nil), | ||||
| 			call("remove", stub.ExpectArgs{"tmp.32768"}, nil, nil), | ||||
| 		}, nil}, | ||||
| 	}) | ||||
| 
 | ||||
|  | ||||
| @ -13,15 +13,15 @@ func TestMountProcOp(t *testing.T) { | ||||
| 			&MountProcOp{ | ||||
| 				Target: MustAbs("/proc/"), | ||||
| 			}, nil, nil, []stub.Call{ | ||||
| 				{"mkdirAll", stub.ExpectArgs{"/sysroot/proc", os.FileMode(0755)}, nil, stub.UniqueError(0)}, | ||||
| 				call("mkdirAll", stub.ExpectArgs{"/sysroot/proc", os.FileMode(0755)}, nil, stub.UniqueError(0)), | ||||
| 			}, stub.UniqueError(0)}, | ||||
| 
 | ||||
| 		{"success", &Params{ParentPerm: 0700}, | ||||
| 			&MountProcOp{ | ||||
| 				Target: MustAbs("/proc/"), | ||||
| 			}, nil, nil, []stub.Call{ | ||||
| 				{"mkdirAll", stub.ExpectArgs{"/sysroot/proc", os.FileMode(0700)}, nil, nil}, | ||||
| 				{"mount", stub.ExpectArgs{"proc", "/sysroot/proc", "proc", uintptr(0xe), ""}, nil, nil}, | ||||
| 				call("mkdirAll", stub.ExpectArgs{"/sysroot/proc", os.FileMode(0700)}, nil, nil), | ||||
| 				call("mount", stub.ExpectArgs{"proc", "/sysroot/proc", "proc", uintptr(0xe), ""}, nil, nil), | ||||
| 			}, nil}, | ||||
| 	}) | ||||
| 
 | ||||
|  | ||||
| @ -13,7 +13,7 @@ func TestRemountOp(t *testing.T) { | ||||
| 			Target: MustAbs("/"), | ||||
| 			Flags:  syscall.MS_RDONLY, | ||||
| 		}, nil, nil, []stub.Call{ | ||||
| 			{"remount", stub.ExpectArgs{"/sysroot", uintptr(1)}, nil, nil}, | ||||
| 			call("remount", stub.ExpectArgs{"/sysroot", uintptr(1)}, nil, nil), | ||||
| 		}, nil}, | ||||
| 	}) | ||||
| 
 | ||||
|  | ||||
| @ -13,7 +13,7 @@ func TestSymlinkOp(t *testing.T) { | ||||
| 			Target:   MustAbs("/etc/nixos"), | ||||
| 			LinkName: "/etc/static/nixos", | ||||
| 		}, nil, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/etc", os.FileMode(0700)}, nil, stub.UniqueError(1)}, | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/etc", os.FileMode(0700)}, nil, stub.UniqueError(1)), | ||||
| 		}, stub.UniqueError(1)}, | ||||
| 
 | ||||
| 		{"abs", &Params{ParentPerm: 0755}, &SymlinkOp{ | ||||
| @ -27,15 +27,15 @@ func TestSymlinkOp(t *testing.T) { | ||||
| 			LinkName:    "/etc/mtab", | ||||
| 			Dereference: true, | ||||
| 		}, []stub.Call{ | ||||
| 			{"readlink", stub.ExpectArgs{"/etc/mtab"}, "/proc/mounts", stub.UniqueError(0)}, | ||||
| 			call("readlink", stub.ExpectArgs{"/etc/mtab"}, "/proc/mounts", stub.UniqueError(0)), | ||||
| 		}, stub.UniqueError(0), nil, nil}, | ||||
| 
 | ||||
| 		{"success noderef", &Params{ParentPerm: 0700}, &SymlinkOp{ | ||||
| 			Target:   MustAbs("/etc/nixos"), | ||||
| 			LinkName: "/etc/static/nixos", | ||||
| 		}, nil, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/etc", os.FileMode(0700)}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{"/etc/static/nixos", "/sysroot/etc/nixos"}, nil, nil}, | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/etc", os.FileMode(0700)}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{"/etc/static/nixos", "/sysroot/etc/nixos"}, nil, nil), | ||||
| 		}, nil}, | ||||
| 
 | ||||
| 		{"success", &Params{ParentPerm: 0755}, &SymlinkOp{ | ||||
| @ -43,10 +43,10 @@ func TestSymlinkOp(t *testing.T) { | ||||
| 			LinkName:    "/etc/mtab", | ||||
| 			Dereference: true, | ||||
| 		}, []stub.Call{ | ||||
| 			{"readlink", stub.ExpectArgs{"/etc/mtab"}, "/proc/mounts", nil}, | ||||
| 			call("readlink", stub.ExpectArgs{"/etc/mtab"}, "/proc/mounts", nil), | ||||
| 		}, nil, []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/etc", os.FileMode(0755)}, nil, nil}, | ||||
| 			{"symlink", stub.ExpectArgs{"/proc/mounts", "/sysroot/etc/mtab"}, nil, nil}, | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/etc", os.FileMode(0755)}, nil, nil), | ||||
| 			call("symlink", stub.ExpectArgs{"/proc/mounts", "/sysroot/etc/mtab"}, nil, nil), | ||||
| 		}, nil}, | ||||
| 	}) | ||||
| 
 | ||||
|  | ||||
| @ -28,13 +28,13 @@ func TestMountTmpfsOp(t *testing.T) { | ||||
| 			Size:   1 << 10, | ||||
| 			Perm:   0700, | ||||
| 		}, nil, nil, []stub.Call{ | ||||
| 			{"mountTmpfs", stub.ExpectArgs{ | ||||
| 			call("mountTmpfs", stub.ExpectArgs{ | ||||
| 				"ephemeral",              // fsname | ||||
| 				"/sysroot/run/user/1000", // target | ||||
| 				uintptr(0),               // flags | ||||
| 				0x400,                    // size | ||||
| 				os.FileMode(0700),        // perm | ||||
| 			}, nil, nil}, | ||||
| 			}, nil, nil), | ||||
| 		}, nil}, | ||||
| 	}) | ||||
| 
 | ||||
|  | ||||
| @ -14,24 +14,24 @@ func TestBindMount(t *testing.T) { | ||||
| 		{"mount", func(k syscallDispatcher) error { | ||||
| 			return newProcPaths(k, hostPath).bindMount("/host/nix", "/sysroot/nix", syscall.MS_RDONLY, true) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"verbosef", stub.ExpectArgs{"resolved %q flags %#x", []any{"/sysroot/nix", uintptr(1)}}, nil, nil}, | ||||
| 			{"mount", stub.ExpectArgs{"/host/nix", "/sysroot/nix", "", uintptr(0x9000), ""}, nil, stub.UniqueError(0xbad)}, | ||||
| 			call("verbosef", stub.ExpectArgs{"resolved %q flags %#x", []any{"/sysroot/nix", uintptr(1)}}, nil, nil), | ||||
| 			call("mount", stub.ExpectArgs{"/host/nix", "/sysroot/nix", "", uintptr(0x9000), ""}, nil, stub.UniqueError(0xbad)), | ||||
| 		}}, stub.UniqueError(0xbad)}, | ||||
| 
 | ||||
| 		{"success ne", func(k syscallDispatcher) error { | ||||
| 			return newProcPaths(k, hostPath).bindMount("/host/nix", "/sysroot/.host-nix", syscall.MS_RDONLY, false) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"verbosef", stub.ExpectArgs{"resolved %q on %q flags %#x", []any{"/host/nix", "/sysroot/.host-nix", uintptr(1)}}, nil, nil}, | ||||
| 			{"mount", stub.ExpectArgs{"/host/nix", "/sysroot/.host-nix", "", uintptr(0x9000), ""}, nil, nil}, | ||||
| 			{"remount", stub.ExpectArgs{"/sysroot/.host-nix", uintptr(1)}, nil, nil}, | ||||
| 			call("verbosef", stub.ExpectArgs{"resolved %q on %q flags %#x", []any{"/host/nix", "/sysroot/.host-nix", uintptr(1)}}, nil, nil), | ||||
| 			call("mount", stub.ExpectArgs{"/host/nix", "/sysroot/.host-nix", "", uintptr(0x9000), ""}, nil, nil), | ||||
| 			call("remount", stub.ExpectArgs{"/sysroot/.host-nix", uintptr(1)}, nil, nil), | ||||
| 		}}, nil}, | ||||
| 
 | ||||
| 		{"success", func(k syscallDispatcher) error { | ||||
| 			return newProcPaths(k, hostPath).bindMount("/host/nix", "/sysroot/nix", syscall.MS_RDONLY, true) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"verbosef", stub.ExpectArgs{"resolved %q flags %#x", []any{"/sysroot/nix", uintptr(1)}}, nil, nil}, | ||||
| 			{"mount", stub.ExpectArgs{"/host/nix", "/sysroot/nix", "", uintptr(0x9000), ""}, nil, nil}, | ||||
| 			{"remount", stub.ExpectArgs{"/sysroot/nix", uintptr(1)}, nil, nil}, | ||||
| 			call("verbosef", stub.ExpectArgs{"resolved %q flags %#x", []any{"/sysroot/nix", uintptr(1)}}, nil, nil), | ||||
| 			call("mount", stub.ExpectArgs{"/host/nix", "/sysroot/nix", "", uintptr(0x9000), ""}, nil, nil), | ||||
| 			call("remount", stub.ExpectArgs{"/sysroot/nix", uintptr(1)}, nil, nil), | ||||
| 		}}, nil}, | ||||
| 	}) | ||||
| } | ||||
| @ -83,137 +83,137 @@ func TestRemount(t *testing.T) { | ||||
| 		{"evalSymlinks", func(k syscallDispatcher) error { | ||||
| 			return newProcPaths(k, hostPath).remount("/sysroot/nix", syscall.MS_REC|syscall.MS_RDONLY|syscall.MS_NODEV) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/nix", stub.UniqueError(6)}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/nix", stub.UniqueError(6)), | ||||
| 		}}, stub.UniqueError(6)}, | ||||
| 
 | ||||
| 		{"open", func(k syscallDispatcher) error { | ||||
| 			return newProcPaths(k, hostPath).remount("/sysroot/nix", syscall.MS_REC|syscall.MS_RDONLY|syscall.MS_NODEV) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/nix", nil}, | ||||
| 			{"open", stub.ExpectArgs{"/sysroot/nix", 0x280000, uint32(0)}, 0xdeadbeef, stub.UniqueError(5)}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/nix", nil), | ||||
| 			call("open", stub.ExpectArgs{"/sysroot/nix", 0x280000, uint32(0)}, 0xdeadbeef, stub.UniqueError(5)), | ||||
| 		}}, &os.PathError{Op: "open", Path: "/sysroot/nix", Err: stub.UniqueError(5)}}, | ||||
| 
 | ||||
| 		{"readlink", func(k syscallDispatcher) error { | ||||
| 			return newProcPaths(k, hostPath).remount("/sysroot/nix", syscall.MS_REC|syscall.MS_RDONLY|syscall.MS_NODEV) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/nix", nil}, | ||||
| 			{"open", stub.ExpectArgs{"/sysroot/nix", 0x280000, uint32(0)}, 0xdeadbeef, nil}, | ||||
| 			{"readlink", stub.ExpectArgs{"/host/proc/self/fd/3735928559"}, "/sysroot/nix", stub.UniqueError(4)}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/nix", nil), | ||||
| 			call("open", stub.ExpectArgs{"/sysroot/nix", 0x280000, uint32(0)}, 0xdeadbeef, nil), | ||||
| 			call("readlink", stub.ExpectArgs{"/host/proc/self/fd/3735928559"}, "/sysroot/nix", stub.UniqueError(4)), | ||||
| 		}}, stub.UniqueError(4)}, | ||||
| 
 | ||||
| 		{"close", func(k syscallDispatcher) error { | ||||
| 			return newProcPaths(k, hostPath).remount("/sysroot/nix", syscall.MS_REC|syscall.MS_RDONLY|syscall.MS_NODEV) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/nix", nil}, | ||||
| 			{"open", stub.ExpectArgs{"/sysroot/nix", 0x280000, uint32(0)}, 0xdeadbeef, nil}, | ||||
| 			{"readlink", stub.ExpectArgs{"/host/proc/self/fd/3735928559"}, "/sysroot/nix", nil}, | ||||
| 			{"close", stub.ExpectArgs{0xdeadbeef}, nil, stub.UniqueError(3)}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/nix", nil), | ||||
| 			call("open", stub.ExpectArgs{"/sysroot/nix", 0x280000, uint32(0)}, 0xdeadbeef, nil), | ||||
| 			call("readlink", stub.ExpectArgs{"/host/proc/self/fd/3735928559"}, "/sysroot/nix", nil), | ||||
| 			call("close", stub.ExpectArgs{0xdeadbeef}, nil, stub.UniqueError(3)), | ||||
| 		}}, &os.PathError{Op: "close", Path: "/sysroot/nix", Err: stub.UniqueError(3)}}, | ||||
| 
 | ||||
| 		{"mountinfo no match", func(k syscallDispatcher) error { | ||||
| 			return newProcPaths(k, hostPath).remount("/sysroot/nix", syscall.MS_REC|syscall.MS_RDONLY|syscall.MS_NODEV) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/.hakurei", nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"target resolves to %q", []any{"/sysroot/.hakurei"}}, nil, nil}, | ||||
| 			{"open", stub.ExpectArgs{"/sysroot/.hakurei", 0x280000, uint32(0)}, 0xdeadbeef, nil}, | ||||
| 			{"readlink", stub.ExpectArgs{"/host/proc/self/fd/3735928559"}, "/sysroot/.hakurei", nil}, | ||||
| 			{"close", stub.ExpectArgs{0xdeadbeef}, nil, nil}, | ||||
| 			{"openNew", stub.ExpectArgs{"/host/proc/self/mountinfo"}, newConstFile(sampleMountinfoNix), nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/.hakurei", nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"target resolves to %q", []any{"/sysroot/.hakurei"}}, nil, nil), | ||||
| 			call("open", stub.ExpectArgs{"/sysroot/.hakurei", 0x280000, uint32(0)}, 0xdeadbeef, nil), | ||||
| 			call("readlink", stub.ExpectArgs{"/host/proc/self/fd/3735928559"}, "/sysroot/.hakurei", nil), | ||||
| 			call("close", stub.ExpectArgs{0xdeadbeef}, nil, nil), | ||||
| 			call("openNew", stub.ExpectArgs{"/host/proc/self/mountinfo"}, newConstFile(sampleMountinfoNix), nil), | ||||
| 		}}, &vfs.DecoderError{Op: "unfold", Line: -1, Err: vfs.UnfoldTargetError("/sysroot/.hakurei")}}, | ||||
| 
 | ||||
| 		{"mountinfo", func(k syscallDispatcher) error { | ||||
| 			return newProcPaths(k, hostPath).remount("/sysroot/nix", syscall.MS_REC|syscall.MS_RDONLY|syscall.MS_NODEV) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/nix", nil}, | ||||
| 			{"open", stub.ExpectArgs{"/sysroot/nix", 0x280000, uint32(0)}, 0xdeadbeef, nil}, | ||||
| 			{"readlink", stub.ExpectArgs{"/host/proc/self/fd/3735928559"}, "/sysroot/nix", nil}, | ||||
| 			{"close", stub.ExpectArgs{0xdeadbeef}, nil, nil}, | ||||
| 			{"openNew", stub.ExpectArgs{"/host/proc/self/mountinfo"}, newConstFile("\x00"), nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/nix", nil), | ||||
| 			call("open", stub.ExpectArgs{"/sysroot/nix", 0x280000, uint32(0)}, 0xdeadbeef, nil), | ||||
| 			call("readlink", stub.ExpectArgs{"/host/proc/self/fd/3735928559"}, "/sysroot/nix", nil), | ||||
| 			call("close", stub.ExpectArgs{0xdeadbeef}, nil, nil), | ||||
| 			call("openNew", stub.ExpectArgs{"/host/proc/self/mountinfo"}, newConstFile("\x00"), nil), | ||||
| 		}}, &vfs.DecoderError{Op: "parse", Line: 0, Err: vfs.ErrMountInfoFields}}, | ||||
| 
 | ||||
| 		{"mount", func(k syscallDispatcher) error { | ||||
| 			return newProcPaths(k, hostPath).remount("/sysroot/nix", syscall.MS_REC|syscall.MS_RDONLY|syscall.MS_NODEV) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/nix", nil}, | ||||
| 			{"open", stub.ExpectArgs{"/sysroot/nix", 0x280000, uint32(0)}, 0xdeadbeef, nil}, | ||||
| 			{"readlink", stub.ExpectArgs{"/host/proc/self/fd/3735928559"}, "/sysroot/nix", nil}, | ||||
| 			{"close", stub.ExpectArgs{0xdeadbeef}, nil, nil}, | ||||
| 			{"openNew", stub.ExpectArgs{"/host/proc/self/mountinfo"}, newConstFile(sampleMountinfoNix), nil}, | ||||
| 			{"mount", stub.ExpectArgs{"none", "/sysroot/nix", "", uintptr(0x209027), ""}, nil, stub.UniqueError(2)}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/nix", nil), | ||||
| 			call("open", stub.ExpectArgs{"/sysroot/nix", 0x280000, uint32(0)}, 0xdeadbeef, nil), | ||||
| 			call("readlink", stub.ExpectArgs{"/host/proc/self/fd/3735928559"}, "/sysroot/nix", nil), | ||||
| 			call("close", stub.ExpectArgs{0xdeadbeef}, nil, nil), | ||||
| 			call("openNew", stub.ExpectArgs{"/host/proc/self/mountinfo"}, newConstFile(sampleMountinfoNix), nil), | ||||
| 			call("mount", stub.ExpectArgs{"none", "/sysroot/nix", "", uintptr(0x209027), ""}, nil, stub.UniqueError(2)), | ||||
| 		}}, stub.UniqueError(2)}, | ||||
| 
 | ||||
| 		{"mount propagate", func(k syscallDispatcher) error { | ||||
| 			return newProcPaths(k, hostPath).remount("/sysroot/nix", syscall.MS_REC|syscall.MS_RDONLY|syscall.MS_NODEV) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/nix", nil}, | ||||
| 			{"open", stub.ExpectArgs{"/sysroot/nix", 0x280000, uint32(0)}, 0xdeadbeef, nil}, | ||||
| 			{"readlink", stub.ExpectArgs{"/host/proc/self/fd/3735928559"}, "/sysroot/nix", nil}, | ||||
| 			{"close", stub.ExpectArgs{0xdeadbeef}, nil, nil}, | ||||
| 			{"openNew", stub.ExpectArgs{"/host/proc/self/mountinfo"}, newConstFile(sampleMountinfoNix), nil}, | ||||
| 			{"mount", stub.ExpectArgs{"none", "/sysroot/nix", "", uintptr(0x209027), ""}, nil, nil}, | ||||
| 			{"mount", stub.ExpectArgs{"none", "/sysroot/nix/.ro-store", "", uintptr(0x209027), ""}, nil, stub.UniqueError(1)}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/nix", nil), | ||||
| 			call("open", stub.ExpectArgs{"/sysroot/nix", 0x280000, uint32(0)}, 0xdeadbeef, nil), | ||||
| 			call("readlink", stub.ExpectArgs{"/host/proc/self/fd/3735928559"}, "/sysroot/nix", nil), | ||||
| 			call("close", stub.ExpectArgs{0xdeadbeef}, nil, nil), | ||||
| 			call("openNew", stub.ExpectArgs{"/host/proc/self/mountinfo"}, newConstFile(sampleMountinfoNix), nil), | ||||
| 			call("mount", stub.ExpectArgs{"none", "/sysroot/nix", "", uintptr(0x209027), ""}, nil, nil), | ||||
| 			call("mount", stub.ExpectArgs{"none", "/sysroot/nix/.ro-store", "", uintptr(0x209027), ""}, nil, stub.UniqueError(1)), | ||||
| 		}}, stub.UniqueError(1)}, | ||||
| 
 | ||||
| 		{"success toplevel", func(k syscallDispatcher) error { | ||||
| 			return newProcPaths(k, hostPath).remount("/sysroot/bin", syscall.MS_REC|syscall.MS_RDONLY|syscall.MS_NODEV) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/sysroot/bin"}, "/sysroot/bin", nil}, | ||||
| 			{"open", stub.ExpectArgs{"/sysroot/bin", 0x280000, uint32(0)}, 0xbabe, nil}, | ||||
| 			{"readlink", stub.ExpectArgs{"/host/proc/self/fd/47806"}, "/sysroot/bin", nil}, | ||||
| 			{"close", stub.ExpectArgs{0xbabe}, nil, nil}, | ||||
| 			{"openNew", stub.ExpectArgs{"/host/proc/self/mountinfo"}, newConstFile(sampleMountinfoNix), nil}, | ||||
| 			{"mount", stub.ExpectArgs{"none", "/sysroot/bin", "", uintptr(0x209027), ""}, nil, nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/sysroot/bin"}, "/sysroot/bin", nil), | ||||
| 			call("open", stub.ExpectArgs{"/sysroot/bin", 0x280000, uint32(0)}, 0xbabe, nil), | ||||
| 			call("readlink", stub.ExpectArgs{"/host/proc/self/fd/47806"}, "/sysroot/bin", nil), | ||||
| 			call("close", stub.ExpectArgs{0xbabe}, nil, nil), | ||||
| 			call("openNew", stub.ExpectArgs{"/host/proc/self/mountinfo"}, newConstFile(sampleMountinfoNix), nil), | ||||
| 			call("mount", stub.ExpectArgs{"none", "/sysroot/bin", "", uintptr(0x209027), ""}, nil, nil), | ||||
| 		}}, nil}, | ||||
| 
 | ||||
| 		{"success EACCES", func(k syscallDispatcher) error { | ||||
| 			return newProcPaths(k, hostPath).remount("/sysroot/nix", syscall.MS_REC|syscall.MS_RDONLY|syscall.MS_NODEV) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/nix", nil}, | ||||
| 			{"open", stub.ExpectArgs{"/sysroot/nix", 0x280000, uint32(0)}, 0xdeadbeef, nil}, | ||||
| 			{"readlink", stub.ExpectArgs{"/host/proc/self/fd/3735928559"}, "/sysroot/nix", nil}, | ||||
| 			{"close", stub.ExpectArgs{0xdeadbeef}, nil, nil}, | ||||
| 			{"openNew", stub.ExpectArgs{"/host/proc/self/mountinfo"}, newConstFile(sampleMountinfoNix), nil}, | ||||
| 			{"mount", stub.ExpectArgs{"none", "/sysroot/nix", "", uintptr(0x209027), ""}, nil, nil}, | ||||
| 			{"mount", stub.ExpectArgs{"none", "/sysroot/nix/.ro-store", "", uintptr(0x209027), ""}, nil, syscall.EACCES}, | ||||
| 			{"mount", stub.ExpectArgs{"none", "/sysroot/nix/store", "", uintptr(0x209027), ""}, nil, nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/nix", nil), | ||||
| 			call("open", stub.ExpectArgs{"/sysroot/nix", 0x280000, uint32(0)}, 0xdeadbeef, nil), | ||||
| 			call("readlink", stub.ExpectArgs{"/host/proc/self/fd/3735928559"}, "/sysroot/nix", nil), | ||||
| 			call("close", stub.ExpectArgs{0xdeadbeef}, nil, nil), | ||||
| 			call("openNew", stub.ExpectArgs{"/host/proc/self/mountinfo"}, newConstFile(sampleMountinfoNix), nil), | ||||
| 			call("mount", stub.ExpectArgs{"none", "/sysroot/nix", "", uintptr(0x209027), ""}, nil, nil), | ||||
| 			call("mount", stub.ExpectArgs{"none", "/sysroot/nix/.ro-store", "", uintptr(0x209027), ""}, nil, syscall.EACCES), | ||||
| 			call("mount", stub.ExpectArgs{"none", "/sysroot/nix/store", "", uintptr(0x209027), ""}, nil, nil), | ||||
| 		}}, nil}, | ||||
| 
 | ||||
| 		{"success no propagate", func(k syscallDispatcher) error { | ||||
| 			return newProcPaths(k, hostPath).remount("/sysroot/nix", syscall.MS_RDONLY|syscall.MS_NODEV) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/nix", nil}, | ||||
| 			{"open", stub.ExpectArgs{"/sysroot/nix", 0x280000, uint32(0)}, 0xdeadbeef, nil}, | ||||
| 			{"readlink", stub.ExpectArgs{"/host/proc/self/fd/3735928559"}, "/sysroot/nix", nil}, | ||||
| 			{"close", stub.ExpectArgs{0xdeadbeef}, nil, nil}, | ||||
| 			{"openNew", stub.ExpectArgs{"/host/proc/self/mountinfo"}, newConstFile(sampleMountinfoNix), nil}, | ||||
| 			{"mount", stub.ExpectArgs{"none", "/sysroot/nix", "", uintptr(0x209027), ""}, nil, nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/nix", nil), | ||||
| 			call("open", stub.ExpectArgs{"/sysroot/nix", 0x280000, uint32(0)}, 0xdeadbeef, nil), | ||||
| 			call("readlink", stub.ExpectArgs{"/host/proc/self/fd/3735928559"}, "/sysroot/nix", nil), | ||||
| 			call("close", stub.ExpectArgs{0xdeadbeef}, nil, nil), | ||||
| 			call("openNew", stub.ExpectArgs{"/host/proc/self/mountinfo"}, newConstFile(sampleMountinfoNix), nil), | ||||
| 			call("mount", stub.ExpectArgs{"none", "/sysroot/nix", "", uintptr(0x209027), ""}, nil, nil), | ||||
| 		}}, nil}, | ||||
| 
 | ||||
| 		{"success case sensitive", func(k syscallDispatcher) error { | ||||
| 			return newProcPaths(k, hostPath).remount("/sysroot/nix", syscall.MS_REC|syscall.MS_RDONLY|syscall.MS_NODEV) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/nix", nil}, | ||||
| 			{"open", stub.ExpectArgs{"/sysroot/nix", 0x280000, uint32(0)}, 0xdeadbeef, nil}, | ||||
| 			{"readlink", stub.ExpectArgs{"/host/proc/self/fd/3735928559"}, "/sysroot/nix", nil}, | ||||
| 			{"close", stub.ExpectArgs{0xdeadbeef}, nil, nil}, | ||||
| 			{"openNew", stub.ExpectArgs{"/host/proc/self/mountinfo"}, newConstFile(sampleMountinfoNix), nil}, | ||||
| 			{"mount", stub.ExpectArgs{"none", "/sysroot/nix", "", uintptr(0x209027), ""}, nil, nil}, | ||||
| 			{"mount", stub.ExpectArgs{"none", "/sysroot/nix/.ro-store", "", uintptr(0x209027), ""}, nil, nil}, | ||||
| 			{"mount", stub.ExpectArgs{"none", "/sysroot/nix/store", "", uintptr(0x209027), ""}, nil, nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/sysroot/nix"}, "/sysroot/nix", nil), | ||||
| 			call("open", stub.ExpectArgs{"/sysroot/nix", 0x280000, uint32(0)}, 0xdeadbeef, nil), | ||||
| 			call("readlink", stub.ExpectArgs{"/host/proc/self/fd/3735928559"}, "/sysroot/nix", nil), | ||||
| 			call("close", stub.ExpectArgs{0xdeadbeef}, nil, nil), | ||||
| 			call("openNew", stub.ExpectArgs{"/host/proc/self/mountinfo"}, newConstFile(sampleMountinfoNix), nil), | ||||
| 			call("mount", stub.ExpectArgs{"none", "/sysroot/nix", "", uintptr(0x209027), ""}, nil, nil), | ||||
| 			call("mount", stub.ExpectArgs{"none", "/sysroot/nix/.ro-store", "", uintptr(0x209027), ""}, nil, nil), | ||||
| 			call("mount", stub.ExpectArgs{"none", "/sysroot/nix/store", "", uintptr(0x209027), ""}, nil, nil), | ||||
| 		}}, nil}, | ||||
| 
 | ||||
| 		{"success", func(k syscallDispatcher) error { | ||||
| 			return newProcPaths(k, hostPath).remount("/sysroot/.nix", syscall.MS_REC|syscall.MS_RDONLY|syscall.MS_NODEV) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"evalSymlinks", stub.ExpectArgs{"/sysroot/.nix"}, "/sysroot/NIX", nil}, | ||||
| 			{"verbosef", stub.ExpectArgs{"target resolves to %q", []any{"/sysroot/NIX"}}, nil, nil}, | ||||
| 			{"open", stub.ExpectArgs{"/sysroot/NIX", 0x280000, uint32(0)}, 0xdeadbeef, nil}, | ||||
| 			{"readlink", stub.ExpectArgs{"/host/proc/self/fd/3735928559"}, "/sysroot/nix", nil}, | ||||
| 			{"close", stub.ExpectArgs{0xdeadbeef}, nil, nil}, | ||||
| 			{"openNew", stub.ExpectArgs{"/host/proc/self/mountinfo"}, newConstFile(sampleMountinfoNix), nil}, | ||||
| 			{"mount", stub.ExpectArgs{"none", "/sysroot/nix", "", uintptr(0x209027), ""}, nil, nil}, | ||||
| 			{"mount", stub.ExpectArgs{"none", "/sysroot/nix/.ro-store", "", uintptr(0x209027), ""}, nil, nil}, | ||||
| 			{"mount", stub.ExpectArgs{"none", "/sysroot/nix/store", "", uintptr(0x209027), ""}, nil, nil}, | ||||
| 			call("evalSymlinks", stub.ExpectArgs{"/sysroot/.nix"}, "/sysroot/NIX", nil), | ||||
| 			call("verbosef", stub.ExpectArgs{"target resolves to %q", []any{"/sysroot/NIX"}}, nil, nil), | ||||
| 			call("open", stub.ExpectArgs{"/sysroot/NIX", 0x280000, uint32(0)}, 0xdeadbeef, nil), | ||||
| 			call("readlink", stub.ExpectArgs{"/host/proc/self/fd/3735928559"}, "/sysroot/nix", nil), | ||||
| 			call("close", stub.ExpectArgs{0xdeadbeef}, nil, nil), | ||||
| 			call("openNew", stub.ExpectArgs{"/host/proc/self/mountinfo"}, newConstFile(sampleMountinfoNix), nil), | ||||
| 			call("mount", stub.ExpectArgs{"none", "/sysroot/nix", "", uintptr(0x209027), ""}, nil, nil), | ||||
| 			call("mount", stub.ExpectArgs{"none", "/sysroot/nix/.ro-store", "", uintptr(0x209027), ""}, nil, nil), | ||||
| 			call("mount", stub.ExpectArgs{"none", "/sysroot/nix/store", "", uintptr(0x209027), ""}, nil, nil), | ||||
| 		}}, nil}, | ||||
| 	}) | ||||
| } | ||||
| @ -223,7 +223,7 @@ func TestRemountWithFlags(t *testing.T) { | ||||
| 		{"noop unmatched", func(k syscallDispatcher) error { | ||||
| 			return remountWithFlags(k, &vfs.MountInfoNode{MountInfoEntry: &vfs.MountInfoEntry{VfsOptstr: "rw,relatime,cat"}}, 0) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"verbosef", stub.ExpectArgs{"unmatched vfs options: %q", []any{[]string{"cat"}}}, nil, nil}, | ||||
| 			call("verbosef", stub.ExpectArgs{"unmatched vfs options: %q", []any{[]string{"cat"}}}, nil, nil), | ||||
| 		}}, nil}, | ||||
| 
 | ||||
| 		{"noop", func(k syscallDispatcher) error { | ||||
| @ -233,7 +233,7 @@ func TestRemountWithFlags(t *testing.T) { | ||||
| 		{"success", func(k syscallDispatcher) error { | ||||
| 			return remountWithFlags(k, &vfs.MountInfoNode{MountInfoEntry: &vfs.MountInfoEntry{VfsOptstr: "rw,relatime"}}, syscall.MS_RDONLY) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"mount", stub.ExpectArgs{"none", "", "", uintptr(0x209021), ""}, nil, nil}, | ||||
| 			call("mount", stub.ExpectArgs{"none", "", "", uintptr(0x209021), ""}, nil, nil), | ||||
| 		}}, nil}, | ||||
| 	}) | ||||
| } | ||||
| @ -243,21 +243,21 @@ func TestMountTmpfs(t *testing.T) { | ||||
| 		{"mkdirAll", func(k syscallDispatcher) error { | ||||
| 			return mountTmpfs(k, "ephemeral", "/sysroot/run/user/1000", 0, 1<<10, 0700) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/run/user/1000", os.FileMode(0700)}, nil, stub.UniqueError(0)}, | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/run/user/1000", os.FileMode(0700)}, nil, stub.UniqueError(0)), | ||||
| 		}}, stub.UniqueError(0)}, | ||||
| 
 | ||||
| 		{"success no size", func(k syscallDispatcher) error { | ||||
| 			return mountTmpfs(k, "ephemeral", "/sysroot/run/user/1000", 0, 0, 0710) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/run/user/1000", os.FileMode(0750)}, nil, nil}, | ||||
| 			{"mount", stub.ExpectArgs{"ephemeral", "/sysroot/run/user/1000", "tmpfs", uintptr(0), "mode=0710"}, nil, nil}, | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/run/user/1000", os.FileMode(0750)}, nil, nil), | ||||
| 			call("mount", stub.ExpectArgs{"ephemeral", "/sysroot/run/user/1000", "tmpfs", uintptr(0), "mode=0710"}, nil, nil), | ||||
| 		}}, nil}, | ||||
| 
 | ||||
| 		{"success", func(k syscallDispatcher) error { | ||||
| 			return mountTmpfs(k, "ephemeral", "/sysroot/run/user/1000", 0, 1<<10, 0700) | ||||
| 		}, stub.Expect{Calls: []stub.Call{ | ||||
| 			{"mkdirAll", stub.ExpectArgs{"/sysroot/run/user/1000", os.FileMode(0700)}, nil, nil}, | ||||
| 			{"mount", stub.ExpectArgs{"ephemeral", "/sysroot/run/user/1000", "tmpfs", uintptr(0), "mode=0700,size=1024"}, nil, nil}, | ||||
| 			call("mkdirAll", stub.ExpectArgs{"/sysroot/run/user/1000", os.FileMode(0700)}, nil, nil), | ||||
| 			call("mount", stub.ExpectArgs{"ephemeral", "/sysroot/run/user/1000", "tmpfs", uintptr(0), "mode=0700,size=1024"}, nil, nil), | ||||
| 		}}, nil}, | ||||
| 	}) | ||||
| } | ||||
|  | ||||
| @ -233,7 +233,7 @@ func (seal *Outcome) finalise(ctx context.Context, sys sys.State, config *hst.Co | ||||
| 
 | ||||
| 			Filesystem: []hst.FilesystemConfigJSON{ | ||||
| 				// autoroot, includes the home directory | ||||
| 				{&hst.FSBind{ | ||||
| 				{FilesystemConfig: &hst.FSBind{ | ||||
| 					Target:  container.AbsFHSRoot, | ||||
| 					Source:  container.AbsFHSRoot, | ||||
| 					Write:   true, | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user