From 986105958cdf2071d07b2e1fd2321884e4f09ccc Mon Sep 17 00:00:00 2001 From: Ophestra Date: Mon, 31 Mar 2025 04:54:10 +0900 Subject: [PATCH] fortify: update show output Signed-off-by: Ophestra --- print.go | 11 +++++++++-- print_test.go | 18 ++++++------------ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/print.go b/print.go index 891c576..7af1a22 100644 --- a/print.go +++ b/print.go @@ -77,7 +77,9 @@ func printShowInstance( if len(config.Confinement.Groups) > 0 { t.Printf(" Groups:\t%q\n", config.Confinement.Groups) } - t.Printf(" Directory:\t%s\n", config.Confinement.Outer) + if config.Confinement.Outer != "" { + t.Printf(" Directory:\t%s\n", config.Confinement.Outer) + } if config.Confinement.Sandbox != nil { sandbox := config.Confinement.Sandbox if sandbox.Hostname != "" { @@ -114,7 +116,12 @@ func printShowInstance( // Env map[string]string `json:"env"` // Link [][2]string `json:"symlink"` } - t.Printf(" Command:\t%s\n", strings.Join(config.Args, " ")) + if config.Confinement.Sandbox != nil { + t.Printf(" Path:\t%s\n", config.Path) + } + if len(config.Args) > 0 { + t.Printf(" Arguments:\t%s\n", strings.Join(config.Args, " ")) + } t.Printf("\n") if !short { diff --git a/print_test.go b/print_test.go index d892e55..06f67db 100644 --- a/print_test.go +++ b/print_test.go @@ -44,7 +44,8 @@ func Test_printShowInstance(t *testing.T) { Flags: userns net dev tty mapuid autoetc Etc: /etc Cover: /var/run/nscd - Command: chromium --ignore-gpu-blocklist --disable-smooth-scrolling --enable-features=UseOzonePlatform --ozone-platform=wayland + Path: /run/current-system/sw/bin/chromium + Arguments: chromium --ignore-gpu-blocklist --disable-smooth-scrolling --enable-features=UseOzonePlatform --ozone-platform=wayland Filesystem +/nix/store @@ -75,26 +76,22 @@ System bus App ID: 0 Enablements: (no enablements) - Directory: - Command: `}, {"config flag none", nil, &fst.Config{Confinement: fst.ConfinementConfig{Sandbox: new(fst.SandboxConfig)}}, false, false, `App ID: 0 Enablements: (no enablements) - Directory: Flags: none Etc: /etc - Command: + Path: `}, {"config nil entries", nil, &fst.Config{Confinement: fst.ConfinementConfig{Sandbox: &fst.SandboxConfig{Filesystem: make([]*fst.FilesystemConfig, 1)}, ExtraPerms: make([]*fst.ExtraPermConfig, 1)}}, false, false, `App ID: 0 Enablements: (no enablements) - Directory: Flags: none Etc: /etc - Command: + Path: Filesystem @@ -106,8 +103,6 @@ Extra ACL App ID: 0 Enablements: (no enablements) - Directory: - Command: Session bus Filter: false @@ -128,7 +123,8 @@ App Flags: userns net dev tty mapuid autoetc Etc: /etc Cover: /var/run/nscd - Command: chromium --ignore-gpu-blocklist --disable-smooth-scrolling --enable-features=UseOzonePlatform --ozone-platform=wayland + Path: /run/current-system/sw/bin/chromium + Arguments: chromium --ignore-gpu-blocklist --disable-smooth-scrolling --enable-features=UseOzonePlatform --ozone-platform=wayland Filesystem +/nix/store @@ -163,8 +159,6 @@ State App ID: 0 Enablements: (no enablements) - Directory: - Command: `},