Bug 381675 - Can't run shared object (library)
Summary: Can't run shared object (library)
Status: RESOLVED UPSTREAM
Alias: None
Product: krusader
Classification: Applications
Component: general (show other bugs)
Version: 2.5.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Krusader Bugs Distribution List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-26 11:04 UTC by Roman
Modified: 2018-06-02 08:40 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
binary produced by gcc6 on Debian. Just calls system("xterm") (8.43 KB, application/x-sharedlib)
2017-06-26 18:37 UTC, Roman
Details
A screenshot after double-clicking a .desktop file. What it happened was that Kate was launched (128.33 KB, image/png)
2018-06-01 09:49 UTC, Toni Asensi Esteve
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roman 2017-06-26 11:04:27 UTC
ELF has this feature that shared library may have entry point.
Krusader does run such files. It asks to choose application to open file with instead.
In Debian stretch executables are usually compiled as shared objects so one can't run them from file managers.
Same issue applies to Dolphin.
Comment 1 Roman 2017-06-26 11:05:02 UTC
(In reply to Roman from comment #0)
> Krusader does run such files. It asks to choose application to open file
> with instead.

I meant "does not"
Comment 2 Alex Bikadorov 2017-06-26 18:23:47 UTC
Please provide an example file.
Comment 3 Roman 2017-06-26 18:37:12 UTC
Created attachment 106317 [details]
binary produced by gcc6 on Debian. Just calls system("xterm")

(In reply to Alex Bikadorov from comment #2)
> Please provide an example file.

I think libc.so.6 is usually executable on most linux distros. It prints some info when running.
Debian stretch builds C and C++ apps by default as executable shared objects.
If you still need example, I've attached simple C program that is shared object but executable (upon downloading mark it as executable).
Comment 4 Alex Bikadorov 2017-06-26 18:44:33 UTC
Can confirm with libc.so.6
Comment 5 Roman 2017-06-26 18:49:11 UTC
Basically compile any C program with -fPIC -pie parameters. It will be runnable shared object. Debian just seems to do it by default.
Comment 6 Roman 2018-05-15 09:53:28 UTC
So I got the new version (2.7.0) and it's still not fixed.
Comment 7 Nikita Melnichenko 2018-05-16 04:51:58 UTC
Can't repro:

----- test.cpp -----

#include <iostream>
#include <fstream>
using namespace std;

int main () {
  ofstream myfile;
  myfile.open ("example.txt");
  myfile << "Writing this to a file.\n";
  myfile.close();
  return 0;
}

----- terminal -----

$ g++ -fPIC -pie test.cpp
$ file a.out
a.out: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, not stripped
$ ./a.out
$ ls
a.out  example.txt  test.cpp
$ rm example.txt
$ # run from krusader
$ ls
a.out  example.txt  test.cpp
Comment 8 Roman 2018-05-16 15:28:26 UTC
(In reply to Nikita Melnichenko from comment #7)

Does Krusader recognize the file type as application/x-sharedlib for you?
Comment 9 Roman 2018-05-16 15:31:07 UTC
Actually it might depend on KF version. I have KDE Frameworks 5.28.0 and encounter the same problem in Dolphin.
Comment 10 Nikita Melnichenko 2018-05-17 04:28:45 UTC
It says "shared library" on both yours and my exe.

I'm using KF 5.43. Please try to upgrade whenever you are ready and reopen if it doesn't fix the issue.
Comment 11 milkaca 2018-05-31 09:33:58 UTC
After doing some testing on Kubuntu 18.04. I have two cases if I run Krusader as root, nothing happened when I run executable file (tested with shell and desktop files). In second case if I run shell file in normal Krusader mode (not root mode) then it will be executed, but desktop file will be opened in Kate editor.

In Dolphin or Double commander (root mode) I have no issues, files are normally executed.
Comment 12 milkaca 2018-05-31 09:46:28 UTC
After some more testing :), I realized that shell files are executed in the background I don't see terminal.

Desktop files are not executed, what every I do.
Comment 13 Toni Asensi Esteve 2018-06-01 09:49:22 UTC
Created attachment 112994 [details]
A screenshot after double-clicking a .desktop file. What it happened was that Kate was launched

I attach a screenshot after I:
- launched the K Menu, 
- dragged the Dolphin icon to the desktop, 
- executed `chmod +x 'org.kde.dolphin.desktop`,
- double-clicked the .desktop file. 

What it happened was that Kate was launched. I tried it using Dolphin, and dolphin executed that desktop file.

> [...] if I run shell file in normal Krusader mode [...] then it will be executed, but desktop file will be opened in Kate editor.

> Desktop files are not executed, whatever I do.

The same happens to me (using Kubuntu 18.04).
Comment 14 milkaca 2018-06-01 10:17:15 UTC
Yes, I can also confirm that. But if did you try it with Krusader privileged mode? In my case even Kate will not be opened. Please fix this, I would like to have desktop file executed in "normal" and privileged mode (root).
Comment 15 Nikita Melnichenko 2018-06-02 05:14:23 UTC
Please file a separate bug for .desktop files, so we can prioritize accordingly. We consider this (running binaries) to be resolved.
Comment 16 milkaca 2018-06-02 08:40:07 UTC
I managed to resolve issue with not seeing terminal window by adding this line at the beginning of the shell script:

# If the script is not running in a terminal then it restarts itself in Terminal.
tty -s; if [ $? -ne 0 ]; then x-terminal-emulator -e "$0"; exit; fi

and if I don't want terminal to be closed immediately after execution is finished I also add this line at the very end of the shell script:

# Prevent closing the terminal
$SHELL