aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2017-03-24 17:59:01 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2017-03-24 17:59:01 -0400
commit51400e245d453d9b45d984d323a2a5f86567480f (patch)
treebf37143a1b5652ab689559c80903282da4c47145
parenttesting (diff)
downloadfirejail-51400e245d453d9b45d984d323a2a5f86567480f.tar.gz
firejail-51400e245d453d9b45d984d323a2a5f86567480f.tar.zst
firejail-51400e245d453d9b45d984d323a2a5f86567480f.zip
testing
-rw-r--r--src/firejail/cmdline.c10
-rw-r--r--src/firejail/sandbox.c8
-rwxr-xr-xtest/appimage/appimage-args.exp10
-rwxr-xr-xtest/appimage/appimage-v1.exp10
-rwxr-xr-xtest/appimage/appimage-v2.exp11
5 files changed, 44 insertions, 5 deletions
diff --git a/src/firejail/cmdline.c b/src/firejail/cmdline.c
index 60301ed58..e62ed8d33 100644
--- a/src/firejail/cmdline.c
+++ b/src/firejail/cmdline.c
@@ -153,6 +153,9 @@ void build_cmdline(char **command_line, char **window_title, int argc, char **ar
153 errExit("malloc"); 153 errExit("malloc");
154 154
155 quote_cmdline(*command_line, *window_title, len, argc, argv, index); 155 quote_cmdline(*command_line, *window_title, len, argc, argv, index);
156
157 if (arg_debug)
158 printf("Building quoted command line: %s\n", *command_line);
156 159
157 assert(*command_line); 160 assert(*command_line);
158 assert(*window_title); 161 assert(*window_title);
@@ -163,7 +166,9 @@ void build_appimage_cmdline(char **command_line, char **window_title, int argc,
163 // the program should exit with an error before entering this function 166 // the program should exit with an error before entering this function
164 assert(index != -1); 167 assert(index != -1);
165 168
166// unsigned argcount = argc - index; 169 if (arg_debug)
170 printf("Building AppImage command line: %s\n", *command_line);
171
167 172
168 int len1 = cmdline_length(argc, argv, index); // length of argv w/o changes 173 int len1 = cmdline_length(argc, argv, index); // length of argv w/o changes
169 int len2 = cmdline_length(1, &argv[index], 0); // apptest.AppImage 174 int len2 = cmdline_length(1, &argv[index], 0); // apptest.AppImage
@@ -198,6 +203,9 @@ void build_appimage_cmdline(char **command_line, char **window_title, int argc,
198 if (asprintf(command_line, "'%s' %s", tmp1, command_line_tmp + len2) == -1) 203 if (asprintf(command_line, "'%s' %s", tmp1, command_line_tmp + len2) == -1)
199 errExit("asprintf"); 204 errExit("asprintf");
200 205
206 if (arg_debug)
207 printf("AppImage quoted command line: %s\n", *command_line);
208
201 // free strdup 209 // free strdup
202 free(tmp1); 210 free(tmp1);
203} 211}
diff --git a/src/firejail/sandbox.c b/src/firejail/sandbox.c
index d1557e8b2..f9e59f1ed 100644
--- a/src/firejail/sandbox.c
+++ b/src/firejail/sandbox.c
@@ -865,6 +865,14 @@ int sandbox(void* sandbox_arg) {
865 } 865 }
866 } 866 }
867 } 867 }
868 if (arg_debug) {
869 char *cpath = get_current_dir_name();
870 if (cpath) {
871 printf("Current directory: %s\n", cpath);
872 free(cpath);
873 }
874 }
875
868 876
869 // set nice 877 // set nice
870 if (arg_nice) { 878 if (arg_nice) {
diff --git a/test/appimage/appimage-args.exp b/test/appimage/appimage-args.exp
index f304f5b94..b93ad509d 100755
--- a/test/appimage/appimage-args.exp
+++ b/test/appimage/appimage-args.exp
@@ -7,6 +7,7 @@ set timeout 10
7spawn $env(SHELL) 7spawn $env(SHELL)
8match_max 100000 8match_max 100000
9 9
10set appimage_id $spawn_id
10send -- "firejail --name=appimage-test --debug --appimage Leafpad-0.8.17-x86_64.AppImage testfile\r" 11send -- "firejail --name=appimage-test --debug --appimage Leafpad-0.8.17-x86_64.AppImage testfile\r"
11expect { 12expect {
12 timeout {puts "TESTING ERROR 1\n";exit} 13 timeout {puts "TESTING ERROR 1\n";exit}
@@ -91,7 +92,14 @@ after 100
91 92
92spawn $env(SHELL) 93spawn $env(SHELL)
93send -- "firejail --shutdown=appimage-test\r" 94send -- "firejail --shutdown=appimage-test\r"
94sleep 3 95
96set spawn_id $appimage_id
97expect {
98 timeout {puts "TESTING ERROR 15\n";exit}
99 "AppImage unmounted"
100}
101
102after 100
95 103
96puts "\nall done\n" 104puts "\nall done\n"
97 105
diff --git a/test/appimage/appimage-v1.exp b/test/appimage/appimage-v1.exp
index d9b64af1d..3364ff677 100755
--- a/test/appimage/appimage-v1.exp
+++ b/test/appimage/appimage-v1.exp
@@ -6,6 +6,7 @@
6set timeout 10 6set timeout 10
7spawn $env(SHELL) 7spawn $env(SHELL)
8match_max 100000 8match_max 100000
9set appimage_id $spawn_id
9 10
10send -- "firejail --name=appimage-test --debug --appimage Leafpad-0.8.17-x86_64.AppImage\r" 11send -- "firejail --name=appimage-test --debug --appimage Leafpad-0.8.17-x86_64.AppImage\r"
11expect { 12expect {
@@ -79,7 +80,14 @@ after 100
79 80
80spawn $env(SHELL) 81spawn $env(SHELL)
81send -- "firejail --shutdown=appimage-test\r" 82send -- "firejail --shutdown=appimage-test\r"
82sleep 3 83
84set spawn_id $appimage_id
85expect {
86 timeout {puts "TESTING ERROR 7\n";exit}
87 "AppImage unmounted"
88}
89
90after 100
83 91
84puts "\nall done\n" 92puts "\nall done\n"
85 93
diff --git a/test/appimage/appimage-v2.exp b/test/appimage/appimage-v2.exp
index 10443a1c7..ad741c559 100755
--- a/test/appimage/appimage-v2.exp
+++ b/test/appimage/appimage-v2.exp
@@ -6,8 +6,9 @@
6set timeout 10 6set timeout 10
7spawn $env(SHELL) 7spawn $env(SHELL)
8match_max 100000 8match_max 100000
9set appimage_id $spawn_id
9 10
10send -- "firejail --appimage Leafpad-0.8.18.1.glibc2.4-x86_64.AppImage\r" 11send -- "firejail --name=appimage-test --appimage Leafpad-0.8.18.1.glibc2.4-x86_64.AppImage\r"
11expect { 12expect {
12 timeout {puts "TESTING ERROR 1\n";exit} 13 timeout {puts "TESTING ERROR 1\n";exit}
13 "Child process initialized" 14 "Child process initialized"
@@ -79,7 +80,13 @@ after 100
79 80
80spawn $env(SHELL) 81spawn $env(SHELL)
81send -- "firejail --shutdown=appimage-test\r" 82send -- "firejail --shutdown=appimage-test\r"
82sleep 3 83set spawn_id $appimage_id
84expect {
85 timeout {puts "TESTING ERROR 7\n";exit}
86 "AppImage unmounted"
87}
88
89after 100
83 90
84puts "\nall done\n" 91puts "\nall done\n"
85 92