SamsungSLAV/weles

Actions are allergic to whitespace

Michcioperz opened this issue · 0 comments

Copying files from/to DUT is currently implemented as

func (d *deviceCommunicationProvider) CopyFilesTo(src []string, dest string) error {
for _, path := range src {
_, _, err := d.sessionProvider.Exec(prefixPath+"dut_copyto.sh", path, dest)

and even though sessionProvider.Exec takes the command in the form of a list of strings, it proceeds then to just

return d.executeRemoteCommand(strings.Join(cmd, " "))

This is then executed by the default shell on the supervisor. In most cases this is fine, but if either of the paths contains a space, the command will turn into dut_copyto.sh path with spaces other_path. The implementation of dut_copyto will throw an error in best case or do something unexpected in worst case (consider CopyFilesTo([]string{"random_file /etc/passwd"}, "what_if_this_path_is_ignored")).

This issue also affects SupervisorPull/Push in my changes.