On 12/10/06, Kyle Moffett <mrmacman_g4@xxxxxxx> wrote:
I've recently become somewhat interested in the idea of using GIT
to store the contents of various folders in /etc. However after a
bit of playing with this, I discovered that GIT doesn't actually
preserve all permission bits since that would cause problems with
the more traditional software development model. I'm curious if
anyone has done this before; and if so, how they went about
handling the permissions and ownership issues.
I spent a little time looking over how GIT stores and compares
permission bits; trying to figure out if it's possible to patch in
a new configuration variable or two; say "preserve_all_perms" and
"preserve_owner", or maybe even "save_acls". It looks like
standard permission preservation is fairly basic; you would just
need to patch a few routines which alter the permissions read in
from disk or compare them with ones from the database. On the
other hand, it would appear that preserving ownership or full
POSIX ACLs might be a bit of a challenge.
On Dec 10, 2006, at 10:06:14, Santi Béjar wrote:
I have not used it, but you could try:
http://www.isisetup.ch/
that uses git as a backend.
Wow, umm, that's actually really interesting for me, given that I'm
most interested in these sorts of things on Debian. I can't find
much documentation on their site; the tools look vaguely immature but
I haven't really had much time to look at it yet.
On Dec 10, 2006, at 09:49:50, Jeff Garzik wrote:
It's a great idea, something I would like to do, and something I've
suggested before. You could dig through the mailing list archives,
if you're motivated.
I have been digging through the archives; I was just holding out hope
that somebody else on the list had already halfway beat me to the
punch. Guess not :-D
I actively use git to version, store and distribute an exim mail
configuration across six servers. So far my solution has been a
'fix perms' script, or using the file perm checking capabilities of
cfengine.
But it would be a lot better if git natively cared about ownership
and permissions (presumably via an option).
I was thinking about a standard config option in the GIT config file,
that way users could have a personal default and repositories could
specify it locally.
I started tinkering but quickly discovered that permissions handling
in general in GIT seems to be a mess; there's about 4 different tiers
where permissions data is manipulated in various formats. Some
places use network-endian 16-bit values, there's a couple functions
which do different truncations to 644 or 755 format. There are 2
functions which canonicalize the file mode based on symlink or
directory status, each in subtly different ways.
I'm slowly sorting through things but if I could get a few pointers
from someone intimately familiar with the code that would be most
appreciated: I'd like to try to add new entries to tree objects
which older versions of GIT would ignore but which newer versions of
GIT would use to store ACL or extended-attribute data.
The simplest solution which admittedly breaks the ability of older
GITs to read the data from a file with attributes (ignoring the ext-
attrs themselves) is to create a new "file-with-extended-attributes"
object which contains a binary concatenation (with length bytes and
attribute names and such) of the file and its extended attributes.
That breaks the old GIT assumption that permission and security data
is part of the directory not the file, but it's more in-line with the
way extended attributes are attached to the inodes in the filesystem
(although that doesn't really matter IMO).
Alternatively I might be able to add a new entry to each tree object
with invalid extended file mods bits (IE: Neither a directory, a
file, nor a symlink), or perhaps an entry with an empty name, which
points to a new "extended attribute table". That table could either
map from (entry, attribute) => (data) or from (entry) =>
((attribute,data),(attribute,data),[...]), depending on which would
be more efficient. It's essential that the overhead for non-ext-attr
repositories is O(1) and ideally the overhead for a bunch of files
with the same ext-attr is O(size-of-ext-attr) + O(number-of-files-
with-that-attr), although that may vary depending on implementation.
Advice, opinions, problems, and "this-has-no-chance-of-ever-even-
remotely-working" are all useful and welcome!
Cheers,
Kyle Moffett
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html