ubuntu / snapcraft-desktop-helpers

Various launchers for snapcraft wiki parts
MIT License
73 stars 60 forks source link

desktop-launch: line 199: [: too many arguments #114

Open ddennedy opened 6 years ago

ddennedy commented 6 years ago

Today, I was updating my snap and testing it before publishing it. I got the error when trying to run it:

ddennedy@MS-7593:~/src/mlt_web$ shotcut
cp: '/home/ddennedy/.config/user-dirs.locale' and '/home/ddennedy/.config/user-dirs.locale' are the same file
/snap/shotcut/x4/bin/desktop-launch: line 199: [: too many arguments

Upon reverting to the previous version of the app (snap revert), it works. I see bin/desktop-launch did change between versions. Next, I moved /home/ddennedy/.config/user-dirs.locale out of the way and tried again. This time I got:

ddennedy@MS-7593:~/src/mlt_web$ shotcut
/snap/shotcut/x4/bin/desktop-launch: line 23: /home/ddennedy/.config/user-dirs.locale: No such file or directory
/snap/shotcut/x4/bin/desktop-launch: line 190: [: /home/ddennedy/../../media/File: binary operator expected

I have some interesting mounts on this machine. I have these NFS mounts:

brlin-tw commented 6 years ago

These all seem to be unsanitized word splitting errors, which should be mostly fixed by PR #123 and #129

ddennedy commented 6 years ago

As an update, upon updating my snap July 1 and then again August 1, I still see messages desktop-launch: line 207: [: too many arguments at snap launch. However, the snap runs without having to remove my weird nfs mounts unlike before.

brlin-tw commented 6 years ago

Probably here:

  # If we aren't creating new links, check if we have content saved in old locations and move it
  for d in DOCUMENTS DESKTOP DOWNLOAD MUSIC PICTURES VIDEOS PUBLICSHARE TEMPLATES; do
    old=`eval "$(echo "echo \\$OLD_XDG_${d}_DIR")"`
    new=`eval "$(echo "echo \\$XDG_${d}_DIR")"`
    if [ -L "$old" ] && [ -d "$new" ] && [ `readlink "$old"` != "$new" ]; then
      mv "$old"/* "$new"/ 2>/dev/null
    elif [ -d "$old" ] && [ -d "$new" ] && [ "$old" != "$new" ]; then
      mv "$old"/* "$new"/ 2>/dev/null
    fi
  done

However the eval operation is risky so I still don't know how to deal with this as of now.