Group permissions not respected
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 1.7k
- Forks
- 408
- Merge medio
- 2 d 57 min
- PR fusionados (30 d)
- 7
Descripción
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…
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Reproduce la configuración de permisos del issue en un entorno compatible, comenzando con pygit2.Repository y la llamada a init_file_backend mostrada en pygit2/repository.py, línea 1620. Determina si el fallo de permisos de grupo se produce en el binding de Python o en libgit2; después, añade cobertura de regresión y documenta el comportamiento confirmado o la corrección.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- git, python
- Área
- backend
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 42/100