1 diff -u -r a/frontend/linux/workbench/mysql-workbench.in b/frontend/linux/workbench/mysql-workbench.in
2 --- a/frontend/linux/workbench/mysql-workbench.in 2022-03-25 09:06:06.000000000 +0200
3 +++ b/frontend/linux/workbench/mysql-workbench.in 2022-06-17 00:22:51.290117109 +0300
5 if test "$WB_DEBUG" != ""; then
6 $WB_DEBUG $MWB_BINARIES_DIR/mysql-workbench-bin "$@"
8 - if type -p catchsegv > /dev/null; then
9 - catchsegv $MWB_BINARIES_DIR/mysql-workbench-bin "$@"
10 + if type -p @catchsegv@ > /dev/null; then
11 + @catchsegv@ $MWB_BINARIES_DIR/mysql-workbench-bin "$@"
13 $MWB_BINARIES_DIR/mysql-workbench-bin "$@"
15 diff -u -r a/plugins/migration/frontend/migration_bulk_copy_data.py b/plugins/migration/frontend/migration_bulk_copy_data.py
16 --- a/plugins/migration/frontend/migration_bulk_copy_data.py 2022-03-25 09:06:06.000000000 +0200
17 +++ b/plugins/migration/frontend/migration_bulk_copy_data.py 2022-06-17 00:13:29.430055453 +0300
21 def generate_import_script(self, connection_args, path_to_file, schema_name):
22 - output = ['#!/bin/bash']
23 + output = ['#!/usr/bin/env bash']
24 output.append('MYPATH=\`pwd\`')
26 output.append('if [ -f \$MYPATH/%s ] ; then' % self.error_log_name)
30 def generate_import_script(self, connection_args, path_to_file, schema_name):
31 - output = ['#!/bin/bash']
32 + output = ['#!/usr/bin/env bash']
33 output.append('MYPATH=\`pwd\`')
35 output.append('if [ -f \$MYPATH/%s ] ; then' % self.error_log_name)
38 with open(script_path, 'w+') as f:
39 os.chmod(script_path, 0o700)
40 - f.write('#!/bin/bash\n\n')
41 + f.write('#!/usr/bin/env bash\n\n')
42 f.write('MYPATH=`pwd`\n')
44 f.write("arg_source_password=\"<put source password here>\"\n")
47 with open(script_path, 'w+') as f:
48 os.chmod(script_path, 0o700)
49 - f.write('#!/bin/bash\n\n')
50 + f.write('#!/usr/bin/env bash\n\n')
51 f.write('MYPATH=`pwd`\n')
53 f.write("arg_source_password=\"<put source password here>\"\n")
54 diff -u -r a/plugins/wb.admin/backend/wb_server_control.py b/plugins/wb.admin/backend/wb_server_control.py
55 --- a/plugins/wb.admin/backend/wb_server_control.py 2022-03-25 09:06:06.000000000 +0200
56 +++ b/plugins/wb.admin/backend/wb_server_control.py 2022-06-17 00:14:26.937905324 +0300
61 - 'sudo_command' : "/usr/bin/sudo -k -S -p EnterPasswordHere ",
62 + 'sudo_command' : "@sudo@ -k -S -p EnterPasswordHere ",
66 diff -u -r a/plugins/wb.admin/backend/wb_server_management.py b/plugins/wb.admin/backend/wb_server_management.py
67 --- a/plugins/wb.admin/backend/wb_server_management.py 2022-03-25 09:06:06.000000000 +0200
68 +++ b/plugins/wb.admin/backend/wb_server_management.py 2022-06-17 00:18:58.034028354 +0300
71 def reset_sudo_prefix():
72 global default_sudo_prefix
73 - default_sudo_prefix = '/usr/bin/sudo -k -S -p EnterPasswordHere'
74 + default_sudo_prefix = '@sudo@ -k -S -p EnterPasswordHere'
82 - sudo_prefix += ' /usr/bin/nohup'
83 + sudo_prefix += ' @nohup@'
85 # If as_user is the CURRENT then there's no need to sudo
86 if as_user != Users.CURRENT:
88 if '/bin/sh' in sudo_prefix or '/bin/bash' in sudo_prefix:
89 command = "LANG=C " + sudo_prefix + " \"" + command.replace('\\', '\\\\').replace('"', r'\"').replace('$','\\$') + "\""
91 - command = "LANG=C " + sudo_prefix + " /bin/bash -c \"" + command.replace('\\', '\\\\').replace('"', r'\"').replace('$','\\$') + "\""
92 + command = "LANG=C " + sudo_prefix + " @bash@ -c \"" + command.replace('\\', '\\\\').replace('"', r'\"').replace('$','\\$') + "\""
98 def get_file_owner(self, path, as_user = Users.CURRENT, user_password = None):
99 if self.target_os == wbaOS.linux:
100 - command = 'LC_ALL=C stat -c %U '
101 + command = 'LC_ALL=C @stat@ -c %U '
103 - command = 'LC_ALL=C /usr/bin/stat -f "%Su" '
104 + command = 'LC_ALL=C @stat@ -f "%Su" '
106 output = io.StringIO()
107 command = command + quote_path(path)
109 if as_user == Users.CURRENT:
110 raise PermissionDeniedError("Cannot set owner of directory %s" % path)
112 - command = "/bin/mkdir %s && chown %s %s" % (quote_path(path), with_owner, quote_path(path))
113 + command = "@mkdir@ %s && chown %s %s" % (quote_path(path), with_owner, quote_path(path))
115 - command = "/bin/mkdir %s" % (quote_path(path))
116 + command = "@mkdir@ %s" % (quote_path(path))
118 res = self.process_ops.exec_cmd(command,
122 def remove_directory(self, path, as_user = Users.CURRENT, user_password = None):
123 output = io.StringIO()
124 - res = self.process_ops.exec_cmd('/bin/rmdir ' + quote_path(path),
125 + res = self.process_ops.exec_cmd('@rmdir@ ' + quote_path(path),
127 user_password = user_password,
128 output_handler = output.write,
131 def remove_directory_recursive(self, path, as_user = Users.CURRENT, user_password = None):
132 output = io.StringIO()
133 - res = self.process_ops.exec_cmd('/bin/rm -R ' + quote_path(path),
134 + res = self.process_ops.exec_cmd('@rm@ -R ' + quote_path(path),
136 user_password = user_password,
137 output_handler = output.write,
140 def delete_file(self, path, as_user = Users.CURRENT, user_password = None):
141 output = io.StringIO()
142 - res = self.process_ops.exec_cmd("/bin/rm " + quote_path(path),
143 + res = self.process_ops.exec_cmd("@rm@ " + quote_path(path),
145 user_password = user_password,
146 output_handler = output.write,
147 @@ -1009,7 +1009,7 @@
148 def _copy_file(self, source, dest, as_user = Users.CURRENT, user_password = None):
149 output = io.StringIO()
151 - res = self.process_ops.exec_cmd("LC_ALL=C /bin/cp " + quote_path(source) + " " + quote_path(dest),
152 + res = self.process_ops.exec_cmd("LC_ALL=C @cp@ " + quote_path(source) + " " + quote_path(dest),
154 user_password = user_password,
155 output_handler = output.write,
156 @@ -1085,9 +1085,9 @@
157 # for ls -l, the output format changes depending on stdout being a terminal or not
158 # since both cases are possible, we need to handle both at the same time (1st line being total <nnnn> or not)
159 # the good news is that if the line is there, then it will always start with total, regardless of the locale
160 - command = 'LC_ALL=C /bin/ls -l -p %s' % quote_path(path)
161 + command = 'LC_ALL=C @ls@ -l -p %s' % quote_path(path)
163 - command = 'LC_ALL=C /bin/ls -1 -p %s' % quote_path(path)
164 + command = 'LC_ALL=C @ls@ -1 -p %s' % quote_path(path)
166 output = io.StringIO()
167 res = self.process_ops.exec_cmd(command,
168 @@ -2163,9 +2163,9 @@
169 def get_range(self, start, end):
171 if not self._need_sudo:
172 - ret = self.server_helper.execute_command("/bin/dd if=%s ibs=1 skip=%i count=%i 2> /dev/null" % (quote_path(self.path), start, end-start), as_user = Users.CURRENT, user_password=None, output_handler=f.write)
173 + ret = self.server_helper.execute_command("@dd@ if=%s ibs=1 skip=%i count=%i 2> /dev/null" % (quote_path(self.path), start, end-start), as_user = Users.CURRENT, user_password=None, output_handler=f.write)
175 - ret = self.server_helper.execute_command("/bin/dd if=%s ibs=1 skip=%i count=%i 2> /dev/null" % (quote_path(self.path), start, end-start), as_user = Users.ADMIN, user_password=self.get_password, output_handler=f.write)
176 + ret = self.server_helper.execute_command("@dd@ if=%s ibs=1 skip=%i count=%i 2> /dev/null" % (quote_path(self.path), start, end-start), as_user = Users.ADMIN, user_password=self.get_password, output_handler=f.write)
179 raise RuntimeError("Could not get data from file %s" % self.path)
180 @@ -2173,9 +2173,9 @@
182 def read_task(self, offset, file):
183 if not self._need_sudo:
184 - self.server_helper.execute_command("/bin/dd if=%s ibs=1 skip=%i 2> /dev/null" % (quote_path(self.path), offset), as_user = Users.CURRENT, user_password=None, output_handler=file.write)
185 + self.server_helper.execute_command("@dd@ if=%s ibs=1 skip=%i 2> /dev/null" % (quote_path(self.path), offset), as_user = Users.CURRENT, user_password=None, output_handler=file.write)
187 - self.server_helper.execute_command("/bin/dd if=%s ibs=1 skip=%i 2> /dev/null" % (quote_path(self.path), offset), as_user = Users.ADMIN, user_password=self.get_password, output_handler=file.write)
188 + self.server_helper.execute_command("@dd@ if=%s ibs=1 skip=%i 2> /dev/null" % (quote_path(self.path), offset), as_user = Users.ADMIN, user_password=self.get_password, output_handler=file.write)
189 # this will signal the reader end that there's no more data
192 @@ -2202,9 +2202,9 @@
195 if not self._need_sudo:
196 - self.server_helper.execute_command("/bin/dd if=%s ibs=1 skip=%i 2> /dev/null" % (quote_path(self.path), offset), as_user = Users.CURRENT, user_password=None, output_handler=f.write)
197 + self.server_helper.execute_command("@dd@ if=%s ibs=1 skip=%i 2> /dev/null" % (quote_path(self.path), offset), as_user = Users.CURRENT, user_password=None, output_handler=f.write)
199 - self.server_helper.execute_command("/bin/dd if=%s ibs=1 skip=%i 2> /dev/null" % (quote_path(self.path), offset), as_user = Users.ADMIN, user_password=self._password, output_handler=f.write)
200 + self.server_helper.execute_command("@dd@ if=%s ibs=1 skip=%i 2> /dev/null" % (quote_path(self.path), offset), as_user = Users.ADMIN, user_password=self._password, output_handler=f.write)
203 if self.skip_first_newline: