threads / discuss / 27607

file mode

Subject: file mode

## tl;dr

9 messages between Jun 12, 2011 and Jun 14, 2011.

replies: 8people: 5as markdown or json

Peter Kleiweg· Jun 12, 2011, 18:57 UTC · lore

I added a file that has file mode 600. When I do a check-out, the file comes with mode 644. Is this supposed to happen? Then how do I control what permissions files have?

-- 
Peter Kleiweg
http://pkleiweg.home.xs4all.nl/
Michael Witten· Jun 12, 2011, 19:12 UTC · re: Peter Kleiweg · lore

Re: file mode

On Sun, Jun 12, 2011 at 18:57, Peter Kleiweg <pkleiweg@xs4all.nl> wrote:
> I added a file that has file mode 600. When I do a check-out,
> the file comes with mode 644. Is this supposed to happen? Then
> how do I control what permissions files have?
Do some googling.
Jeff King· Jun 13, 2011, 05:38 UTC · re: Michael Witten · lore

Re: file mode

On Sun, Jun 12, 2011 at 07:12:42PM +0000, Michael Witten wrote:
Show 6 quoted lines
> On Sun, Jun 12, 2011 at 18:57, Peter Kleiweg <pkleiweg@xs4all.nl> wrote:
> > I added a file that has file mode 600. When I do a check-out,
> > the file comes with mode 644. Is this supposed to happen? Then
> > how do I control what permissions files have?
> 
> Do some googling.

I really don't see the point of a response like this. It is one thing to rudely point somebody to lmgtfy or an FAQ link. Then you're still being rude, but at least you are pointing them in the right direction. But this seems simply to make the list a less pleasant place _and_ to be totally useless to the original poster. If you didn't want to give the answer, wouldn't it have been better not to respond at all?

Peter:

This is by design. While the git data structure can technically store unix mode bits in its trees, it was found early on in git's history that respecting anything beyond a simple executable bit ended up being more cumbersome for git's normal use cases (i.e., people storing code or other shared files in a repository).

We could add in a config option to respect file modes, but it has generally been seen as not worthwhile. It solves only a part of the general metadata problem, as it omits owner and group names or ids, as well as extended metadata like ACLs.

If modes are important to you, the suggested fixes are one of:
  1. Use a tool like "metastore" that can be called from git hooks, and
     will save and restore file permissions in a file that is tracked in
     the repository. Do note that when using such a tool there is a race
     condition in protecting files (i.e., git will create your file as
     644, and then metastore will correct it to 600; in the meantime,
     somebody could read your file).
  2. Depending on exactly what you're storing, it may make sense to keep
     your repository in another directory, protected by permissions, and
     then use a separate tool to deploy your files from the repository
     to their ultimate location (e.g., a Makefile or other install
     tool).
-Peff

PS I actually _did_ try googling for this, and didn't come up with an answer that was as complete or clear (to me, anyway) as what I wrote above.

Dirk Süsserott· Jun 13, 2011, 13:52 UTC · re: Jeff King · lore

Re: file mode

Am 13.06.2011 07:38 schrieb Jeff King:
Show 16 quoted lines
> On Sun, Jun 12, 2011 at 07:12:42PM +0000, Michael Witten wrote:
> 
>> On Sun, Jun 12, 2011 at 18:57, Peter Kleiweg <pkleiweg@xs4all.nl> wrote:
>>> I added a file that has file mode 600. When I do a check-out,
>>> the file comes with mode 644. Is this supposed to happen? Then
>>> how do I control what permissions files have?
>>
>> Do some googling.
> 
> I really don't see the point of a response like this. It is one thing to
> rudely point somebody to lmgtfy or an FAQ link. Then you're still being
> rude, but at least you are pointing them in the right direction. But
> this seems simply to make the list a less pleasant place _and_ to be
> totally useless to the original poster. If you didn't want to give the
> answer, wouldn't it have been better not to respond at all?
> 

My sentiments exactly. Actually this list is one of the best I ever met or subscribed to. Even posts with the meaningless subject "Help needed" are answered. I've seen some of them. Few, though. Please, people, stick to what Peff suggests. I think for most newbees this list is the last effort AFTER googling, so googling won't help.

Cheers,
	Dirk
Michael Witten· Jun 13, 2011, 13:58 UTC · re: Jeff King · lore

Re: file mode

On Mon, Jun 13, 2011 at 05:38, Jeff King <peff@peff.net> wrote:
Show 15 quoted lines
> On Sun, Jun 12, 2011 at 07:12:42PM +0000, Michael Witten wrote:
>
>> On Sun, Jun 12, 2011 at 18:57, Peter Kleiweg <pkleiweg@xs4all.nl> wrote:
>> > I added a file that has file mode 600. When I do a check-out,
>> > the file comes with mode 644. Is this supposed to happen? Then
>> > how do I control what permissions files have?
>>
>> Do some googling.
>
> I really don't see the point of a response like this. It is one thing to
> rudely point somebody to lmgtfy or an FAQ link. Then you're still being
> rude, but at least you are pointing them in the right direction. But
> this seems simply to make the list a less pleasant place _and_ to be
> totally useless to the original poster. If you didn't want to give the
> answer, wouldn't it have been better not to respond at all?
No.
Firstly: My response shows that there are abundant answers, which is a
nicer answer to receive than no answer at all.
Secondly: I didn't see the point in RE-WRITING all that has been said
on the subject before, and I couldn't be sure that somebody else would
be willing to do the same too (I figured it was a good idea to supply
at least one response).
Thirdly: Seriously, at least do some googling first.
Ævar Arnfjörð Bjarmason· Jun 13, 2011, 21:18 UTC · re: Michael Witten · lore

