From: "H. Peter Anvin" <hpa@zytor.com>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: Honor extractor's umask in git-tar-tree.
Date: Mon, 03 Oct 2005 09:30:18 -0700 [thread overview]
Message-ID: <43415C9A.1090502@zytor.com> (raw)
In-Reply-To: <7virwfuqwv.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
> "H. Peter Anvin" <hpa@zytor.com> writes:
>
>
>>My point is that I believe it should. It has the bitfield for it, it
>>just doesn't use it at the moment.
>
>
> It is a bit more complicated than that.
>
> Long time ago, we used to store the full permission bits and
> ended up storing files in 0644 and 0664 modes, depending on who
> is writing the tree object. People with umask 022 checked out
> from a tree that recorded blobs with 0664 bits and ended up
> getting "mode changed" diff all the time, which was unacceptable
> from the SCM point of view. We _could_ have really changed the
> mode bits representation in the tree objects back then to have
> type + executable bit, but to preserve backward compatibility,
> we chose to keep the bitfield layout and changed the code to
> treat 1006xx and 1007yy in older trees to be equivalent to
> 100644 and 100755. These days, for newly written tree objects,
> above xx and yy 6-bit fields are "Must Be 4" and "Must Be 5"
> fields, respectively, not bitfields to store arbitrary group and
> other permission information. git-fsck-objects even complains
> about them.
>
> So in that sense, it does _not_ have the bitfield for it, and
> obviously we cannot use what we do not have.
>
Welcome to the wonderful world of evolving file formats.
As you stated above, we currently use this field in a very inefficient
manner, because of old mistakes. There are several ways to recover from
here, some of which are more complex than others.
In the case of git, there isn't just the requirement to maintain old
formats indefinitely (due to the cryptographic chain), but also that new
objects that are compatible with old format should be written in the old
format to maintain the aliasing properties. These are obstacles that
are perfectly possible to overcome, although it takes a bit of legwork.
If the old-format (with random write bits) is out of circulation --
which I can't tell for sure they it is, but Linus' kernel tree doesn't
seem to have any of these objects -- then the answer is very simple:
redefine this field _a posteori_ to be the mode ^ 022 (or perhaps more
sanely,
mode ^ (mode & 0200 ? 022 : 0)). Compatibility and contents is fully
preserved. No problem.
If there are still old-format trees in circulation and compatibility
with these very old trees need to be maintained, then it's a bit more
complicated, but literally just a bit. This data is already stored in
text form in the object store, so there aren't any funnies with
expanding it. For example, encode a leading + on the octal value if
this is a value with "I really mean it" permissions (and *only* those
values.) This is even readable by older versions of git, since they
will just blindly ignore the + sign.
-hpa
next prev parent reply other threads:[~2005-10-03 16:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-30 16:03 Destructive side-effect of "cg-status" Wolfgang Denk
2005-10-01 10:24 ` Martin Langhoff
2005-10-01 16:41 ` Linus Torvalds
2005-10-01 18:14 ` Junio C Hamano
2005-10-01 19:07 ` Honor extractor's umask in git-tar-tree Junio C Hamano
2005-10-02 3:24 ` H. Peter Anvin
2005-10-02 9:55 ` Matthias Urlichs
2005-10-03 4:44 ` H. Peter Anvin
2005-10-03 5:10 ` Junio C Hamano
2005-10-03 16:30 ` H. Peter Anvin [this message]
2005-10-03 17:18 ` Junio C Hamano
2005-10-03 17:28 ` H. Peter Anvin
2005-10-03 17:45 ` Linus Torvalds
2005-10-03 18:05 ` H. Peter Anvin
2005-10-03 18:18 ` Linus Torvalds
2005-10-03 18:32 ` H. Peter Anvin
2005-10-01 19:42 ` Destructive side-effect of "cg-status" Wolfgang Denk
2005-10-01 20:24 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43415C9A.1090502@zytor.com \
--to=hpa@zytor.com \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).