Rclone install broken for Synology again


#1

I just tried to upgrade to 1.45 on my Synology, but I get

None of the supported tools for extracting zip archives (unzip 7z, busybox) were found. Please install one of them and try again.

Seems like somebody’s added this logic to detect the tool, but it doesn’t seem to work on Synology for some reason:

#make sure unzip tool is available and choose one to work with
set +e
for tool in ${unzip_tools_list[*]}; do
    trash=`hash $tool 2>>errors`
    if [ "$?" -eq 0 ]; then
        unzip_tool="$tool"
        break
    fi
done  
set -e

If I run which 7z, I get /bin/7z, and running 7z from the command-line works fine. If I change the above code to just hard-code

unzip_tool="7z"

then the installer works just fine. I don’t really understand what the hash command above is doing, but it doesn’t seem to work on Synology. Any ideas?


#2

This is what hash does according to the bash manual.

What do you get if you run?

hash 7z ; echo $?

So the idea is that if the command is found then we get a zero exit code

       hash [-lr] [-p filename] [-dt] [name]
              Each time hash is invoked, the full pathname of the command name is determined by searching the directories in $PATH and remembered.  Any previously-remembered pathname is
              discarded.   If the -p option is supplied, no path search is performed, and filename is used as the full filename of the command.  The -r option causes the shell to forget
              all remembered locations.  The -d option causes the shell to forget the remembered location of each name.  If the -t option is supplied, the full pathname  to  which  each
              name corresponds is printed.  If multiple name arguments are supplied with -t, the name is printed before the hashed full pathname.  The -l option causes output to be dis‐
              played in a format that may be reused as input.  If no arguments are given, or if only -l is supplied, information about remembered commands is printed.  The return status
              is true unless a name is not found or an invalid option is supplied.

#3

If I run that command, I get zero:

~$ hash 7z; echo $?
0

Can’t understand why it doesn’t work then?!


#4

How about these?

tool=7z ; trash=`hash $tool` ; if [ "$?" -eq 0 ]; then echo "found" ; fi

tool=7z ; trash=`hash $tool` ; if [ $? -eq 0 ]; then echo "found" ; fi

tool=7z ; hash $tool ; if [ $? -eq 0 ]; then echo "found" ; fi

#5

Okay, put some debugging in and found it. The issue is here:

unzip_tools_list=('unzip' '7z', 'busybox')

The list has a comma after 7z, so the test is done hash 7z, which of course fails, because there’s no command “7z,” :slight_smile:

The fix is to remove the comma from the list declaration, and then it all works. Guess it was never picked up in testing because probably anyone testing only did so on systems with unzip or busybox. :smile:


#6

Well done! Want to sent a pull request to fix?


#7

THis is the master copy of the file: https://github.com/ncw/rclone/blob/master/docs/content/install.sh


#8

Yeah, was just looking at that…