[PATCH] fix: list partially corrupted folder
Jean-Tiare Le Bigot
jt at yadutaf.fr
Tue Sep 1 00:55:11 CEST 2015
Apparently, we ca't do much better than silently ignoring. I would have
prefered to yield fake/best-effort entries to keep file count right BUT
GFileEnumerator returns no data in case there were any error, not even
the filename (or did I miss something ?).
- g_file_enumerator_get_container returns *parent* folder
- g_file_enumerator_get_child requires a valid info
Hence, with your remarks applied, the patch would be:
diff --git a/thunar/thunar-io-scan-directory.c
b/thunar/thunar-io-scan-directory.c
index 66ddbdf..66d62c3 100644
--- a/thunar/thunar-io-scan-directory.c
+++ b/thunar/thunar-io-scan-directory.c
@@ -112,7 +112,16 @@ thunar_io_scan_directory (ThunarJob *job,
&err);
if (G_UNLIKELY (info == NULL))
- break;
+ {
+ /* silently ignore broken file entries */
+ if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_FAILED))
+ {
+ g_clear_error (&err);
+ continue;
+ }
+ break;
+ }
+
is_mounted = TRUE;
if (err != NULL)
Let me know if you want a properly git send-email formated patch.
Le 31/08/2015 23:08, Jonas Kümmerlin a écrit :
> Am Sonntag, den 30.08.2015, 18:44 +0200 schrieb Jean-Tiare Le Bigot:
>> if (err != NULL)
>> {
>> g_propagate_error (error, err);
>> - return FALSE;
>> + g_clear_error(&err);
> Do NOT ever do anything with err after you propagated it with
> g_propagate_error(); g_propagate_error() invalidates the source. The only thing
> you may (and have to if you plan to use the variable after that) do is simply
> set err = NULL. (Hint: The docs explicitly spell this out. Read them.)
> Everything else will very likely lead to memory corruption sooner or later.
>
>> + /* silently ignore broken file entries */
>> + if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_FAILED))
>> + {
>> + g_propagate_error (error, err);
>> + g_clear_error (&err);
> same
>
> The GError warnings could be caused by not initializing error pointers (grep for
> "GError +\*[[:alnum:]]+;"), or by reusing an error variable without clearing it
> before. You MUST avoid passing an already initialized GError* as out parameter
> into a function; propagating errors in a loop violates this.
>
> You can learn more about error reporting in GLib here:
> https://developer.gnome.org/glib/stable/glib-Error-Reporting.html
>
> Read it carefully; the detailed semantics are important.
> _______________________________________________
> Xfce4-dev mailing list
> Xfce4-dev at xfce.org
> https://mail.xfce.org/mailman/listinfo/xfce4-dev
>
More information about the Xfce4-dev
mailing list