mate-desktop / caja

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

g_file_info_ unset attributes cause errors in the logs #1704

Open UnoSD opened 1 year ago

UnoSD commented 1 year ago

Expected behaviour

Set GFileInfo attributes and avoid errors in the logs

Actual behaviour

(caja:11315): GLib-GIO-CRITICAL **: 10:23:35.501: GFileInfo created without standard::sort-order

(caja:11315): GLib-GIO-CRITICAL **: 10:23:35.502: file ../glib/gio/gfileinfo.c: line 2061 (g_file_info_get_sort_order): should not be reached

(caja:11315): GLib-GIO-CRITICAL **: 10:23:35.502: GFileInfo created without standard::symlink-target

(caja:11315): GLib-GIO-CRITICAL **: 10:23:35.502: file ../glib/gio/gfileinfo.c: line 2015 (g_file_info_get_symlink_target): should not be reached

(caja:11315): GLib-GIO-CRITICAL **: 10:23:35.752: GFileInfo created without standard::sort-order

(caja:11315): GLib-GIO-CRITICAL **: 10:23:35.752: file ../glib/gio/gfileinfo.c: line 2061 (g_file_info_get_sort_order): should not be reached

(caja:11315): GLib-GIO-CRITICAL **: 10:23:35.752: GFileInfo created without standard::symlink-target

(caja:11315): GLib-GIO-CRITICAL **: 10:23:35.752: file ../glib/gio/gfileinfo.c: line 2015 (g_file_info_get_symlink_target): should not be reached

Steps to reproduce the behaviour

Use caja

MATE general version

N/A, using Xfce

Package version

MATE caja 1.26.1

Linux Distribution

Arch

universexplorer commented 1 year ago

Same problem on my system, Mate desktop environment. However, the file gfileinfo.c could not be found at all, but there is a similar file with this full path: /usr/include/glib-2.0/gio/gfileinfo.h

L-U-T-i commented 1 year ago

gfileinfo.c is a part of the source package and not contained in a distribution package. If you'd like to check it, take a look in glib2 source of your distro.

Does this: https://gitlab.gnome.org/GNOME/nautilus/-/merge_requests/1143 help anyhow?

L-U-T-i commented 1 year ago

I've created a patch which should resolve the issue:

diff -up a/libcaja-private/caja-directory-async.c b/libcaja-private/caja-directory-async.c
--- a/libcaja-private/caja-directory-async.c    2023-05-08 18:28:32.971206230 +0200
+++ b/libcaja-private/caja-directory-async.c    2023-05-08 18:28:33.040206707 +0200
@@ -3807,7 +3807,7 @@ static gboolean is_trusted_system_deskto
         return FALSE;
     }

-    target = g_file_info_get_symlink_target (info);
+    target = g_file_info_get_attribute_byte_string (info, G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET);
     if (!target) {
         goto done;
     }
diff -up a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c
--- a/libcaja-private/caja-file.c   2023-05-08 18:28:30.500189123 +0200
+++ b/libcaja-private/caja-file.c   2023-05-08 18:28:30.639190084 +0200
@@ -2396,7 +2396,7 @@ update_info_internal (CajaFile *file,
    }
    file->details->size_on_disk = size_on_disk;

-   sort_order = g_file_info_get_sort_order (info);
+   sort_order = g_file_info_get_attribute_int32 (info, G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER);
    if (file->details->sort_order != sort_order) {
        changed = TRUE;
    }
@@ -2451,7 +2451,7 @@ update_info_internal (CajaFile *file,
        file->details->thumbnailing_failed = (thumbnailing_failed != FALSE);
    }

