Skip to content

posix_getgr(gid|nam)_basic.phpt fail #10202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fpcarv opened this issue Jan 1, 2023 · 4 comments
Closed

posix_getgr(gid|nam)_basic.phpt fail #10202

fpcarv opened this issue Jan 1, 2023 · 4 comments

Comments

@fpcarv
Copy link

fpcarv commented Jan 1, 2023

Description

php_test_results_20230101_2044.txt

PHP Version

PHP 8.2.1RC1

Operating System

Linux 5.15.85 (CRUX)

@nielsdos
Copy link
Member

nielsdos commented Jan 1, 2023

There are three test failures in your report:

  • Compatibility of values of same name trait constants is checked after their constant expressions are evaluated [Zend/tests/traits/constant_016.phpt]
  • Test posix_getgrgid() function : basic functionality [ext/posix/tests/posix_getgrgid_basic.phpt]
  • Test posix_getgrnam() function : basic functionality [ext/posix/tests/posix_getgrnam_basic.phpt]

The first one was reported before and is fixed by the commit referenced in #10133 AFAICT.

For the other two I used the following patch to fix the issues you're encountering:

diff --git a/ext/posix/tests/posix_getgrgid_basic.phpt b/ext/posix/tests/posix_getgrgid_basic.phpt
index 6b0daa5e94..392e81d491 100644
--- a/ext/posix/tests/posix_getgrgid_basic.phpt
+++ b/ext/posix/tests/posix_getgrgid_basic.phpt
@@ -17,7 +17,7 @@
 Array
 (
     [name] => %s
-    [passwd] => %a
+    [passwd] => %A
     [members] => Array
 %a
 
diff --git a/ext/posix/tests/posix_getgrnam_basic.phpt b/ext/posix/tests/posix_getgrnam_basic.phpt
index 5203d1ea0f..acf8f4473e 100644
--- a/ext/posix/tests/posix_getgrnam_basic.phpt
+++ b/ext/posix/tests/posix_getgrnam_basic.phpt
@@ -20,7 +20,7 @@
   ["name"]=>
   string(%d) "%s"
   ["passwd"]=>
-  string(1) "%s"
+  string(%d) "%S"
   ["members"]=>
 %a
   ["gid"]=>

You can apply this patch on top of the 8.2 branch using the git apply command. Could you please verify whether it fixes your issue?

@fpcarv
Copy link
Author

fpcarv commented Jan 2, 2023

It worked :-)
Thanks!

@cmb69
Copy link
Member

cmb69 commented Jan 2, 2023

So passwd is an empty string for both tests? If so, the patch looks good to me. Do you want to make a PR, @nielsdos?

@cmb69 cmb69 changed the title PHP 8.2.1RC1 make test posix_getgr(gid|nam)_basic.phpt fail Jan 2, 2023
@nielsdos
Copy link
Member

nielsdos commented Jan 2, 2023

Yes and yes.

nielsdos added a commit to nielsdos/php-src that referenced this issue Jan 2, 2023
The issue was that passwd was empty for the issue reporter, but the test
expected passwd to be non-empty. An empty passwd can occur if there is
no (encrypted) group password set up.
@cmb69 cmb69 linked a pull request Jan 2, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants