mate-desktop / caja

Caja, the file manager for the MATE desktop
https://mate-desktop.org/
Other
264 stars 145 forks source link

Caja will see bash scripts as 'troff' files when point versioning #1705

Closed TuxVinyards closed 1 year ago

TuxVinyards commented 1 year ago

XDG 'file type' problem:

Caja will see bash scripts as a 'troff' files when point versioning eg "my.script.2.2.2" as in the first screen shot.

But it works okay if they end in a zero or an integer greater than 9 .

It's the same in both Ubuntu & Manjaro Mate. Ubuntu 22.10 with 1.26.0 & Caja 1.26.1 and Manjaro rolling latest.

I am concluding that it is Mate and not xdg-desktop at fault here, because it doesn't happen with Cinnamon, Gnome 3, or with KDE, tested using Mint, Fedora, Suse, MX & Kubuntu. See further screenshots.

What happens:

bash-xdg-test-mate3

What should happen:

bash-xdg-test-mate1

Works okay if they end in a zero or an integer greater than 9:

bash-xdg-test-mate2

bash-xdg-test-mate4

Doesn't happen with other desktops:

bash-xdg-test-ubuntu-kde

bash-xdg-test-fedora-gnome

bash-xdg-test-cinnamon3

lukefromdc commented 1 year ago

I was just unable to duplicate this when using a "test2.2.2.sh" file containing only the string "dmesg" but DID get it when I removed the .sh extension. Wonder if this is an issue in libmagic or in what caja is sending to libmagic?

TuxVinyards commented 1 year ago

@lukefromdc Glad to see you picking up on this. Sounds like you are managing to replicate it, I think, but I am bit confused about when you say that you created a file " containing only the string 'dmesg' "

I used a simple file with the Bash 'hash bang' & set it to executable (chmod +x or properties > permissions) as in:

#!/bin/bash

echo "hello world"

sleep 10

Cheers.

lukefromdc commented 1 year ago

By that I mean a shell script containing the command "dmesg" as the only line I have no idea how to diagnose the underlying problem but I suspect this may relate to libmagic or how data is being sent to libmagic. This is a bit out of my core knowledge base and experience.

TuxVinyards commented 1 year ago

@lukefromdc I am sure that way more outside my knowledge base here :rofl:

I had another look through the src and noticed the gio.h include in the file https://github.com/mate-desktop/caja/blob/master/libcaja-private/caja-file-utilities.c which got me looking at 'gio'

This fault is showing up at the command line too ....

gio 2 2 2

gio 2 2 10

??

lukefromdc commented 1 year ago

That means the problem isn't in caja. gio info is invoking gio, which ships with glib and that's where you will need to open a new issue. GNOME and cinnamon must be using a workaround. Maybe they using libmagic directly to determine filetype and not going through gio?

Note that this does not occur when the file has a .sh extension but only with the filename lacks an extension, as in fact is common for system shellscripts.

Closing for now, can reopen if someone finds out what GNOME and Cinnamon are doing to get around this when gio is screwing up the filetype detection. Thanks for finding the underlying issue here

TuxVinyards commented 1 year ago

I think this problem has more ramifications and it's a problem with Mate. This may be a lot bigger than this mime-type issue that I am getting.

This isn't happening with gio (gvfs) at the command line when I am testing on with KDE (ubuntu studio) or with Gnome3 (fedora 33) BUT with both Ubuntu Mate and Manjaro Mate it is.

My gut feeling is that something is going wrong in the Mate build stage, or with the Mate dependency list. It may or may not come out in the wash when the Wayland work gets finished. Or it might be pointer to something that could be behind lots of other issues.

As far as I am concerned, I am going to leave this with you. I am going to use a different point versioning system, not .sh extensions though, and not another desktop, at least not yet .....

gio-gnome3 gio-kde

:smile_cat:

TuxVinyards commented 1 year ago

I think this problem has more ramifications and it's a problem with Mate. This may be a lot bigger than this mime-type issue that I am getting.

This isn't happening with gio (gvfs) at the command line when I am testing on with KDE (ubuntu studio) or with Gnome3 (fedora 33) BUT with both Ubuntu Mate and Manjaro Mate it is.

My gut feeling is that something is going wrong in the Mate build stage, or with the Mate dependency list. It may or may not come out in the wash when the Wayland work gets finished. Or it might be pointer to something that could be behind lots of other issues.

As far as I am concerned, I am going to leave this with you. I am going to use a different point versioning system, not .sh extensions though, and not another desktop, at least not yet .....

gio-gnome3 gio-kde

:smile_cat:

TuxVinyards commented 1 year ago

I think this problem has more ramifications and it's a problem with Mate. This may be a lot bigger than this mime-type issue that I am getting.

This isn't happening with gio (gvfs) at the command line when I am testing on with KDE (ubuntu studio) or with Gnome3 (fedora 33) BUT with both Ubuntu Mate and Manjaro Mate it is.

My gut feeling is that something is going wrong in the Mate build stage, or with the Mate dependency list. It may or may not come out in the wash when the Wayland work gets finished. Or it might be pointer to something that could be behind lots of other issues.

As far as I am concerned, I am going to leave this with you. I am going to use a different point versioning system, not .sh extensions though, and not another desktop, at least not yet .....

gio-gnome3 gio-kde

:smile_cat:

lukefromdc commented 1 year ago

Odd that a test from the command line would be affected in any way by what DE you are running.

lukefromdc commented 1 year ago

Also this might be distro-specific not desktop environment specific. Ubuntu Mate and Manjaro Mate are different distros than Fedora, note that Ubuntu Studio uses a different kernel to control latency for audio work. Can you verify that the Ubuntu Studio and Ubuntu Mate installs you tested are using the same version of glib? If they are not, that narrows it down quite a bit

cwendling commented 1 year ago

This could also be specific versions of shared-mime-info, or specific configurations of the database somewhere.

TuxVinyards commented 1 year ago

Okay, as I started this ball rolling, it was probably down to me to download some more ISO's and compare. But as VM's are handy for testing things & I like to have a few available ....

In short, it looks again like a glib problem.

I used a set of rolling Manjaro latest and got different results from all three.

They all seemed to have glib2 at around version 2.74.5 (which is also the same for Ubuntu Mate 22.10)

However, while Manjaro Mate had glib 1.2.10 both Budgie and KDE had glibc 2.37. Ubuntu had a whole naming system to itself that I couldn't even make head nor tail of ...

Dolphin saw the bash.2.2.2 file correctly but failed with gio on the command line. Budgie, using nautilus, failed on both tests, even though Fedora 33 and Gnome 3 had no problems at all.

So, looks like a closed issue but something to keep at the back of our minds if the our file manager is yielding weird results.

I note, looking at glib's versioning, they themselves seem to have moved from three points down to two. ie 1.2.10 now becomes 2.37, loosely speaking.

There are quite a few Bash scripts that I am going to have to move to two point but it probably won't take that long, may be only a couple hours, may be not even that.

Thanks to people for thoughts and time.