vfs_fruit option fruit:resource

Ralph Böhme slow at samba.org
Thu Nov 10 13:38:09 UTC 2016


On Tue, Nov 08, 2016 at 02:15:51PM +0100, Ralph Böhme wrote:
> I'd prefer to wipe the slate as clean as possible, hopefully most
> people weren't setting "fruit:resource" to any non-default value
> anyway.
> 
> Option 1) that means for me, still thinking about it...

ok, so here's what I'd like to do: attached are two patches, one for
master and one for the 4.3-4.5 release branches.

The patch for master makes us accept both the wrong and the correct
spelling for the fruit:resource option. This is what will be used in
4.6. I've also added a WHATSNEW upgrading section.

The patch for 4.3-4.5 documents the mess but keeps the behavior: only
the wrong spelling is accepted.

I've added another small but important vfs_fruit manpage update to
both patches that is related to this option. I'd like to keep it
simple and put it into this patchset, hopefully that's ok.

Cheerio!
-slow
-------------- next part --------------
From 1ca5d3df1fb9afa18517842876b1be7db66fea51 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Tue, 8 Nov 2016 12:35:12 +0100
Subject: [PATCH 1/3] vfs_fruit: fix fruit:resource option spelling

Fix all occurences of bad spelling of "resource" as "res*s*ource" (two
s).

One of the places where this was wrong was when parsing parametric
options in the VFS connect() function in the module. As a result any
setting of

  fruit:resource=something

in smb.conf was silently ignored and the default ("file") was active.

In Samba 4.6 we accept both the wrong and the correct spelling, in Samba
4.7 the bad spelling will be removed.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12412

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 docs-xml/manpages/vfs_fruit.8.xml |  8 +++++++-
 selftest/target/Samba3.pm         |  2 +-
 selftest/target/Samba4.pm         |  2 +-
 source3/modules/vfs_fruit.c       | 31 ++++++++++++++++++++++++-------
 4 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/docs-xml/manpages/vfs_fruit.8.xml b/docs-xml/manpages/vfs_fruit.8.xml
index 7a84f87..5313137 100644
--- a/docs-xml/manpages/vfs_fruit.8.xml
+++ b/docs-xml/manpages/vfs_fruit.8.xml
@@ -86,7 +86,13 @@
 	  <varlistentry>
 	    <term>fruit:resource = [ file | xattr | stream ]</term>
 	    <listitem>
-	      <para>Controls where the OS X resource fork is stored:</para>
+	      <para>Controls where the OS X resource fork is stored.</para>
+
+	      <para>Due to a spelling bug in all Samba versions older then
+	      4.6.0, this option can also be given as
+	      <emphasis>fruit:ressource</emphasis>, ie with two s.</para>
+
+	      <para>Settings:</para>
 
 	      <itemizedlist>
 		<listitem><para><command>file (default)</command> - use a ._
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 3746d53..d0b8dfd 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1647,7 +1647,7 @@ sub provision($$$$$$$$)
 	path = $shrdir
 	vfs objects = catia fruit streams_xattr acl_xattr
 	ea support = yes
-	fruit:ressource = file
+	fruit:resource = file
 	fruit:metadata = netatalk
 	fruit:locking = netatalk
 	fruit:encoding = native
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index 40cca94..7a816f0 100755
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -937,7 +937,7 @@ sub provision($$$$$$$$$$)
 	path = $ctx->{share}
 	vfs objects = catia fruit streams_xattr acl_xattr
 	ea support = yes
-	fruit:ressource = file
+	fruit:resource = file
 	fruit:metadata = netatalk
 	fruit:locking = netatalk
 	fruit:encoding = native
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 6e7899aa..605b3e0 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -68,7 +68,7 @@
  *
  * The AFP_Resource stream is stored in an AppleDouble file prepending
  * "._" to the filename. On Solaris with ZFS the stream is optionally
- * stored in an EA "org.netatalk.ressource".
+ * stored in an EA "org.netatalk.resource".
  *
  *
  * Extended Attributes
@@ -378,7 +378,7 @@ struct ad_entry_order entry_order_meta_xattr[ADEID_NUM_XATTR + 1] = {
 	{0, 0, 0}
 };
 