Re: file mode

On Mon, Jun 13, 2011 at 15:58, Michael Witten <mfwitten@gmail.com> wrote:
> Firstly: My response shows that there are abundant answers, which is a
> nicer answer to receive than no answer at all.

I think having answers like yours is much worse than having no answer at all. I happen to know how git handles the storage of file permissions, but like Jeff I couldn't find anything useful either with some quick searching around.

But it's very useful that the list have a friendly atmosphere where people of different technical capability, or those that haven't found the right terms to feed into a search engine can ask questions without getting back an answer which at least to me seems very snarky.

There's a tendency in a lot of mailing list to accumulate a self-congratulating air from regulars "in the know" where people asking questions aren't made to feel welcome. Let's try to not become one of those lists.

Michael Witten· Jun 14, 2011, 06:00 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: file mode

On Mon, 13 Jun 2011 23:18:58 +0200, Ævar Arnfjörð Bjarmason wrote:
Show 43 quoted lines
>> On Mon, Jun 13, 2011 at 05:38, Jeff King <peff@peff.net> wrote:
>>> On Sun, Jun 12, 2011 at 07:12:42PM +0000, Michael Witten wrote:
>>>
>>>> On Sun, Jun 12, 2011 at 18:57, Peter Kleiweg <pkleiweg@xs4all.nl> wrote:
>>>>> I added a file that has file mode 600. When I do a check-out,
>>>>> the file comes with mode 644. Is this supposed to happen? Then
>>>>> how do I control what permissions files have?
>>>>
>>>> Do some googling.
>>>
>>> I really don't see the point of a response like this. It is one thing to
>>> rudely point somebody to lmgtfy or an FAQ link. Then you're still being
>>> rude, but at least you are pointing them in the right direction. But
>>> this seems simply to make the list a less pleasant place _and_ to be
>>> totally useless to the original poster. If you didn't want to give the
>>> answer, wouldn't it have been better not to respond at all?
>>
>> No.
>>
>> Firstly: My response shows that there are abundant answers, which is a
>> nicer answer to receive than no answer at all.
>>
>> Secondly: I didn't see the point in RE-WRITING all that has been said
>> on the subject before, and I couldn't be sure that somebody else would
>> be willing to do the same too (I figured it was a good idea to supply
>> at least one response).
>> 
>> Thirdly: Seriously, at least do some googling first.
>
> I think having answers like yours is much worse than having no answer
> at all. I happen to know how git handles the storage of file
> permissions, but like Jeff I couldn't find anything useful either with
> some quick searching around.
>
> But it's very useful that the list have a friendly atmosphere where
> people of different technical capability, or those that haven't found
> the right terms to feed into a search engine can ask questions without
> getting back an answer which at least to me seems very snarky.
>
> There's a tendency in a lot of mailing list to accumulate a
> self-congratulating air from regulars "in the know" where people
> asking questions aren't made to feel welcome. Let's try to not become
> one of those lists.

Peter Kleiwig, I would be most grateful if you could find it in your heart to forgive a poor, misguided, mutton-faced, thistle-bottomed, pig-swiving, ale-soused dungball such as myself.

This wretch, I, humbly prostrates himself before the feet of the offended in earnest compunction over his unconscionably uncouth utterances; may I next time guard my tongue or, if finding myself unequal to that task, be so thoughtful as to bite it off, preserve it for at least a year and a day in a barrel of briny liquid most foul, and then—on the coldest day of winter—dispense with it as fodder for the hunger pangs of feral cats!

Peter Kleiweg· Jun 13, 2011, 14:25 UTC · re: Jeff King · lore

Re: file mode

Jeff King schreef op de 13e dag van de zomermaand van het jaar 2011:
Show 6 quoted lines
> On Sun, Jun 12, 2011 at 07:12:42PM +0000, Michael Witten wrote:
> 
> > On Sun, Jun 12, 2011 at 18:57, Peter Kleiweg <pkleiweg@xs4all.nl> wrote:
> > > I added a file that has file mode 600. When I do a check-out,
> > > the file comes with mode 644. Is this supposed to happen? Then
> > > how do I control what permissions files have?
> We could add in a config option to respect file modes, but it has
> generally been seen as not worthwhile. It solves only a part of the
> general metadata problem, as it omits owner and group names or ids, as
> well as extended metadata like ACLs.
I see your point. 
 
> If modes are important to you, the suggested fixes are one of:
Thanks. This is really helpfull.
-- 
Peter Kleiweg
http://pkleiweg.home.xs4all.nl/

← back to recent threads