"invalid config path selector" error when testing on pypy with MacOS arm64
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Bắt đầu với pygit2/options.py, các dòng 359-374, và phần thiết lập đang lỗi trong test/conftest.py; tái hiện test/test_treebuilder.py::test_rebuild_treebuilder trên PyPy/macOS arm64. So sánh đối số được truyền vào git_libgit2_opts() với settings.c config_level_to_sysdir của libgit2 và bản sửa tương tự của libgit2sharp. Hoàn tất khi các phép gán đường dẫn tìm kiếm cấu hình của fixture chạy đạt trong môi trường đó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
pytest output
../venv-test-arm64/lib/pypy3.11/site-packages/pygit2/errors.py:67: GitError
__________________ ERROR at setup of test_rebuild_treebuilder __________________
@pytest.fixture(scope='session', autouse=True)
def global_git_config() -> None:
# Do not use global config for better test reproducibility.
# https://github.com/libgit2/pygit2/issues/989
levels = [
pygit2.enums.ConfigLevel.GLOBAL,
pygit2.enums.ConfigLevel.XDG,
pygit2.enums.ConfigLevel.SYSTEM,
]
for level in levels:
> pygit2.settings.search_path[level] = ''
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test/conftest.py:22:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../venv-test-arm64/lib/pypy3.11/site-packages/pygit2/settings.py:45: in __setitem__
option(Option.SET_SEARCH_PATH, key, value)
../venv-test-arm64/lib/pypy3.11/site-packages/pygit2/options.py:373: in option
check_error(err)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
err = -1, io = False
def check_error(err: int, io: bool = False) -> None:
if err >= 0:
return
# These are special error codes, they should never reach here
test = err != C.GIT_EUSER and err != C.GIT_PASSTHROUGH
assert test, f'Unexpected error code {err}'
# Error message
giterr = C.git_error_last()
if giterr != ffi.NULL:
message = ffi.string(giterr.message).decode('utf8', errors='surrogateescape')
else:
message = f'err {err} (no message provided)'
# Translate to Python errors
if err in value_errors:
raise ValueError(message)
if err == C.GIT_ENOTFOUND:
if io:
raise IOError(message)
raise KeyError(message)
if err == C.GIT_EINVALIDSPEC:
raise ValueError(message)
if err == C.GIT_ITEROVER:
raise StopIteration()
# Generic Git error
> raise GitError(message)
E _pygit2.GitError: invalid config path selector 0
../venv-test-arm64/lib/pypy3.11/site-packages/pygit2/errors.py:67: GitError
ERROR test/test_treebuilder.py::test_rebuild_treebuilder - _pygit2.GitError: invalid config path selector 0
As far as I can tell, this "invalid config path selector" error seems to be specific to pygit2 on pypy11. It seems that the int(level) passed to git_libgit2_opts()
is not matching up with the libgit2 C constants of the same name:
static int config_level_to_sysdir(int *out, int config_level)
{
switch (config_level) {
case GIT_CONFIG_LEVEL_SYSTEM:
*out = GIT_SYSDIR_SYSTEM;
return 0;
case GIT_CONFIG_LEVEL_XDG:
*out = GIT_SYSDIR_XDG;
return 0;
case GIT_CONFIG_LEVEL_GLOBAL:
*out = GIT_SYSDIR_GLOBAL;
return 0;
case GIT_CONFIG_LEVEL_PROGRAMDATA:
*out = GIT_SYSDIR_PROGRAMDATA;
return 0;
default:
break;
}
git_error_set(
GIT_ERROR_INVALID, "invalid config path selector %d", config_level);
return -1;
}
See libgit2 source
There was a similar issue in https://github.com/libgit2/libgit2sharp/issues/1951 which was fixed by padding the va_args passed to git_libgit2_opts() (https://github.com/libgit2/libgit2sharp/pull/1955).
Originally posted by @2bndy5 in https://github.com/libgit2/pygit2/issues/1441#issuecomment-3610152291
- Ngôn ngữ chính
- Python
- Star
- 1.7k
- Fork
- 408
- Merge trung bình
- 2 ngày 57 phút
- Pull request đã merge (30 ngày)
- 7
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của libgit2/pygit2
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
Feature Request: Support app-level temporary config overrides using libgit2's backend supprt Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
-
merge_bases not wrapped Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
Tất cả issue của libgit2/pygit2
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
anthropics/skills#1811 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
speaches-ai/speaches#678 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
datalayer/mcp-compose#42 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
conda-forge/spacy-feedstock#177 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
UKGovernmentBEIS/inspect_evals#2523 ·