LWN.net Logo

Why arbitrary executables?

Why arbitrary executables?

Posted Feb 11, 2009 21:19 UTC (Wed) by endecotp (guest, #36428)
Parent article: How to write a Linux virus in 5 easy steps

Can anyone suggest a sane use-case where a .desktop file needs to specify an arbitrary executable? I would have thought that in 99% of the uses of these things they should indicate their MIME type (or equivalent) and the desktop should use that to determine the executable to run.

(I suppose that still leaves MIME types like text/perl to worry about.)


(Log in to post comments)

Why arbitrary executables?

Posted Feb 12, 2009 9:52 UTC (Thu) by roblucid (subscriber, #48964) [Link]

That's the essential point. The desktop files saved should be data, that make requests of program interpreter's installed out of band. Then you need to have those data interpreters not have embedded script facilities within them, or ways to execute binary code in the data file.

Unfortunately it seems to be very tempting, to add "kool" dynamic content, by using over-general languages because it ticks the maximum number of feature lists.

Why arbitrary executables?

Posted Feb 12, 2009 19:58 UTC (Thu) by GhePeU (subscriber, #56133) [Link]

Can anyone suggest a sane use-case where a .desktop file needs to specify an arbitrary executable? I would have thought that in 99% of the uses of these things they should indicate their MIME type (or equivalent) and the desktop should use that to determine the executable to run.

You got it backwards: the .desktop files are what the system use to decide what executable must be used to open a file with a specific MIME type.

$ cat /usr/share/applications/gedit.desktop
[Desktop Entry]
Name=Text Editor
Comment=Edit text files
Exec=gedit %U
Terminal=false
Type=Application
StartupNotify=true
MimeType=text/plain;
Icon=accessories-text-editor
Categories=GNOME;GTK;Utility;TextEditor;


When nautilus finds a file with the mimetype 'text/plain' it looks through all the .desktop files in the system- and user-specific directories until it finds one who lists the correct mimetype and launch the indicated executable with the specified parameter.
To gnome-menus the same file means "add to the Accessories menu an entry named 'Text Editor' with the tooltip 'Edit text files' and the icon 'accessories-text-editor', then if the user click on this entry launch the command 'gedit'".

A .desktop file needs to specify an arbitrary executable.

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds