[attr/f13/master] fixes for #587516, #650539, #660613 and #660619

Kamil Dudka kdudka at fedoraproject.org
Wed Jan 5 18:49:30 UTC 2011


commit 547bcf67cd9efc2802b3dae7cd6bccc36b951a03
Author: Kamil Dudka <kdudka at redhat.com>
Date:   Wed Dec 22 13:54:33 2010 +0100

    fixes for #587516, #650539, #660613 and #660619

 attr-2.4.44-bz587516.patch |   34 +++++++++++++++++++
 attr-2.4.44-bz650539.patch |   77 ++++++++++++++++++++++++++++++++++++++++++++
 attr-2.4.44-bz660613.patch |   50 ++++++++++++++++++++++++++++
 attr-2.4.44-bz660619.patch |   61 ++++++++++++++++++++++++++++++++++
 attr.spec                  |   25 ++++++++++++++-
 5 files changed, 246 insertions(+), 1 deletions(-)
---
diff --git a/attr-2.4.44-bz587516.patch b/attr-2.4.44-bz587516.patch
new file mode 100644
index 0000000..91011be
--- /dev/null
+++ b/attr-2.4.44-bz587516.patch
@@ -0,0 +1,34 @@
+From 846ca47a2411f33c8ca0572b0e565664d851fee4 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka <kdudka at redhat.com>
+Date: Fri, 19 Nov 2010 12:40:11 +0100
+Subject: [PATCH] setfattr.1: document supported encodings of values
+
+reported by Tomasz Kepczynski at https://bugzilla.redhat.com/58751
+---
+ man/man1/setfattr.1 |   10 +++++++++-
+ 1 files changed, 9 insertions(+), 1 deletions(-)
+
+diff --git a/man/man1/setfattr.1 b/man/man1/setfattr.1
+index c36b024..2d33f50 100644
+--- a/man/man1/setfattr.1
++++ b/man/man1/setfattr.1
+@@ -46,7 +46,15 @@ for each specified file.
+ Specifies the name of the extended attribute to set.
+ .TP
+ .BR \-v " \f2value\f1, " \-\-value "=\f2value\f1"
+-Specifies the new value for the extended attribute.
++Specifies the new value of the extended attribute. There are three methods
++available for encoding the value.  If the given string is enclosed in double
++quotes, the inner string is treated as text. In that case, backslashes and
++double quotes have special meanings and need to be escaped by a preceding
++backslash. Any control characters can be encoded as a backslash followed by
++three digits as its ASCII code in octal. If the given string begins with 0x or
++0X, it expresses a hexadecimal number. If the given string begins with 0s or
++0S, base64 encoding is expected.  See also the \-\-encoding option of
++getfattr(1).
+ .TP
+ .BR \-x " \f2name\f1, " \-\-remove "=\f2name\f1"
+ Remove the named extended attribute entirely.
+-- 
+1.7.3.3
+
diff --git a/attr-2.4.44-bz650539.patch b/attr-2.4.44-bz650539.patch
new file mode 100644
index 0000000..bb3b4e6
--- /dev/null
+++ b/attr-2.4.44-bz650539.patch
@@ -0,0 +1,77 @@
+From 7fed4441e12dc794c5eb6ae1798c8338548042ac Mon Sep 17 00:00:00 2001
+From: Kamil Dudka <kdudka at redhat.com>
+Date: Mon, 8 Nov 2010 10:17:02 -0500
+Subject: [PATCH 1/2] getfattr: encode NULs properly with --encoding=text
+
+reported by Paul Bolle at https://bugzilla.redhat.com/650539
+---
+ getfattr/getfattr.c |    6 ++++--
+ 1 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/getfattr/getfattr.c b/getfattr/getfattr.c
+index cae9c3f..9c3de32 100644
+--- a/getfattr/getfattr.c
++++ b/getfattr/getfattr.c
+@@ -133,7 +133,7 @@ const char *encode(const char *value, size_t *size)
+ 		size_t n, extra = 0;
+ 
+ 		for (e=(char *)value; e < value + *size; e++) {
+-			if (*e == '\n' || *e == '\r')
++			if (*e == '\0' || *e == '\n' || *e == '\r')
+ 				extra += 4;
+ 			else if (*e == '\\' || *e == '"')
+ 				extra++;
+@@ -147,7 +147,9 @@ const char *encode(const char *value, size_t *size)
+ 		e = encoded;
+ 		*e++='"';
+ 		for (n = 0; n < *size; n++, value++) {
+-			if (*value == '\n' || *value == '\r') {
++			if (*value == '\0' && n + 1 == *size)
++				break;
++			if (*value == '\0' || *value == '\n' || *value == '\r') {
+ 				*e++ = '\\';
+ 				*e++ = '0' + ((unsigned char)*value >> 6);
+ 				*e++ = '0' + (((unsigned char)*value & 070) >> 3);
+-- 
+1.7.3.3
+
+
+From 0a2d62b62a3aef601228232ee2e0133a3bbc510b Mon Sep 17 00:00:00 2001
+From: Andreas Gruenbacher <agruen at suse.de>
+Date: Tue, 23 Nov 2010 16:44:55 +0100
+Subject: [PATCH 2/2] OPTIONS in man pages should be a section heading, not a subsection heading
+
+---
+ man/man1/getfattr.1 |    2 +-
+ man/man1/setfattr.1 |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/man/man1/getfattr.1 b/man/man1/getfattr.1
+index 40f735d..53beb84 100644
+--- a/man/man1/getfattr.1
++++ b/man/man1/getfattr.1
+@@ -59,7 +59,7 @@ The remaining lines (lines 2 to 4 above) show the
+ and 
+ .I value
+ pairs associated with the specified file.
+-.SS OPTIONS
++.SH OPTIONS
+ .TP 4
+ .BR \-n " \f2name\f1, " \-\-name "=\f2name\f1"
+ Dump the value of the named extended attribute extended attribute.
+diff --git a/man/man1/setfattr.1 b/man/man1/setfattr.1
+index 2d33f50..ee54e06 100644
+--- a/man/man1/setfattr.1
++++ b/man/man1/setfattr.1
+@@ -40,7 +40,7 @@ command associates a new
+ with an extended attribute
+ .IR name
+ for each specified file.
+-.SS OPTIONS
++.SH OPTIONS
+ .TP 4
+ .BR \-n " \f2name\f1, " \-\-name "=\f2name\f1"
+ Specifies the name of the extended attribute to set.
+-- 
+1.7.3.3
+
diff --git a/attr-2.4.44-bz660613.patch b/attr-2.4.44-bz660613.patch
new file mode 100644
index 0000000..c7beda1
--- /dev/null
+++ b/attr-2.4.44-bz660613.patch
@@ -0,0 +1,50 @@
+From bad2f36467d1f606eb418542a23949743708304e Mon Sep 17 00:00:00 2001
+From: Kamil Dudka <kdudka at redhat.com>
+Date: Wed, 22 Dec 2010 15:03:48 +0100
+Subject: [PATCH] walk_tree: do not follow symlink to directory with -h
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+reported by Jean-Pierre André at https://bugzilla.redhat.com/660613
+---
+ libmisc/walk_tree.c |    3 ++-
+ test/attr.test      |    8 ++++++++
+ 2 files changed, 10 insertions(+), 1 deletions(-)
+
+diff --git a/libmisc/walk_tree.c b/libmisc/walk_tree.c
+index b82a301..e237e85 100644
+--- a/libmisc/walk_tree.c
++++ b/libmisc/walk_tree.c
+@@ -60,7 +60,8 @@ static int walk_tree_rec(const char *path, int walk_flags,
+ 				     void *), void *arg, int depth)
+ {
+ 	int follow_symlinks = (walk_flags & WALK_TREE_LOGICAL) ||
+-			      (!(walk_flags & WALK_TREE_PHYSICAL) &&
++			      ((walk_flags & WALK_TREE_DEREFERENCE) &&
++			       !(walk_flags & WALK_TREE_PHYSICAL) &&
+ 			       depth == 0);
+ 	int have_dir_stat = 0, flags = walk_flags, err;
+ 	struct entry_handle dir;
+diff --git a/test/attr.test b/test/attr.test
+index 10f10d0..a3e472d 100644
+--- a/test/attr.test
++++ b/test/attr.test
+@@ -221,6 +221,14 @@ Attributes of symlinks vs. the files pointed to
+ 
+ 	$ rm f
+ 
++Attributes of symlinks vs. the files pointed to in a directory
++
++	$ mkdir src
++	$ touch src/target
++	$ setfattr -n user.color -v blue src/target
++	$ ln -s src symlink
++	$ getfattr -n user.color -h symlink 2>/dev/null
++
+ Tests for file name that contain special characters
+ 
+ 	$ touch "f "
+-- 
+1.7.3.3
+
diff --git a/attr-2.4.44-bz660619.patch b/attr-2.4.44-bz660619.patch
new file mode 100644
index 0000000..9d13773
--- /dev/null
+++ b/attr-2.4.44-bz660619.patch
@@ -0,0 +1,61 @@
+From c3fa3829e494c1875416058bb8d448a89f9e5e55 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka <kdudka at redhat.com>
+Date: Wed, 22 Dec 2010 14:13:27 +0100
+Subject: [PATCH] getfattr: return non-zero exit code on failure
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+reported by Jean-Pierre André at https://bugzilla.redhat.com/660619
+---
+ getfattr/getfattr.c |    7 ++++---
+ test/attr.test      |    4 ++++
+ 2 files changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/getfattr/getfattr.c b/getfattr/getfattr.c
+index 7ced700..d8a7bc5 100644
+--- a/getfattr/getfattr.c
++++ b/getfattr/getfattr.c
+@@ -353,6 +353,7 @@ int do_print(const char *path, const struct stat *stat, int walk_flags,
+ 	     void *unused)
+ {
+ 	int header_printed = 0;
++	int err = 0;
+ 
+ 	if (walk_flags & WALK_TREE_FAILED) {
+ 		fprintf(stderr, "%s: %s: %s\n", progname, xquote(path, "\n\r"),
+@@ -361,13 +362,13 @@ int do_print(const char *path, const struct stat *stat, int walk_flags,
+ 	}
+ 
+ 	if (opt_name)
+-		print_attribute(path, opt_name, &header_printed);
++		err = print_attribute(path, opt_name, &header_printed);
+ 	else
+-		list_attributes(path, &header_printed);
++		err = list_attributes(path, &header_printed);
+ 
+ 	if (header_printed)
+ 		puts("");
+-	return 0;
++	return err;
+ }
+ 
+ void help(void)
+diff --git a/test/attr.test b/test/attr.test
+index e8f134c..10f10d0 100644
+--- a/test/attr.test
++++ b/test/attr.test
+@@ -22,6 +22,10 @@ Try various valid and invalid names
+ 	> user.name
+ 	> 
+ 	
++	$ setfattr -x user.name f
++	$ sh -c 'getfattr -n user.name f && echo zero exit code'
++	> f: user.name: No such attribute
++	
+ 	$ setfattr -n user.n -v value f
+ 	$ rm f
+ 
+-- 
+1.7.3.3
+
diff --git a/attr.spec b/attr.spec
index 4ed7b2c..156e36f 100644
--- a/attr.spec
+++ b/attr.spec
@@ -1,12 +1,25 @@
 Summary: Utilities for managing filesystem extended attributes
 Name: attr
 Version: 2.4.44
-Release: 3%{?dist}
+Release: 4%{?dist}
 Conflicts: xfsdump < 2.0.0
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Source: http://download.savannah.gnu.org/releases-noredirect/attr/attr-%{version}.src.tar.gz
 Patch2: attr-2.4.32-build.patch
 Patch3: attr-2.4.43-leak.patch
+
+# setfattr.1: document supported encodings of values (#587516)
+Patch5: attr-2.4.44-bz587516.patch
+
+# getfattr: encode NULs properly with --encoding=text (#650539)
+Patch6: attr-2.4.44-bz650539.patch
+
+# getfattr: return non-zero exit code on failure (#660619)
+Patch7: attr-2.4.44-bz660619.patch
+
+# walk_tree: do not follow symlink to directory with -h (#660613)
+Patch8: attr-2.4.44-bz660613.patch
+
 License: GPLv2+
 URL: http://oss.sgi.com/projects/xfs/
 Group: System Environment/Base
@@ -57,6 +70,10 @@ you'll also want to install attr.
 
 # applied upstream
 %patch3 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
 
 %build
 # attr abuses libexecdir
@@ -113,6 +130,12 @@ rm -rf $RPM_BUILD_ROOT
 /%{_lib}/libattr.so.*
 
 %changelog
+* Wed Jan 05 2011 Kamil Dudka <kdudka at redhat.com> 2.2.44-4
+- setfattr.1: document supported encodings of values (#587516)
+- getfattr: encode NULs properly with --encoding=text (#650539)
+- getfattr: return non-zero exit code on failure (#660619)
+- walk_tree: do not follow symlink to directory with -h (#660613)
+
 * Tue Jan 19 2010 Kamil Dudka <kdudka at redhat.com> 2.2.44-3
 - do not package a static library (#556038)
 - remove multilib patch no longer useful


More information about the scm-commits mailing list