Eric Bollengier [Fri, 10 Feb 2012 16:32:10 +0000 (17:32 +0100)]
Remove bad optimization from Accurate code
By returning "already seen", we didn't reply to the original question:
has the file changed (must be backed up)?
If your fileset contains two Include {} sections the second Include may ask for
the same files than the first Include, and depending on Exclude, Wild, etc..
the answer may be "Already Seen" even if the file needs to be saved. From what
I can see, Wild/Exclude are called after the accurate check.
The errno gets saved on an instantiate of the berrno class so
we should instantiate the class after the actual errno is set
and not as we used to do at the start of the function. Then
errno is always 0 and that also explains that on error it
was always printing Unknown error 0 in the error printed.
Moved all berrno into either an if block or an block within
a switch (including additional brackets so it a local code
block in which we can instantiate a new berrno class.
On Linux the actual rootfs gets mounted over an initial
rootfs. The mountcache on Linux is populated with the
content of /proc/mounts and as such it will contain 2
entries for the rootfs. So when the fstype function
is used to lookup the type of filesystem based on
the dev_t value it will always find the rootfs first.
But people expect to find either ext2, ext3 etc.
so we added a table with per OS (currently only Linux)
the filesystem which should NOT be loaded into the
internal lookup table.
The selection in MediaView::getSelection doesn't work ok as
the internal table is sized using the number of selected items
and not the number of rows in the total table. But the table
is indexed using a row number which can be any rownr of the
total of the table. Things seen is that 3 rows are selected
but the selection only returns 2. This is probably a side effect
because the code could also just have crashed as nb = 16 and
rownr = 29-31 e.g. addressed outside the bounds of the array.
Changed the internal array to use bools instead of ints so
its also somewhat smaller.
We allow to specify the SONAME in a library so we can create
a libbaccats-<backend>-<version>.so which has an internal
soname of libbaccats-<version>.so This way each catalog
backend is a direct replacement of the dummy libbaccats
library and copying and linking works without the ldconfig
trying to be to smart. When no symlink exists ldconfig
will create one (it might point to the wrong one however)
but if you only install one it cannot go wrong. Also a
nice side effect is that if we create the symlink ldconfig
now doesn't replace it with a new one as it thinks its a
stale or wrong link.
install-default-backend is updated to create the symlink
in the same way that ldconfig does and point to the
libbaccats-<backend>.so which points to
libbaccats-<backend>-<version>.so
Only acl pointer can be NULL in call to aclx_get with GET_ACLINFO_ONLY
set not the mode pointer. Implemented alternative version of nfsv4
acl is trivial function borrowed from gnulib. For restores we check
the destination filesystem if it supports the type of acl being
restored against the list of available acl types returned by
aclx_gettypes.
Fix bug #1811 Filed fails to backup more then one xattr.
On Solaris we fail to backup more then one xattr. There
are two serious wrong tests in the code that seem to predate
switch to the new bxattr_exit_* codes. Due to a side effect
the retval variable only gets set to a non 0 value
(bxattr_exit_ok) when the first xattr is saved as then the
hidden directory is saved and as such the retval
is set.
While scanning through the code for possible other retval
initialization errors and wrong code I fixed one other problem
in the Tru64 xattr code which we probably never encounter
as that platform is kind of dying.
- With the new delayed restore of xattr and acl streams we
copy the stream twice. First from the SD buffer to the
stack and then again from the stack when we pop an element
into a JCR POOLMEM. This can be done a bit more efficient.
So we break the JCR struct into an union one for a build
of xattr and acl streams and one for a parse of them.
We pass the content and content_length now as arguments
along the parse (restore) code path. This saves for the
delayed version one copy and for a directory copying
is not done at all.
- Reformatted some code along the way,
- functions with more then 2 arguments are splitted
over multiple lines.
- The stream arrays etc are formated a bit
differently so they are better readable and easy
to extend.
- The build and parse function pointers are
formated a bit differently so they span
multiple lines and should be better readable.
- reformated long lines
- Fixed Tru64 acl code.
Put the restore of xattr and acl streams on a restore stack
which gets popped after the actual file properties are restored.
As directories are never extracted those are excluded from
the delayed restore stack and have their streams processed
when we receive them.
This way we don't clobber the security info due to executing
chown and chmod calls on the restored file. We now first
restore the whole file and properties and then all of its
acls and extended attributes.
We only exclude the Solaris extended attribute streams as we
could have multiple of those with the maximum size and that
would use to much internal memory. For all other platforms
we only have one xattr stream with a maximum of 1 Mb so that
doesn't put to much stress on the filed. Solaris extensible
attributes are delayed restored. Restoring the Solaris
native extended attributes early should be no problem as they
are restored into a seperate namingspace and have file like
content. Security specific info is stored in extensible
attributes and those are delayed restored.
ACL streams are all so small that it makes no sense to
exclude them and we really want to always extract acl streams
after doing a chown and chmod because otherwise we might
reset the acl being restored earlier.