attr: fixes for #587516 and #650539

This commit is contained in:
Kamil Dudka 2010-12-22 13:54:33 +01:00
commit eb93a8c671
3 changed files with 123 additions and 0 deletions

View file

@ -0,0 +1,34 @@
From 846ca47a2411f33c8ca0572b0e565664d851fee4 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@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

View file

@ -0,0 +1,77 @@
From 7fed4441e12dc794c5eb6ae1798c8338548042ac Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@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@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

View file

@ -21,6 +21,12 @@ Patch3: attr-2.4.44-tests.patch
# silence compile-time warnings
Patch4: attr-2.4.44-warnings.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
License: GPLv2+
URL: http://oss.sgi.com/projects/xfs/
Group: System Environment/Base
@ -70,6 +76,8 @@ you'll also want to install attr.
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
# test-suite helper script
install -m0755 %{SOURCE2} test/
@ -147,6 +155,10 @@ rm -rf $RPM_BUILD_ROOT
/%{_lib}/libattr.so.*
%changelog
* Wed Dec 22 2010 Kamil Dudka <kdudka@redhat.com> 2.2.44-6
- setfattr.1: document supported encodings of values (#587516)
- getfattr: encode NULs properly with --encoding=text (#650539)
* Tue May 25 2010 Kamil Dudka <kdudka@redhat.com> 2.2.44-5
- let attr depend on the same version of libattr (#595689)
- silence compile-time warnings