# running git as root

7 messages from 2009-06-13 to 2009-06-14. Participants: Marco Nelissen, Michael J Gruber, Alex Riesen, Nanako Shiraishi.
Thread: https://gitlist.dev/t/19802

## Marco Nelissen, 2009-06-13 15:25

Subject: running git as root
Message-ID: <3a3d9e520906130825k25815c9atafde301d9fbc1da2@mail.gmail.com>
URL: https://gitlist.dev/e/3a3d9e520906130825k25815c9atafde301d9fbc1da2%40mail.gmail.com

```
When running as root, git fails a number of test cases that expect it
to fail on read-only repositories (for example 't0004-unwritable.sh').
I was thinking of either changing the code so that it checks
permissions itself when opening files as root, or add a prerequisite
to those test cases so that they are skipped when running as root.
What would be the preferred way?

```

## Michael J Gruber, 2009-06-13 15:42

Subject: Re: running git as root
Message-ID: <4A33C8D2.5080808@drmicha.warpmail.net>
URL: https://gitlist.dev/e/4A33C8D2.5080808%40drmicha.warpmail.net
In-Reply-To: <3a3d9e520906130825k25815c9atafde301d9fbc1da2@mail.gmail.com>

```
Marco Nelissen venit, vidit, dixit 13.06.2009 17:25:
> When running as root, git fails a number of test cases that expect it
> to fail on read-only repositories (for example 't0004-unwritable.sh').
> I was thinking of either changing the code so that it checks
> permissions itself when opening files as root, or add a prerequisite
> to those test cases so that they are skipped when running as root.
> What would be the preferred way?

The preferred ways is to build git as non-root user. This is true even
more so for running the test suite.

Michael

```

## Alex Riesen, 2009-06-13 17:49

Subject: Re: running git as root
Message-ID: <81b0412b0906131049v60cfbc9bm3fd26cc25acc2cd4@mail.gmail.com>
URL: https://gitlist.dev/e/81b0412b0906131049v60cfbc9bm3fd26cc25acc2cd4%40mail.gmail.com
In-Reply-To: <3a3d9e520906130825k25815c9atafde301d9fbc1da2@mail.gmail.com>

```
2009/6/13 Marco Nelissen <marcone@xs4all.nl>:
> When running as root, git fails a number of test cases that expect it
> to fail on read-only repositories (for example 't0004-unwritable.sh').
> I was thinking of either changing the code so that it checks
> permissions itself when opening files as root, or add a prerequisite
> to those test cases so that they are skipped when running as root.

There is such a prerequisite already (POSIXPERM), but what caused
you to run the _tests_ as root?

> What would be the preferred way?

Use the prerequisite would sound right when not the
strangeness of the idea.

```

## Marco Nelissen, 2009-06-14 01:41

Subject: Re: running git as root
Message-ID: <3a3d9e520906131841i2e67994fqf323140f95c37d5e@mail.gmail.com>
URL: https://gitlist.dev/e/3a3d9e520906131841i2e67994fqf323140f95c37d5e%40mail.gmail.com
In-Reply-To: <81b0412b0906131049v60cfbc9bm3fd26cc25acc2cd4@mail.gmail.com>

```
On Sat, Jun 13, 2009 at 10:49 AM, Alex Riesen<raa.lkml@gmail.com> wrote:
> 2009/6/13 Marco Nelissen <marcone@xs4all.nl>:
>> When running as root, git fails a number of test cases that expect it
>> to fail on read-only repositories (for example 't0004-unwritable.sh').
>> I was thinking of either changing the code so that it checks
>> permissions itself when opening files as root, or add a prerequisite
>> to those test cases so that they are skipped when running as root.
>
> There is such a prerequisite already (POSIXPERM), but what caused
> you to run the _tests_ as root?

POSIXPERM doesn't appear to be quite right for this. For example, the
't1301-shared-repo.sh' test has the POSIXPERM prereq, but it runs fine
as root, because it merely validates that permissions are preserved.

```

