[PATCH] Fix nasty vfs_fruit bug 13646

Jeremy Allison jra at samba.org
Tue Oct 30 22:38:02 UTC 2018


On Fri, Oct 26, 2018 at 04:59:24PM +0200, Ralph Böhme via samba-technical wrote:
> On Wed, Oct 24, 2018 at 12:09:36PM -0700, Jeremy Allison wrote:
> > On Tue, Oct 23, 2018 at 05:54:08PM +0200, Ralph Böhme via samba-technical wrote:
> > > Hi!
> > > 
> > > Attached is a somewhat largish patchset to fix bug 13646.
> > > 
> > > It got this big as I'm expanding existing tests and adding a new large one,
> > > trying very hard to test all possible combinations of resetting the a stream
> > > on one handle and testing the outcome on the same and different handles.
> > > 
> > > At the base this patchset fixes the problem introduced by the patches for
> > > bug 13441. There I added a change to unlink a stream in the VFS ftruncate
> > > function if offset=0.
> > > 
> > > As SMB_VFS_FTRUNCATE with offset=0 may also be called at create time with
> > > create dispostion OVERWRITE, this does more bad then good and caused real
> > > world application problems like MS Excel not being able to save. :/
> > > 
> > > Simply reverting the change from bug 13441 was not really an option as that
> > > would have reintroduced the problems 13441 was trying to fix.
> > > 
> > > Hopefully this patchset does a better job. I've therefor added a new large
> > > test that covers the subtle cases and I've did some manual end-to-end
> > > testing with Excel, Word, Photoshop and Finder Tags.
> > > 
> > > Please review&push if happy. Thanks!
> > > 
> > > CI: https://gitlab.com/samba-team/devel/samba/pipelines/34033409
> > > 
> > > Oh, and please apply the fruit patchsets in the order of appearance on the list:
> > > 
> > > [PATCH] Follow-up fix for bug 13649
> > > [PATCH] Add optional AppleDouble cleanup to vfs_fruit
> > > ...this one...
> > 
> > Out at the Linux Foundation Edinburgh show until the end
> > of the week. I'll try and get to these as soon as I'm
> > back (and not jet-lagged anymore :-), sorry.
> 
> thanks!
> 
> Turned out the order was not really correct as this patchset wasn't rebased
> onto the other ones.
> 
> Updated, rebased patchset attached.

Ralph, there's a compile bug in this patch:

PATCH 28/34] vfs_fruit: prepare fruit_pread_meta() for reading on fake-fd

in this hunk:

+       if (nread == -1 && fio->created) {
+               AfpInfo *ai = NULL;
+               char afpinfo_buf[AFP_INFO_SIZE];
+
+               ai = afpinfo_new(talloc_tos());
+               if (ai == NULL) {
+                       return -1;
+               }
+
+               nread = afpinfo_pack(ai, afpinfo_buf);
+               TALLOC_FREE(ai);
+               if (nread != AFP_INFO_SIZE) {
+                       return -1;
+               }
+
+               memcpy(data, afpinfo_buf, to_return);
+               return nread;
+       }

'to_return' is not defined here. I think the last
lines shoud read:

+               nread = MIN(n, nread);
+               memcpy(data, afpinfo_buf, nread);
+               return nread;
+       }

can you confirm ?

Jeremy.



More information about the samba-technical mailing list