From c117e2bfd4048303c9bb673ab98091753ea9ac29e3ee607a55a9a6b8d1e07c65 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Fri, 8 Jun 2018 10:03:30 +0000 Subject: [PATCH] Accepting request 615194 from home:zhangxiaofei:branches:GNOME:Factory - Add gvfs-smb-Use-O_RDWR-to-fix-fstat-when-writing.patch: Fix failures copying files on smb mounts (bgo#795805 boo#1096476). OBS-URL: https://build.opensuse.org/request/show/615194 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gvfs?expand=0&rev=313 --- ...Use-O_RDWR-to-fix-fstat-when-writing.patch | 67 +++++++++++++++++++ gvfs.changes | 6 ++ gvfs.spec | 3 + 3 files changed, 76 insertions(+) create mode 100644 gvfs-smb-Use-O_RDWR-to-fix-fstat-when-writing.patch diff --git a/gvfs-smb-Use-O_RDWR-to-fix-fstat-when-writing.patch b/gvfs-smb-Use-O_RDWR-to-fix-fstat-when-writing.patch new file mode 100644 index 0000000..f6b32bc --- /dev/null +++ b/gvfs-smb-Use-O_RDWR-to-fix-fstat-when-writing.patch @@ -0,0 +1,67 @@ +From 3f6f906c7c7b28dc30edb98200b6e13e1a513bb4 Mon Sep 17 00:00:00 2001 +From: Ondrej Holy +Date: Wed, 9 May 2018 12:54:59 +0200 +Subject: [PATCH] smb: Use O_RDWR to fix fstat when writing + +fstat fails with EINVAL on Windows servers if O_WRONLY is used to open +(though it works properly on SAMBA servers). O_RDWR is needed to make +it work. This causes issues when copying files over gvfsd-fuse among +others. + +https://bugzilla.gnome.org/show_bug.cgi?id=795805 +--- + daemon/gvfsbackendsmb.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c +index d4944197..9571fa0d 100644 +--- a/daemon/gvfsbackendsmb.c ++++ b/daemon/gvfsbackendsmb.c +@@ -808,7 +808,7 @@ do_create (GVfsBackend *backend, + smbc_open = smbc_getFunctionOpen (op_backend->smb_context); + errno = 0; + file = smbc_open (op_backend->smb_context, uri, +- O_CREAT|O_WRONLY|O_EXCL, 0666); ++ O_CREAT|O_RDWR|O_EXCL, 0666); + g_free (uri); + + if (file == NULL) +@@ -850,7 +850,7 @@ do_append_to (GVfsBackend *backend, + smbc_open = smbc_getFunctionOpen (op_backend->smb_context); + errno = 0; + file = smbc_open (op_backend->smb_context, uri, +- O_CREAT|O_WRONLY|O_APPEND, 0666); ++ O_CREAT|O_RDWR|O_APPEND, 0666); + g_free (uri); + + if (file == NULL) +@@ -916,7 +916,7 @@ open_tmpfile (GVfsBackendSmb *backend, + smbc_open = smbc_getFunctionOpen (backend->smb_context); + errno = 0; + file = smbc_open (backend->smb_context, tmp_uri, +- O_CREAT|O_WRONLY|O_EXCL, 0666); ++ O_CREAT|O_RDWR|O_EXCL, 0666); + } while (file == NULL && errno == EEXIST); + + g_free (dir_uri); +@@ -1040,7 +1040,7 @@ do_replace (GVfsBackend *backend, + + errno = 0; + file = smbc_open (op_backend->smb_context, uri, +- O_CREAT|O_WRONLY|O_EXCL, 0); ++ O_CREAT|O_RDWR|O_EXCL, 0); + if (file == NULL && errno != EEXIST) + { + int errsv = fixup_open_errno (errno); +@@ -1110,7 +1110,7 @@ do_replace (GVfsBackend *backend, + + errno = 0; + file = smbc_open (op_backend->smb_context, uri, +- O_CREAT|O_WRONLY|O_TRUNC, 0); ++ O_CREAT|O_RDWR|O_TRUNC, 0); + if (file == NULL) + { + int errsv = fixup_open_errno (errno); +-- +2.13.7 + diff --git a/gvfs.changes b/gvfs.changes index d2054bd..f6f4d41 100644 --- a/gvfs.changes +++ b/gvfs.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jun 8 09:38:55 UTC 2018 - fezhang@suse.com + +- Add gvfs-smb-Use-O_RDWR-to-fix-fstat-when-writing.patch: Fix + failures copying files on smb mounts (bgo#795805 boo#1096476). + ------------------------------------------------------------------- Mon May 7 09:55:50 UTC 2018 - bjorn.lie@gmail.com diff --git a/gvfs.spec b/gvfs.spec index f7a1dea..d7fe64a 100644 --- a/gvfs.spec +++ b/gvfs.spec @@ -27,6 +27,8 @@ Group: Development/Libraries/C and C++ URL: https://wiki.gnome.org/Projects/gvfs Source0: http://download.gnome.org/sources/gvfs/1.36/%{name}-%{version}.tar.xz Source99: baselibs.conf +# PATCH-FIX-UPSTREAM gvfs-smb-Use-O_RDWR-to-fix-fstat-when-writing.patch bgo#795805 boo#1096476 fezhang@suse.com -- Fix failures copying files on smb mounts +Patch1: gvfs-smb-Use-O_RDWR-to-fix-fstat-when-writing.patch ### NOTE: Please, keep SLE-only patches at bottom (starting on 1000). # PATCH-FEATURE-SLE gvfs-nds.patch ksamrat@novell.com -- Provides NDS browsing for nautilus Patch1000: gvfs-nds.patch @@ -164,6 +166,7 @@ gvfs plugins. %prep %setup -q translation-update-upstream +%patch1 -p1 %if !0%{?is_opensuse} %patch1000 -p1 %patch1001 -p1