-/* AppleDouble ressource fork file (the ones prefixed by "._") */
+/* AppleDouble resource fork file (the ones prefixed by "._") */
 static const
 struct ad_entry_order entry_order_dot_und[ADEID_NUM_DOT_UND + 1] = {
 	{ADEID_FINDERI,    ADEDOFF_FINDERI_DOT_UND,  ADEDLEN_FINDERI},
@@ -387,8 +387,8 @@ struct ad_entry_order entry_order_dot_und[ADEID_NUM_DOT_UND + 1] = {
 };
 
 /*
- * Fake AppleDouble entry oder for ressource fork xattr.  The xattr
- * isn't an AppleDouble file, it simply contains the ressource data,
+ * Fake AppleDouble entry oder for resource fork xattr.  The xattr
+ * isn't an AppleDouble file, it simply contains the resource data,
  * but in order to be able to use some API calls like ad_getentryoff()
  * we build a fake/helper struct adouble with this entry order struct.
  */
@@ -926,7 +926,7 @@ static ssize_t ad_header_read_rsrc(struct adouble *ad, const char *path)
 		/* Now parse entries */
 		ok = ad_unpack(ad, ADEID_NUM_DOT_UND, sbuf.st_ex_size);
 		if (!ok) {
-			DEBUG(1, ("invalid AppleDouble ressource %s\n", path));
+			DEBUG(1, ("invalid AppleDouble resource %s\n", path));
 			errno = EINVAL;
 			rc = -1;
 			goto exit;
@@ -938,7 +938,7 @@ static ssize_t ad_header_read_rsrc(struct adouble *ad, const char *path)
 			< ADEDLEN_FINDERI)
 		    || (ad_getentryoff(ad, ADEID_RFORK)
 			< ADEDOFF_RFORK_DOT_UND)) {
-			DEBUG(2, ("invalid AppleDouble ressource %s\n", path));
+			DEBUG(2, ("invalid AppleDouble resource %s\n", path));
 			errno = EINVAL;
 			rc = -1;
 			goto exit;
@@ -1309,10 +1309,27 @@ static int init_fruit_config(vfs_handle_struct *handle)
 		return -1;
 	}
 
