Unit tests for chain_xattr.cc

Create a new test file covering most (> 97%) of src/os/chain_xattr.{cc,h}
lines of code. The following functions are tested:

int chain_getxattr(const char *fn, const char *name, void *val, size_t size);
int chain_fgetxattr(int fd, const char *name, void *val, size_t size);
int chain_setxattr(const char *fn, const char *name, const void *val, size_t size);
int chain_fsetxattr(int fd, const char *name, const void *val, size_t size);
int chain_listxattr(const char *fn, char *names, size_t len);
int chain_flistxattr(int fd, char *names, size_t len);
int chain_removexattr(const char *fn, const char *name);
int chain_fremovexattr(int fd, const char *name);

The function translate_raw_name substitutes @@ into @. When the trailing
character is a @, it breaks. However, such an occurence cannot be created by
chain_setxattr because it always create pairs of @. Instead of silently
breaking the loop, the function should probably return on error so that the
caller can ignore it.

The function chain_fgetxattr_len may return on error if fgetxattr
returns on error. However, it is only called after another attr function
returned success and the tests cannot create the conditions under which
it would fail.

The function chain_fsetxattr may leak attributes when used to override
an existing attribute. This leak is not tested or fixed, it is just
discussed in http://marc.info/?l=ceph-devel&m=136027076615853&w=4

If the file system in which the tests are run does not support extended
attributes, the tests are not run. The detection uses the same logic as
the one implemented in FileStore::_detect_fs

The output of the tests are silenced to reduce the output when testing
assertions ( except for the dout_emergency function which cannot be
controlled).
fix buffer::list::zero(unsigned o, unsigned l) to act on all buffer::ptr

When buffer::list::zero was called on a buffer::list with "ABC" and
"DEF" in two different buffer::ptr with buffer::list::zero(4, 1) it
did nothing. The expected result is that the "DEF" buffer::ptr is
modified to "D\0F"

The test to check if the pointer is past the end of range to be zeroed
was reversed. It was o+l >= p which would always be true if the range
spans over the first buffer::ptr . It must be "o+l <= p" meaning the
pointer is past the end of the range and there is no need to loop over
the remaining buffer::ptr in the buffer::list

The p+it->length() >= o+l part of the if (p >= o && p+it->length() >=
o+l) test was also reversed. When called on "ABC" with zero(0, 1) it
would match because the range to be zeroed is contained in the
buffer::ptr. The call to it->zero() would zero the entire buffer::ptr
instead of just the first character.

unit tests are added to demonstrate the two problems with the previous
code and show that the patch fixes them.

http://tracker.ceph.com/issues/4123 refs #4123

Signed-off-by: Loic Dachary <loic@dachary.org>
LDADD PTHREAD_LIBS to fix librados-config linking

librados-config depends on libglobal which in turn
reference symbols in pthread; this caused issues
when linking due to the indirect dependency via
libglobal.

Signed-off-by: James Page <james.page@ubuntu.com>
ceph.spec.in: cleanup requirements of fuse packages

Cleanup the Requires: list of the fuse packages. Remove fuse-libs,
libstdc++, libuuid. Don't add libraries to the list, the RPM build
system will find the dependencies by itself.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
ceph.spec.in: remove librados2 requirement from librbd1

Remove librados2 requirement from librbd1. The RPM build system
will find the dependency by itself.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
doc: Move pool=... syntax inside of single quotes

When specifying caps, the entire 'allow ...' bit needs to be in the
single quotes, including the pool= part.

Signed-off-by: Travis Rhoden <trhoden@gmail.com>
doc: Update create example to use 'allow ' syntax

The ceph auth get-or-create example here is the only place on the
page that does not use 'allow <perms.' syntax.  I found that
confusing.  Update to use allow and single quotes.

Signed-off-by: Travis Rhoden <trhoden@gmail.com>
Merge pull request #55 from dalgaaf/wip-da-cleanup-specfile

Cleanup some requirements of spec file

Reviewed-by: Sage Weil <sage@inktank.com>
Merge pull request #56 from trhoden/doc_cephx

Make cephx key creation syntax consistent

Reviewed-by: Sage Weil <sage@inktank.com>
Merge pull request #54 from javacruft/wip-pthread-linking

LDADD PTHREAD_LIBS to fix librados-config linking

Reviewed-by: Sage Weil <sage@inktank.com>
Merge pull request #53 from dachary/wip-4123

fix buffer::list::zero(unsigned o, unsigned l) to act on all buffer::ptr

Backport: bobtail
Reviewed-by: Sage Weil <sage@inktank.com>
init-ceph.in: create pid and log dir only on start

Create pid and log dir only on start and not e.g. also on
stop. These calls are useless in other situtations than startup
the cluster or process.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
ceph_common.sh: check if $sshdir exist, otherwise create it

Check if $sshdir exist. If not, create it before cd to the
directory.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
init-ceph.in: replace "/var/run/" by already used $RUN_DIR

Fix handling of admin socket. The current script already use
$RUN_DIR to define a default, which is /var/run. Replace the
explicit path from get_conf call and replace it with $RUN_DIR.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Merge pull request #57 from dalgaaf/wip-da-mkcephfs-init-2

Fix some init/mkcephfs related issues

Reviewed-by: Sage Weil <sage@inktank.com>
Merge pull request #40 from dachary/master

Unit tests for chain_xattr.cc

Reviewed-by: Sage Weil <sage@inktank.com>