0

Note that this is an issue under Ubuntu 14.04. It is not an issue with any other Linux distribution. There is no good reason for this to be closed...


I first wrote my game under Magia Linux, and then tested it on Ubuntu 14.04 LTS to be sure that it works correctly. You can find the Debian packages here: http://tuer.sourceforge.net/en/play/

When I enter "tuer" in command line, it runs my game as expected but when I click on the icon, it doesn't run my game. Setting the "Terminal" attribute to "true" in tuer.desktop just shows the terminal very quickly but no error message appears. The desktop file is really simple: http://sourceforge.net/p/tuer/code/HEAD/tree/pre_beta/jndt.xml#l952

There is a symbolic link /usr/bin/tuer (in the path) to /usr/share/tuer/tuer. I don't get why it works only in command line under Ubuntu. Maybe the problem comes from the script: http://sourceforge.net/p/tuer/code/HEAD/tree/pre_beta/jndt.xml#l637

I assume that it's possible to open the desktop file the same way the desktop manager does with gtk-launch, xdg-open or gvfs-open.

What is the issue here?

Update: I have driven the .desktop files executable in order to eliminate a possible root cause as Serg suggested. I've just uploaded the new Debian packages (obviously compatible with Ubuntu).

gouessej
  • 117
  • Anywhere under home directory you must make links and .desktop filea executable with chmod 755. Your question is a duplicate, just need to find a link – Sergiy Kolodyazhnyy Oct 29 '15 at 12:37
  • 1
  • @Serg The target of the link is executable for sure: http://sourceforge.net/p/tuer/code/HEAD/tree/pre_beta/jndt.xml#l1114 but not the .desktop file. I'm going to give it a try, thank you. It's weird to drive a .desktop file executable. – gouessej Oct 29 '15 at 12:56
  • @Tim we need the person who has Ubuntu then to do the testing, and they need to come here so they can provide us debug data and such. If the OP is not on Ubuntu and can't actually test or replicate, then this is "not reproduceable and not useful to the future" in the current form... – Thomas Ward Oct 29 '15 at 13:54
  • @Tim it occurs under Ubuntu 14.04 LTS. – gouessej Oct 29 '15 at 13:54
  • 2
    @ThomasW. completely un true - it's fine to ask on behalf of someone, and I'm not sure why you think it isn't... Jeff even wrote a blog post on it, and he does it himself... – Tim Oct 29 '15 at 13:57
  • This is exactly what I do. She gets the message "Bad substitution" when using gtk-launch whereas the script uses bash and indicates it. Ubuntu uses Dash by default. This problem is specific to Ubuntu. It doesn't occur under other distros. Stop putting this question on hold. Just face it, it even works under LXUbuntu. – gouessej Oct 29 '15 at 13:57
  • @ThomasW. I even provide the packages, what more can I do? The source code is under GPL, everybody can look at it. You have absolutely all elements to help me out including the source code of the script. – gouessej Oct 29 '15 at 14:05
  • When you say "icon" I assume you are referring to the .desktop file? – Seth Oct 29 '15 at 14:22
  • @Seth Yes sorry. She says that the file appears in the "Applications" section. The file is in /usr/share/applications/ – gouessej Oct 29 '15 at 14:24
  • What is the exact exec line? What are the permissions on the file? – Seth Oct 29 '15 at 14:26
  • @Seth Just "tuer" which is legal according to the spec as "/usr/bin/" is in the path and installing my package creates a symbolic link /usr/bin/tuer – gouessej Oct 29 '15 at 14:28
  • 1
    For now, Serg's suggestion isn't enough to solve the problem but as it seems plausible, I'll update my packages, it will still eliminate one possible root cause. The upload takes age on Sourceforge, sorry. – gouessej Oct 29 '15 at 14:50
  • @gouessej So changing the permissions fixes the issue? – Seth Oct 29 '15 at 15:00
  • No, it doesn't. I asked her to disconnect and reconnect after using chmod but it still doesn't work. – gouessej Oct 29 '15 at 15:27
  • If someone wants to try to make the package, run "sudo apt-get install openjdk-8-jdk ant". After that, use Subversion to get the source code "svn checkout svn://svn.code.sf.net/p/tuer/code/pre_beta tuer-code", add filemode="755" here: http://sourceforge.net/p/tuer/code/HEAD/tree/pre_beta/jndt.xml#l1117 and enter "ant compile;ant dist" in the "pre_beta" sub-folder. The packages will appear in the "target" sub-folder. – gouessej Oct 29 '15 at 15:36
  • xdg-open and gvfs-open just opens the file as a text file. gtk-launch complains: " 5: Bad substitution". That's why I suspect that dash is used instead of bash. – gouessej Oct 29 '15 at 15:38
  • I'll try checkbashisms to check whether there is a problem with my script. – gouessej Oct 29 '15 at 15:47
  • checkbashisms complains only when the very first line doesn't mention which interpreter to use. – gouessej Oct 29 '15 at 19:41
  • I get the following message: ** (gtk-launch:27745): WARNING **: Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken. – gouessej Oct 29 '15 at 21:59
  • gtk-launch tells "no such file or directory" and it claims that there was an error at the creation of the child process "tuer" :( I don't know what to do. – gouessej Oct 29 '15 at 22:01

1 Answers1

0

I had to replace the following script:

#!/usr/bin/bash
#code snippet written by Dave Dopson: http://stackoverflow.com/a/246128
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
    APP_LAUNCHER_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
    SOURCE="$(readlink "$SOURCE")"
    [[ $SOURCE != /* ]] && SOURCE="$APP_LAUNCHER_DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
APP_LAUNCHER_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
$APP_LAUNCHER_DIR/jre/bin/java -server -Xmx256m -XX:MaxDirectMemorySize=128M -Djava.ext.dirs= -jar $APP_LAUNCHER_DIR/tuer.jar

by

/usr/share/tuer/jre/bin/java -server -Xmx256m -XX:MaxDirectMemorySize=128M -Djava.ext.dirs= -jar /usr/share/tuer/tuer.jar

because unlike the terminal, Unity ignores the first line and tries to interpret my bash script as a dash script. It showed once " 5: Bad substitution", another time "** (gtk-launch:27745): WARNING **: Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.", another time "no such file or directory" and it claimed that the execution of the child process "tuer" had been interrupted without any detailed explanations.

I'll upload some fixed Debian packages in about ten hours.

Conclusion: Use a common Posix subset of Bash and Dash if you want to avoid any trouble under Ubuntu even though the script works in command line.

gouessej
  • 117