+	/*
+	 * Versions up to Samba 4.5.x had a spelling bug in the
+	 * fruit:resource option calling lp_parm_enum with
+	 * "res*s*ource" (ie two s).
+	 *
+	 * In Samba 4.6 we accept both the wrong and the correct
+	 * spelling, in Samba 4.7 the bad spelling will be removed.
+	 */
 	enumval = lp_parm_enum(SNUM(handle->conn), FRUIT_PARAM_TYPE_NAME,
 			       "ressource", fruit_rsrc, FRUIT_RSRC_ADFILE);
 	if (enumval == -1) {
-		DEBUG(1, ("value for %s: ressource type unknown\n",
+		DEBUG(1, ("value for %s: resource type unknown\n",
+			  FRUIT_PARAM_TYPE_NAME));
+		return -1;
+	}
+	config->rsrc = (enum fruit_rsrc)enumval;
+
+	enumval = lp_parm_enum(SNUM(handle->conn), FRUIT_PARAM_TYPE_NAME,
+			       "resource", fruit_rsrc, enumval);
+	if (enumval == -1) {
+		DEBUG(1, ("value for %s: resource type unknown\n",
 			  FRUIT_PARAM_TYPE_NAME));
 		return -1;
 	}
-- 
2.7.4


From 78dd22ba37f9e06408427e52310b7fc9393344d6 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Thu, 10 Nov 2016 14:01:16 +0100
Subject: [PATCH 2/3] WHATSNEW: document fruit:resource option spelling issue

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 WHATSNEW.txt | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 6b96cae..bf8a6e7 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -12,6 +12,23 @@ Samba 4.6 will be the next version of the Samba suite.
 UPGRADING
 =========
 
+vfs_fruit option "fruit:resource" spelling correction
+-----------------------------------------------------
+
+Due to a spelling error in the vfs_fruit option parsing for the "fruit:resource"
+option, users who have set this option in their smb.conf were still using the
+default setting "fruit:resource = file" as the parser was looking for the string
+"fruit:ressource" (two "s").
+
+After upgrading to this Samba version 4.6, you MUST either remove the option
+from your smb.conf or set it to the default "fruit:resource = file", otherwise
+your macOS clients will not be able to access the resource fork data.
+
+This version Samba 4.6 accepts both the correct and incorrect spelling, but the
+next Samba version 4.7 will not accept the wrong spelling.
+
+Users who were using the wrong spelling "ressource" with two "s" can keep the
+setting, but are advised to switch to the correct spelling.
 
 NEW FEATURES/CHANGES
 ====================
@@ -26,7 +43,7 @@ smb.conf changes
 
   Parameter Name                Description             Default
   --------------                -----------             -------
-
+  fruit:resource                Spelling correction
 
 KNOWN ISSUES
 ============
-- 
2.7.4


From c75d7c87b7a32ef6948b53b51d838e1e6139abcc Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Thu, 10 Nov 2016 09:07:41 +0100
Subject: [PATCH 3/3] manpages/vfs_fruit: add warning to fruit:resoure=stream

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12412

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 docs-xml/manpages/vfs_fruit.8.xml | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/docs-xml/manpages/vfs_fruit.8.xml b/docs-xml/manpages/vfs_fruit.8.xml
index 5313137..fe0cd3c 100644
--- a/docs-xml/manpages/vfs_fruit.8.xml
+++ b/docs-xml/manpages/vfs_fruit.8.xml
@@ -105,9 +105,12 @@
 		down to Solaris and derived platforms and
 		ZFS</para></listitem>
 
-		<listitem><para><command>stream</command> - pass the
-		stream on to the next module in the VFS
-		stack</para></listitem>
+		<listitem><para><command>stream (experimental)</command> - pass
+		the stream on to the next module in the VFS stack.
+		<emphasis>Warning: </emphasis> this option should not be used
+		with the <emphasis>streams_xattr</emphasis> module due to the
+		extended attributes size limitations of most
+		filesytems.</para></listitem>
 	      </itemizedlist>
 
 	    </listitem>
-- 
2.7.4

-------------- next part --------------
From 35a58e6182535ba9483a95c65e39053a0d901e77 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Thu, 10 Nov 2016 08:57:12 +0100
Subject: [PATCH 1/2] manpages/vfs_fruit: fruit:resource option misspelling

Due to a misspelling in the option parser in all Samba versions up to
and including 4.5.1 this options must be given "fruit:ressource", ie
with two "s".

Samba 4.6 will accept both the correct the correct and the wrong
spelling, Samba 4.7 onwards will only accept the correct
spelling.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12412

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 docs-xml/manpages/vfs_fruit.8.xml | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/docs-xml/manpages/vfs_fruit.8.xml b/docs-xml/manpages/vfs_fruit.8.xml
index 0d97e58..c54bdd2 100644
--- a/docs-xml/manpages/vfs_fruit.8.xml
+++ b/docs-xml/manpages/vfs_fruit.8.xml
@@ -86,7 +86,27 @@
 	  <varlistentry>
 	    <term>fruit:resource = [ file | xattr | stream ]</term>
 	    <listitem>
-	      <para>Controls where the OS X resource fork is stored:</para>
+	      <para>Controls where the OS X resource fork is stored.</para>
+
+	      <para><emphasis>Important: </emphasis>Due to a
+	      misspelling in the option parser in all Samba versions
+	      4.5 and earlier, this options must be given as
+	      <emphasis>fruit:ressource</emphasis>, ie with two
+	      <emphasis>s</emphasis>.</para>
+
+	      <para>Users who set this opion to any non-default
+	      setting were still using the default setting of
+	      <emphasis>file</emphasis> and are advised to adjust
+	      their smb.conf to reflect the effective setting and set
+	      <emphasis>fruit:ressource=file</emphasis> in their
+	      smb.conf. Removing the option line altogether works as
+	      well.</para>
+
+	      <para>Samba 4.6 will accept both the correct and the
+	      wrong spelling, from Samba 4.7 onwards only the correct
+	      spelling will be accepted.</para>
+
+	      <para>Settings:</para>
 
 	      <itemizedlist>
 		<listitem><para><command>file (default)</command> - use a ._
-- 
2.7.4


From 4581712bb2bcac136ffcfe1d0321b85661f17d1d Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Thu, 10 Nov 2016 09:07:41 +0100
Subject: [PATCH 2/2] manpages/vfs_fruit: add warning to fruit:resoure=stream

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12412

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 docs-xml/manpages/vfs_fruit.8.xml | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/docs-xml/manpages/vfs_fruit.8.xml b/docs-xml/manpages/vfs_fruit.8.xml
index c54bdd2..a0b3893 100644
--- a/docs-xml/manpages/vfs_fruit.8.xml
+++ b/docs-xml/manpages/vfs_fruit.8.xml
@@ -119,9 +119,12 @@
 		down to Solaris and derived platforms and
 		ZFS</para></listitem>
 
-		<listitem><para><command>stream</command> - pass the
-		stream on to the next module in the VFS
-		stack</para></listitem>
+		<listitem><para><command>stream (experimental)</command> - pass
+		the stream on to the next module in the VFS stack.
+		<emphasis>Warning: </emphasis> this option should not be used
+		with the <emphasis>streams_xattr</emphasis> module due to the
+		extended attributes size limitations of most
+		filesytems.</para></listitem>
 	      </itemizedlist>
 
 	    </listitem>
-- 
2.7.4



More information about the samba-technical mailing list