Skip to content

Instantly share code, notes, and snippets.

@gwpl
Last active April 12, 2021 15:02
Show Gist options
  • Save gwpl/2f1fc3eabf1d081d1dab17458b04a070 to your computer and use it in GitHub Desktop.
Save gwpl/2f1fc3eabf1d081d1dab17458b04a070 to your computer and use it in GitHub Desktop.
strace checking mime Telegram handling
My Telegram was opening pdf-s in Mendeley instead of pdf reader,
(even most other apps open it in pdf reader, xdg-open etc...),
so I checked what's going on:
sf=$(mktemp --suffix=.strace.fifo)
#mkfifo "$sf"
echo "sf=$sf"
strace -o "$sf" -f telegram-desktop >/dev/null 2>/dev/null #&& rm -v "$sf"
# other terminal for clear output
sf=to_be_same_like_in_other_terminal
cat "$sf" | grep -i mime | sed -n 's!.*stat("\(.*\)".*!\1!p' | sort -u| grep -v icons | tee -a st.out
# filter those that exists ( https://stackoverflow.com/a/21119068/544721 )
# and grep
grep -n -i mendeley $(cat /tmp/paths| xargs ls -d 2>/dev/null)
/home/user/.local/share/mime/image/png.xml
/home/user/.local/share/mime/mime.cache
/home/user/.local/share/mime/types
/usr/local/share/mime/image/png.xml
/usr/local/share/mime/mime.cache
/usr/local/share/mime/types
/usr/share/mime/image/png.xml
/usr/share/mime/mime.cache
/usr/share/mime/types
/var/lib/snapd/desktop/mime/image/png.xml
/var/lib/snapd/desktop/mime/mime.cache
/var/lib/snapd/desktop/mime/types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment