libgit2 / libgit2/pygit2

Group permissions not respected

オープン
#1,153 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
1.7k
フォーク
408
平均マージ
2日 57分
マージ済み PR(30日)
7

説明

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…

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

サポート対象の環境で issue の権限設定を再現し、pygit2.Repository と pygit2/repository.py の 1620 行目に示されている init_file_backend の呼び出しから始めます。グループ権限の失敗が Python binding で発生しているのか libgit2 で発生しているのかを追跡し、その後、リグレッションテストを追加して、確認済みの動作または修正内容を文書化します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
git, python
領域
backend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。