-   symlink_name = g_file_info_get_symlink_target (info);
+   symlink_name = g_file_info_get_attribute_byte_string (info, G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET);
    if (eel_strcmp (file->details->symlink_name, symlink_name) != 0) {
        changed = TRUE;
        g_free (file->details->symlink_name);

Build with this patch went fine, I can however not test it as I am not getting this log...

fredo-m commented 8 months ago

Hi,

Same problem on a machine. I have the impression that I don't have this problem on all machines even though they all have the same version of caja (Debian 1.26.1-1).

oct. 13 14:50:35 caja[2405]: GFileInfo created without standard::sort-order oct. 13 14:50:35 caja[2405]: file ../../../gio/gfileinfo.c: line 2108 (g_file_info_get_sort_order): should not be reached oct. 13 14:50:35 caja[2405]: GFileInfo created without standard::symlink-target oct. 13 14:50:35 caja[2405]: file ../../../gio/gfileinfo.c: line 2062 (g_file_info_get_symlink_target): should not be reached oct. 13 14:50:35 caja[2405]: GFileInfo created without standard::sort-order oct. 13 14:50:35 caja[2405]: file ../../../gio/gfileinfo.c: line 2108 (g_file_info_get_sort_order): should not be reached oct. 13 14:50:35 caja[2405]: GFileInfo created without standard::symlink-target oct. 13 14:50:35 caja[2405]: file ../../../gio/gfileinfo.c: line 2062 (g_file_info_get_symlink_target): should not be reached oct. 13 14:50:35 caja[2405]: GFileInfo created without standard::sort-order oct. 13 14:50:35 caja[2405]: file ../../../gio/gfileinfo.c: line 2108 (g_file_info_get_sort_order): should not be reached oct. 13 14:50:35 caja[2405]: GFileInfo created without standard::symlink-target oct. 13 14:50:35 caja[2405]: file ../../../gio/gfileinfo.c: line 2062 (g_file_info_get_symlink_target): should not be reached oct. 13 14:50:35 caja[2405]: GFileInfo created without standard::sort-order oct. 13 14:50:35 caja[2405]: file ../../../gio/gfileinfo.c: line 2108 (g_file_info_get_sort_order): should not be reached oct. 13 14:50:35 caja[2405]: GFileInfo created without standard::symlink-target oct. 13 14:50:35 caja[2405]: file ../../../gio/gfileinfo.c: line 2062 (g_file_info_get_symlink_target): should not be reached oct. 13 14:50:41 caja[2405]: GFileInfo created without standard::sort-order

lukefromdc commented 8 months ago

This was already fixed in master with https://github.com/mate-desktop/caja/commit/1096ea06a10a68071ae304727a81a73375bfcee4 which is in 1.27.2 sounds like we need to cherrypick this to 1.26

@L-U-T-i your patch is correct and appears to be identical to what I used in the above commit.

luigifab commented 8 months ago

Yes please update 1.26.x :) because my .xsession-errors is now more than 100 Mb! (Debian Testing caja 1.26.1-1)

xpander69 commented 8 months ago

Ohh cheers! I was wondering why the logs get super huge. Just built the 1.27.2 caja and it seems to have solved the issue. Not sure if its good idea to mix 1.26 stuff with 1.27 but caja seems to work fine :)

luigifab commented 5 months ago

Still no fix? I'm sad. This is dangerous for space disk for some normal users.

lukefromdc commented 5 months ago

Fix would be to cherrypick (or if that fails, backport) https://github.com/mate-desktop/caja/commit/1096ea06a10a68071ae304727a81a73375bfcee4 to 1.26

lukefromdc commented 5 months ago

cherrypick to fix this went clean: https://github.com/mate-desktop/caja/commit/488885550e472c30eea2308d2f27be633cb69bcc A new 1.26 point release will be needed for distros to pick this up. Rolling release distros will be moving to 1.28 when that comes out, I don't know how many non-rolling releases are going to be using the combination of glib 1.76 or later with MATE 1.26 in perpetuity, but I would assume at least some are.

lukefromdc commented 5 months ago

We got the docker error on travis for rebuilding 1.26 so that will need to be fixed as in master to do a new release.

A local test build worked fine

uralets commented 5 months ago

welp... Guess it WILL make it into Ubuntu 24.04