TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: ALL
from: DENNIS LEE BIEBER
date: 2019-11-04 11:19:00
subject: Re: file -i vs xdg-mime q

On Mon, 4 Nov 2019 10:11:37 +0100, "R.Wieser" 
declaimed the following:

>The question is: what is the purposes of "file -i" and "xdg-mime query
>filetype" returning different results ?   Or, in other words: what are they
>aimed at ?
>

 To show that someone, somehow, modified one of the databases those
applications use to detect file types... 

pi@rpi3bplus-1:~$ cat test1.py
"""
    generic Python script with no shebang line
"""

import sys

if __name__ == "__main__":
    print("doing nothing")

pi@rpi3bplus-1:~$ cat test2.py
#!/usr/bin/env python3
"""
    generic Python script with shebang line
"""

import sys

if __name__ == "__main__":
    print("doing nothing")

pi@rpi3bplus-1:~$ file -i test1.py test2.py
test1.py: text/x-python; charset=us-ascii
test2.py: text/x-python; charset=us-ascii
pi@rpi3bplus-1:~$ xdg-mime query filetype test1.py
text/x-python
pi@rpi3bplus-1:~$ xdg-mime query filetype test2.py
text/x-python
pi@rpi3bplus-1:~$ file test1.py test2.py
test1.py: Python script, ASCII text executable
test2.py: Python script, ASCII text executable
pi@rpi3bplus-1:~$

 As can be seen, this R-Pi 3B+ running a recent Raspbian (via NOOBS)
does NOT show differences.

pi@rpi3bplus-1:~$ apropos mime
gvfs-mime (1)        - (unknown subject)
openssl-smime (1ssl) - S/MIME utility
smime (1ssl)         - S/MIME utility
update-desktop-database (1) - Build cache database of MIME types handled by
desktop files
update-mime (8)      - create or update MIME information
update-mime-database (1) - a program to build the Shared MIME-Info database
cache
xdg-mime (1)         - command line tool for querying information about
file type handling an...
pi@rpi3bplus-1:~$


pi@rpi3bplus-1:~$ cat /etc/mailcap
###############################################################################
#
#  MIME media types and programs that process those types
#
#  Much of this file is generated automatically by the program
"update-mime".
#  Please see the "update-mime" man page for more information.
#
#  Users can add their own rules if they wish by creating a ".mailcap"
#  file in their home directory.  Entries included there will take
#  precedence over those listed here.
#
###############################################################################


###############################################################################
#
#  User section follows:  Any entries included in this section will take
#  precedence over those created by "update-mime".  DO NOT CHANGE the
#  "User Section Begins" and "User Section Ends" lines, or anything outside
#  of this section!
#

# ----- User Section Begins ----- #
# -----  User Section Ends  ----- #

###############################################################################



pi@rpi3bplus-1:~$ cat /etc/mailcap | grep "python"
text/x-python; geany %s; test=test -n "$DISPLAY"
text/x-python3; mu-editor %s; test=test -n "$DISPLAY"
text/x-python3; mu-editor %s; test=test -n "$DISPLAY"
text/x-python; /usr/bin/thonny %s; test=test -n "$DISPLAY"
pi@rpi3bplus-1:~$


--
 Wulfraed                 Dennis Lee Bieber         AF6VN
 wlfraed@ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.