XDG Autostart

Kip Warner kip at thevertigo.com
Fri Jul 12 17:13:46 PDT 2013


Hey list,

This is just an observation I'd like to share with others who may
benefit from it either now or in the future. 

I've observed a behaviour in an XDG Autostart[1] implementation, at
least with Nautilus or some other underlying GVFS framework buried
beneath it, but this may be the case with other desktop environments.

The specification allows for three different files to be executed on a
removable medium being mounted, those being .autorun, autorun, and
autorun.sh (in that order of precedence). On my system, autorun and
autorun.sh were not launched by the shell (or kernel?) in the same
execution environment when I renamed it between the two. The script was
a bash script containing common bash extensions (e.g. declare -a, etc.)
and a sh'bang for #!/usr/bin/env bash to ensure it would be executed
within a vanilla bash environment.

When named as autorun.sh, the script was executed via sh with full POSIX
compatibility enabled, the shell or kernel ignoring the sh'bang line,
and the bash specific extensions causing the interpreter to bail. This
might be ok for some people, but not for others. When renamed to
autorun, I observed it executed in the correct environment.

Perhaps this is the expected behaviour. But if it is not,
implementations should probably take note and I can file a bug report.

Take care,

[1] <http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html>

-- 
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/xdg/attachments/20130712/80bfa37f/attachment.pgp>


More information about the xdg mailing list