## Marco Nelissen, 2009-06-14 01:42

Subject: Re: running git as root
Message-ID: <3a3d9e520906131842j6754bda1yaf6ecb2b24320260@mail.gmail.com>
URL: https://gitlist.dev/e/3a3d9e520906131842j6754bda1yaf6ecb2b24320260%40mail.gmail.com
In-Reply-To: <4A33C8D2.5080808@drmicha.warpmail.net>

```
On Sat, Jun 13, 2009 at 8:42 AM, Michael J
Gruber<git@drmicha.warpmail.net> wrote:
> Marco Nelissen venit, vidit, dixit 13.06.2009 17:25:
>> When running as root, git fails a number of test cases that expect it
>> to fail on read-only repositories (for example 't0004-unwritable.sh').
>> I was thinking of either changing the code so that it checks
>> permissions itself when opening files as root, or add a prerequisite
>> to those test cases so that they are skipped when running as root.
>> What would be the preferred way?
>
> The preferred ways is to build git as non-root user. This is true even
> more so for running the test suite.

This is not possible on BeOS, where there is only one user, and it is
the super user.

```

## Nanako Shiraishi, 2009-06-14 06:08

Subject: Re: running git as root
Message-ID: <20090614150851.6117@nanako3.lavabit.com>
URL: https://gitlist.dev/e/20090614150851.6117%40nanako3.lavabit.com
In-Reply-To: <81b0412b0906131049v60cfbc9bm3fd26cc25acc2cd4@mail.gmail.com>

```
Quoting Alex Riesen <raa.lkml@gmail.com>:

> 2009/6/13 Marco Nelissen <marcone@xs4all.nl>:
>> When running as root, git fails a number of test cases that expect it
>> to fail on read-only repositories (for example 't0004-unwritable.sh').
>> I was thinking of either changing the code so that it checks
>> permissions itself when opening files as root, or add a prerequisite
>> to those test cases so that they are skipped when running as root.
>
> There is such a prerequisite already (POSIXPERM), but what caused
> you to run the _tests_ as root?
>
>> What would be the preferred way?
>
> Use the prerequisite would sound right when not the
> strangeness of the idea.

I think somebody needs to repost an old patch from the archive.

    http://thread.gmane.org/gmane.comp.version-control.git/116729/focus=118385

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

```

## Marco Nelissen, 2009-06-14 21:40

Subject: Re: running git as root
Message-ID: <3a3d9e520906141440p720df7c1l6e25b71899daaa7c@mail.gmail.com>
URL: https://gitlist.dev/e/3a3d9e520906141440p720df7c1l6e25b71899daaa7c%40mail.gmail.com
In-Reply-To: <20090614150851.6117@nanako3.lavabit.com>

```
On Sat, Jun 13, 2009 at 11:08 PM, Nanako Shiraishi<nanako3@lavabit.com> wrote:
> Quoting Alex Riesen <raa.lkml@gmail.com>:
>
>> 2009/6/13 Marco Nelissen <marcone@xs4all.nl>:
>>> When running as root, git fails a number of test cases that expect it
>>> to fail on read-only repositories (for example 't0004-unwritable.sh').
>>> I was thinking of either changing the code so that it checks
>>> permissions itself when opening files as root, or add a prerequisite
>>> to those test cases so that they are skipped when running as root.
>>
>> There is such a prerequisite already (POSIXPERM), but what caused
>> you to run the _tests_ as root?
>>
>>> What would be the preferred way?
>>
>> Use the prerequisite would sound right when not the
>> strangeness of the idea.
>
> I think somebody needs to repost an old patch from the archive.
>
>    http://thread.gmane.org/gmane.comp.version-control.git/116729/focus=118385

That's almost identical to the patch I wanted to submit, except for
the name 'SANITY', which doesn't make much sense I think.

```
