From 912083d9153c47094b38a19213aa7f316295bc4a Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Jul 09 2018 13:26:56 +0000 Subject: smb: Add workaround to fix removal of non-empty dir --- diff --git a/gvfs.spec b/gvfs.spec index 76bf221..e10d232 100644 --- a/gvfs.spec +++ b/gvfs.spec @@ -22,7 +22,7 @@ Name: gvfs Version: 1.36.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Backends for the gio framework in GLib License: GPLv3 and LGPLv2+ and BSD and MPLv2.0 @@ -32,6 +32,9 @@ Source0: https://download.gnome.org/sources/gvfs/1.36/gvfs-%{version}.tar.xz # http://bugzilla.gnome.org/show_bug.cgi?id=567235 Patch0: gvfs-archive-integration.patch +# https://gitlab.gnome.org/GNOME/gvfs/issues/1 +Patch1: smb-Add-workaround-to-fix-removal-of-non-empty-dir.patch + BuildRequires: pkgconfig BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version} BuildRequires: pkgconfig(dbus-glib-1) @@ -214,6 +217,7 @@ the functionality of the installed gvfs package. %prep %setup -q %patch0 -p1 -b .archive-integration +%patch1 -p1 -b .smb-Add-workaround-to-fix-removal-of-non-empty-dir # Needed for gvfs-0.2.1-archive-integration.patch autoreconf -fi @@ -402,6 +406,9 @@ killall -USR1 gvfsd >&/dev/null || : %{_datadir}/installed-tests %changelog +* Mon Jul 09 2018 Ondrej Holy - 1.36.2-2 +- smb: Add workaround to fix removal of non-empty dir + * Tue May 08 2018 Kalev Lember - 1.36.2-1 - Update to 1.36.2 diff --git a/smb-Add-workaround-to-fix-removal-of-non-empty-dir.patch b/smb-Add-workaround-to-fix-removal-of-non-empty-dir.patch new file mode 100644 index 0000000..d94020e --- /dev/null +++ b/smb-Add-workaround-to-fix-removal-of-non-empty-dir.patch @@ -0,0 +1,42 @@ +From 42f65062a3c72f920ba35d4fa1437c104355e207 Mon Sep 17 00:00:00 2001 +From: Ondrej Holy +Date: Wed, 2 May 2018 15:03:48 +0200 +Subject: [PATCH 1/3] smb: Add workaround to fix removal of non-empty dir + +smbc_rmdir returns 0 for non-empty dir currently even if the dir has +not been removed. Add workaround and return G_IO_ERROR_NOT_EMPTY in +this case. + +https://bugzilla.gnome.org/show_bug.cgi?id=792147 +--- + daemon/gvfsbackendsmb.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c +index 147872d1..d4944197 100644 +--- a/daemon/gvfsbackendsmb.c ++++ b/daemon/gvfsbackendsmb.c +@@ -1936,7 +1936,19 @@ do_delete (GVfsBackend *backend, + } + + if (S_ISDIR (statbuf.st_mode)) +- res = smbc_rmdir (op_backend->smb_context, uri); ++ { ++ res = smbc_rmdir (op_backend->smb_context, uri); ++ ++ /* We can't rely on libsmbclient reporting ENOTEMPTY, let's verify that ++ * the dir has been really removed: ++ * https://bugzilla.samba.org/show_bug.cgi?id=13204 ++ */ ++ if (res == 0 && smbc_stat (op_backend->smb_context, uri, &statbuf) == 0) ++ { ++ res = -1; ++ errno = ENOTEMPTY; ++ } ++ } + else + res = smbc_unlink (op_backend->smb_context, uri); + errsv = errno; +-- +2.17.1 +