leo-arch / clifm

The shell-like, command line terminal file manager: simple, fast, extensible, and lightweight as hell.
https://github.com/leo-arch/clifm/wiki
GNU General Public License v2.0
1.35k stars 39 forks source link

starting a MIME application is not reliable #193

Closed muellerto closed 1 year ago

muellerto commented 1 year ago

Describe the bug I have two files with the same extension .xlsx which means Microsoft Excel files. One starts the right MIME application correctly, the other one does not. Look at the situation:

19 12390.iip                      - ./rw-/r--/r-- 2022-12-14 14:39:08  927744
20 13148.iip                      - ./rw-/r--/r-- 2022-06-13 13:14:57  991232
21 13154-admin.iip                - ./rw-/r--/r-- 2022-06-28 10:34:57  976896
22 13177.iip                      - ./rw-/r--/r-- 2022-07-18 13:18:20 1570816
23 13180.iip                      - ./rw-/r--/r-- 2022-07-13 07:52:54  768000
24 13202.iip                      - ./rw-/r--/r-- 2022-08-15 13:06:06  944128
25 13202.xlsx                     - ./rw-/r--/r-- 2021-12-01 07:34:37   16384
26 13211.iip                      - ./rw-/r--/r-- 2022-08-03 08:47:25  964608
27 13284.iip                      - ./rw-/r--/r-- 2022-09-14 12:44:46  747520
28 13305.iip                      - ./rw-/r--/r-- 2022-09-27 07:47:33 4909056
29 13315.iip                      - ./rw-/r--/r-- 2022-10-05 08:42:39 4902912
30 13347.iip                      - ./rw-/r--/r-- 2022-11-16 08:53:32  909312
31 13362.iip                      - ./rw-/r--/r-- 2022-11-29 10:39:16  909312
32 13363.iip                      - ./rw-/r--/r-- 2022-11-28 08:03:07 1048576
33 13390.iip                      - ./rw-/r--/r-- 2022-12-16 09:50:20 1044480
34 13410.iip                      - ./rw-/r--/r-- 2022-12-15 12:18:09  976896
35 13429.iip                      - ./rw-/r--/r-- 2023-01-11 11:31:11  913408
36 13433.iip                      - ./rw-/r--/r-- 2023-01-30 13:34:34 1007616
37 13460.iip                      - ./rw-/r--/r-- 2023-02-03 10:32:12  919552
38 Als21BleModule.iip             - ./rw-/r--/r-- 2023-02-21 12:34:15 1097728
39 Als21SolServer_Mig_18.6.0.iip  - ./rw-/r--/r-- 2022-11-11 10:55:19 8867840
40 DatabaseSelector.iip           - ./rw-/r--/r-- 2022-11-14 12:41:27  913408
41 IIPSecurityModule.iip          - ./rw-/r--/r-- 2022-12-14 11:18:43 1067008
42 NewAD.iip                      - ./rw-/r--/r-- 2022-11-17 12:50:30  921600
43 NewAD-intern.iip               - ./rw-/r--/r-- 2022-10-21 11:47:15  919552
44 Project.iip                    - ./rw-/r--/r-- 2022-05-16 08:17:42  825344
45 SelectorPreview.iip            - ./rw-/r--/r-- 2022-10-05 11:47:22  974848
46 sms-empfaenger.xlsx            - ./rw-/r--/r-- 2023-02-22 09:43:34    4096
47 SmsLogicModule.iip             - ./rw-/r--/r-- 2022-03-28 14:50:57  925696
48 SSO.iip                        - ./rw-/r--/r-- 2023-01-10 10:28:31  976896
49 SvnModule.iip                  - ./rw-/r--/r-- 2023-02-10 13:00:22  978944
------------------------------------------------------------------------------------------------------------
N1[2] 09:44 tm:DES-TM-003 /e/work/Dev/__test_configs
<1> $ 25
N1[2] 09:44 tm:DES-TM-003 /e/work/Dev/__test_configs
<0> $ 46
mime: sms-empfaenger.xlsx: No associated application found
Add a new entry to the mimelist file ('mime edit' or F6) or run 'open FILE APPLICATION'
N1[2] 09:44 tm:DES-TM-003 /e/work/Dev/__test_configs
<1> $

First I tried number 25, everything correct, Excel has been started, I closed it. Then I tried number 46, an error message occurs. This happens also when I write the entire filename on the command line. Why?

Expected behavior The configured MIME application should always be started.

Desktop (please complete the following information):

leo-arch commented 1 year ago

Hi @muellerto. Two things come to my mind:

  1. Is the file 46 really a spreadsheet file, despite what the extension says?
  2. If it is, maybe the REGEX line for Office documents in the Lira config file is not wide enough to recognize this specific MIME type.

So, please tell me these two things:

  1. Exact MIME type of the file 46: mm info 46 (or using file(1): file --mime-type 46)
  2. The line responsible for office documents in the Lira config file (mm edit). By default it looks like this: X:^application/.*(open|office)document.*=libreoffice;soffice;ooffice
muellerto commented 1 year ago

Ah, I just learned that the extension is not the only criterion for determining a MIME type. I just copied another file into an xlsx file but this has then no MIME type, says mm info.

OK, maybe I was jumping the gun. Currently I make some experiments creating such files by C++ code. Maybe the file I checked was indeed not an ordinary xlsx file. I'll have an eye on this during the next days and then I'll close the case. At the moment all my files work properly, that's why I can't detect any difference using mm info.

leo-arch commented 1 year ago

Great! Please keep me informed.

BTW, you can use file extensions instead of MIME types in Lira too, but it's not that reliable. There are a few examples in the configuration file.

muellerto commented 1 year ago

Seems to be a problem with a corrupt file created by myself. Never had that again since then. (But it was cool to blame someone else ...)