libgit2 / libgit2/pygit2

Group permissions not respected

Ouverte
#1,153 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
Python
Étoiles
1.7k
Forks
408
Merge moyen
2 j 57 min
PR mergées (30 j)
7

Description

I ran into a strange behavior when trying to read a bare repo on my FreeBSD machine with pygit2:

Info:

  • FreeBSD: 13.1
  • libgit2-1.3.2
  • pygit2: 1.10.0
> whoami 
www

> git init --bare testrepo.git
Initialized empty Git repository in /example/testrepo.git/

> chmod -R 770 testrepo.git 
> ls -lah
[...]
drwxrwx---  7 www   www      10B Jul 28 08:48 testrepo.git

> python3 -c "import pygit2;path = pygit2.discover_repository('testrepo.git');print(path);print(pygit2.Repository(path))"
/example/testrepo.git/
pygit2.Repository('/example/testrepo.git/')

> sudo chown -R git:www testrepo.git 
> ls -lah
[...]
drwxrwx---  7 git   www      10B Jul 28 08:48 testrepo.git

> python3 -c "import pygit2;path = pygit2.discover_repository('testrepo.git');print(path);print(pygit2.Repository(path))"
/example/testrepo.git/
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/example/.venv/lib/python3.9/site-packages/pygit2/repository.py", line 1620, in __init__
    path_backend = init_file_backend(path, flags)
_pygit2.GitError: Repository not found at testrepo.git

> sudo chmod -R 777 testrepo.git
> ls -lah
[...]
drwxrwxrwx  7 git   www      10B Jul 28 08:48 testrepo.git

> python3 -c "import pygit2;path = pygit2.discover_repository('testrepo.git');print(path);print(pygit2.Repository(path))"
/example/testrepo.git/
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/example/.venv/lib/python3.9/site-packages/pygit2/repository.py", line 1620, in __init__
    path_backend = init_file_backend(path, flags)
_pygit2.GitError: Repository not found at testrepo.git

It seems, like the repo can only be opened if the owner is also the user; the group permissions seem to be ignored.

I could confirm this behavior also on a Ubuntu machine:

  • Ubuntu: 20.04
  • libgit2-28
  • pygit2: 1.10.0

I'm not quite sure if this is a problem of pygit2 or the underlying libgit2, or if I did something wrong…

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Reproduisez la configuration des permissions de l’issue dans un environnement pris en charge, en commençant par pygit2.Repository et l’appel à init_file_backend indiqué à la ligne 1620 de pygit2/repository.py. Déterminez si l’échec des permissions de groupe se produit dans le binding Python ou dans libgit2, puis ajoutez une couverture de régression et documentez le comportement confirmé ou le correctif.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
git, python
Domaine
backend
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
42/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.