libgit2 / libgit2/pygit2

Group permissions not respected

Aperta
#1,153 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Python
Stelle
1.7k
Fork
408
Merge medio
2g 57m
PR unite (30g)
7

Descrizione

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…

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riproduci la configurazione dei permessi dell’issue in un ambiente supportato, iniziando con pygit2.Repository e la chiamata a init_file_backend mostrata alla riga 1620 di pygit2/repository.py. Traccia se il problema dei permessi di gruppo si verifica nel binding Python o in libgit2, quindi aggiungi una copertura di regressione e documenta il comportamento confermato o la correzione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
git, python
Ambito
backend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.