In perl.git, the branch blead has been updated <https://perl5.git.perl.org/perl.git/commitdiff/f83193f25095f9353c8e34c187184bc25fdadf51?hp=3127113cbf175740dce688a3320c9d62ece9b910>
- Log ----------------------------------------------------------------- commit f83193f25095f9353c8e34c187184bc25fdadf51 Author: Tony Cook <[email protected]> Date: Wed Jun 19 11:25:13 2019 +1000 Manuel Mausz is now a perl author commit 3121d45269f99e4f103ab5b830d517ded30081a8 Author: Manuel Mausz <[email protected]> Date: Mon Jun 17 10:24:03 2019 +0200 Add test for perl #134169 commit 79e302e6c3f815bf4cb72a5bacc3012595970db9 Author: Manuel Mausz <[email protected]> Date: Tue Jun 4 00:29:09 2019 +0200 (perl #134169) mg.c reset endptr after use Perl_grok_atoUV has been changed so endptr constraints the input. Thus we need to reset the endptr after every use. ----------------------------------------------------------------------- Summary of changes: AUTHORS | 1 + mg.c | 4 +++- t/op/groups.t | 22 +++++++++++++++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 8d5f5b0ad3..0091100600 100644 --- a/AUTHORS +++ b/AUTHORS @@ -772,6 +772,7 @@ Maik Hentsche <[email protected]> Major Sébastien <[email protected]> Makoto MATSUSHITA <[email protected]> Malcolm Beattie <[email protected]> +Manuel Mausz <[email protected]> Manuel Valente <[email protected]> Marc Green <[email protected]> Marc Lehmann <[email protected]> diff --git a/mg.c b/mg.c index 26211dd4d0..f235f0ee5a 100644 --- a/mg.c +++ b/mg.c @@ -3178,7 +3178,8 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) { const char *p = SvPV_const(sv, len); Groups_t *gary = NULL; - const char* endptr = p + len; + const char* p_end = p + len; + const char* endptr = p_end; UV uv; #ifdef _SC_NGROUPS_MAX int maxgrp = sysconf(_SC_NGROUPS_MAX); @@ -3201,6 +3202,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) if (endptr == NULL) break; p = endptr; + endptr = p_end; while (isSPACE(*p)) ++p; if (!*p) diff --git a/t/op/groups.t b/t/op/groups.t index e50c50a8c1..7e064cc21f 100644 --- a/t/op/groups.t +++ b/t/op/groups.t @@ -51,7 +51,7 @@ sub Test { my %basegroup = basegroups( $pwgid, $pwgnam ); my @extracted_supplementary_groups = remove_basegroup( \ %basegroup, \ @extracted_groups ); - plan 2; + plan 3; # Test: The supplementary groups in $( should match the @@ -121,6 +121,26 @@ sub Test { $gid_count->{0} //= 0; ok 0 == $pwgid || $gid_count->{0} < 2, "groupstype should be type short, not long"; + SKIP: { + # try to add a group as supplementary group + my $root_uid = 0; + skip "uid!=0", 1 if $< != $root_uid and $> != $root_uid; + my @groups = split ' ', $); + my @sup_group; + setgrent; + while(my @ent = getgrent) { + next if grep { $_ == $ent[2] } @groups; + @sup_group = @ent; + last; + } + endgrent; + skip "No group found we could add as a supplementary group", 1 + if (!@sup_group); + $) = "$) @sup_group[2]"; + my $ok = grep { $_ == $sup_group[2] } split ' ', $); + ok $ok, "Group `$sup_group[0]' added as supplementary group"; + } + return; } -- Perl5 Master Repository
