It's too long to post the whole strace here, try

strace -fe open,openat xdg-mime query default inode/directory

suffice to say that command spits 429 lines, it seems like it's attaching processes to read each file and other processes to do god knows what, dozens of processes in all.

  • It's a shell script. Did you consider simply reading it? Or using the shell's various facilities to debug what it executes? – JdeBP Jun 8 '16 at 23:02
  • @JdeBP gaahh. It never occured to me it'd be a shell script. I'm officially designating today my brainless day, this wasn't the only symptom :-P – jthill Jun 8 '16 at 23:28

xdg-mime is a shell script, so you'll get a more manageable trace by asking the shell.

dash -x /usr/bin/xdg-mime

The first complex action after parsing the command line is to detect your desktop environment, using a combination of methods: environment variables, detecting the Gnome session manager through D-Bus, and querying properties of the root window. This is done so that e.g. you get to read PDF files in Evince on Gnome and Okular on KDE.

After that, xdg-mime looks for programs registered as XDG applications in locations that depend on the detected desktop environment.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.