macOS getgrent returns no groups while getgrgid works
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 47/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
调研方向
Start by reading ExtendedNativeUtils.getgrent, FFMPosixLinux.getgrent, and FFMPosixMacOS to trace the native call and how a null result becomes an empty list. Then compare the macOS FFM binding and enumeration setup with the host libc behavior; the issue says the failure occurs on both execution backends. Done means successive getgrent calls return group records after setgrent, with regression coverage for list context and File::Finder's nogroup predicates.
由索引模型根据 Issue 内容生成。
描述
Summary
On macOS, PerlOnJava's getgrent returns no group entries, even though getgrgid can look up a group by GID. This breaks Perl code that enumerates the group database. It causes the released CPAN distribution File-Finder 1.01 to misclassify every path for its nogroup and not nogroup predicates.
Reproduction
The following probe was run with both the JVM backend and --interpreter:
my $gid = (stat ".")[5];
my @by_gid = getgrgid($gid);
print "gid=$gid getgrgid=", scalar(@by_gid), " ", join("|", @by_gid), "\n";
setgrent();
my @entry = getgrent();
print "getgrent=", scalar(@entry), " ", join("|", @entry), "\n";
PerlOnJava reports a valid getgrgid record, then getgrent=0. Repeated getgrent calls also return no entries. System Perl on the same macOS host returns group entries from getgrent (and a valid record from getgrgid).
CPAN evidence
In CPAN random tester run 20261109-091152-39587, File-Finder-1.01 failed 2 of 87 tests, both in t/05-steps.t:
nogroup: PerlOnJava included.although the system-Perl expected result was empty.not nogroup: PerlOnJava returned an empty result although system Perl included..
System Perl passed all 87 tests. The other File-Finder tests passed or were skipped for optional dependencies. This is a pure-Perl distribution; no XS/native distribution prioritization applies.
The affected code in File-Finder builds a GID-to-group map by iterating getgrent. Because PerlOnJava returns no entries, _gid_to_group cannot resolve the directory's GID; nogroup then treats it as unknown. The same failure was observed with both PerlOnJava backends.
Suspected implementation path
ExtendedNativeUtils.getgrent calls FFMPosix.get().getgrent() and converts a null native result into an empty Perl list. The FFM implementation in FFMPosixLinux.getgrent invokes the native getgrent handle and returns null when the pointer is null. On macOS, FFMPosixMacOS inherits this implementation. In contrast, the native getgrgid path succeeds for the current GID.
This localizes the failure to native group enumeration, shared by the two execution backends. The precise reason the native getgrent call returns null still needs investigation; likely follow-up is to validate the macOS FFM binding and enumeration setup against the platform libc behavior.
Expected behavior
After setgrent, successive getgrent calls should enumerate the same available group records as system Perl on the host. The regression should cover list-context results and the File::Finder nogroup/not nogroup behavior on both execution backends.
- 主要语言
- Perl
- 星标
- 67
- 派生
- 8
- 平均合并
- 5 小时 12 分钟
- 30 天内合并 PR
- 131
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
fglock/PerlOnJava 的其他 Issue
-
area:cpan-port bug
难度 2/5 1-3 小时 新手友好度 70/100
fglock/PerlOnJava#2153 ·
维护者通常 1 天内回复
-
area:cpan-port area:parser bug
难度 2/5 1-3 小时 新手友好度 68/100
fglock/PerlOnJava#2137 ·
维护者通常 1 天内回复
-
area:backend area:cpan-port area:runtime bug
难度 2/5 1-3 小时 新手友好度 76/100
fglock/PerlOnJava#2071 ·
维护者通常 1 天内回复
-
area:runtime documentation enhancement
难度 2/5 1-3 小时 新手友好度 72/100
fglock/PerlOnJava#1579 ·
维护者通常 1 天内回复
-
area:cpan-port bug
难度 3/5 1-2 天 新手友好度 62/100
fglock/PerlOnJava#2157 ·
维护者通常 1 天内回复
查看 fglock/PerlOnJava 的全部 Issue
相似的 Issue
-
Dev-output directory preparation accepts file-valued lib/include paths and fails on dangling links未关闭team-cli
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
-
难度 1/5 1 小时以内 新手友好度 93/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 73/100
inverse-inc/packetfence#9728 ·
维护者通常 1 天内回复
-
fix(char-create): show the real reason a character is refused可能已有人在做 @baphomello 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复