Discussion:
how to specify "useithreads" in a distroprefs
(too old to reply)
Alceu Rodrigues de Freitas Junior via cpan-testers-discuss
2022-06-08 15:43:21 UTC
Permalink
Hello there,

I've struggling to define distroprefs and include "useithreads"
information for a perl that doesn't support it.

If I define it like this:

---
comment: Tests hang smoker
disabled: 1
match:
  distribution: ^PRBRENAN/Nasm-X86
  perlconfig:
    archname: i386-openbsd
    osname: openbsd
    useithreads: null

The distribution is skipped just fine, but then I start to get warning
like this one:

validation of distropref
'/home/goku/cpan-openbsd-smoker/prefs/PRBRENAN.Nasm-X86.yml'[0] against
schema '/home/goku/perl5/lib/perl5/CPAN/Kwalify/distroprefs.yml'
failed:   - [/match/perlconfig/useithreads] Non-valid data 'undef',
expected text

I already tried to configure like this instead:

---
comment: Tests hang smoker
disabled: 1
match:
  distribution: ^PRBRENAN/Nasm-X86
  perlconfig:
    archname: i386-openbsd
    osname: openbsd
    no_useithreads: defined

But then the distribution is not skipped anymore.

I went through Kwalify documentation, but couldn't figure out where the
CPAN distroprefs schema is define so I can figure out how to accomplish
both things (skipping the distribution and not getting warnings).

Thanks in advance,

Alceu
Slaven Rezic
2022-06-09 19:38:28 UTC
Permalink
08. 06. 2022. u 17:43, Alceu Rodrigues de Freitas Junior via
Post by Alceu Rodrigues de Freitas Junior via cpan-testers-discuss
Hello there,
I've struggling to define distroprefs and include "useithreads"
information for a perl that doesn't support it.
---
comment: Tests hang smoker
disabled: 1
  distribution: ^PRBRENAN/Nasm-X86
    archname: i386-openbsd
    osname: openbsd
    useithreads: null
The distribution is skipped just fine, but then I start to get warning
validation of distropref
'/home/goku/cpan-openbsd-smoker/prefs/PRBRENAN.Nasm-X86.yml'[0]
against schema
'/home/goku/perl5/lib/perl5/CPAN/Kwalify/distroprefs.yml' failed:   -
[/match/perlconfig/useithreads] Non-valid data 'undef', expected text
---
comment: Tests hang smoker
disabled: 1
  distribution: ^PRBRENAN/Nasm-X86
    archname: i386-openbsd
    osname: openbsd
    no_useithreads: defined
But then the distribution is not skipped anymore.
I went through Kwalify documentation, but couldn't figure out where
the CPAN distroprefs schema is define so I can figure out how to
accomplish both things (skipping the distribution and not getting
warnings).
Hi Alceu,

I think that

    useithreads: undef

should work, using exactly the string which is returned by

    perl -V:useithreads

Regards, Slaven
Slaven Rezic
2022-06-09 19:57:47 UTC
Permalink
Post by Slaven Rezic
08. 06. 2022. u 17:43, Alceu Rodrigues de Freitas Junior via
Post by Alceu Rodrigues de Freitas Junior via cpan-testers-discuss
Hello there,
I've struggling to define distroprefs and include "useithreads"
information for a perl that doesn't support it.
---
comment: Tests hang smoker
disabled: 1
  distribution: ^PRBRENAN/Nasm-X86
    archname: i386-openbsd
    osname: openbsd
    useithreads: null
The distribution is skipped just fine, but then I start to get
validation of distropref
'/home/goku/cpan-openbsd-smoker/prefs/PRBRENAN.Nasm-X86.yml'[0]
against schema
'/home/goku/perl5/lib/perl5/CPAN/Kwalify/distroprefs.yml' failed:   -
[/match/perlconfig/useithreads] Non-valid data 'undef', expected text
---
comment: Tests hang smoker
disabled: 1
  distribution: ^PRBRENAN/Nasm-X86
    archname: i386-openbsd
    osname: openbsd
    no_useithreads: defined
But then the distribution is not skipped anymore.
I went through Kwalify documentation, but couldn't figure out where
the CPAN distroprefs schema is define so I can figure out how to
accomplish both things (skipping the distribution and not getting
warnings).
Hi Alceu,
I think that
    useithreads: undef
should work, using exactly the string which is returned by
    perl -V:useithreads
Actually, looking at this distropref file
https://github.com/eserte/srezic-cpan-distroprefs/blob/8c3ae5d7b4071f9639ccfcea4f44764c2699e27e/Devel-CallParser.yml#L5
it seems that the value is interepreted as a regexp, so you want to
anchor it with ^ and $ for extra safety.

Regards, Slaven
Alceu Rodrigues de Freitas Junior via cpan-testers-discuss
2022-06-12 18:42:17 UTC
Permalink
Hello Slaven,
Post by Slaven Rezic
Post by Slaven Rezic
Hi Alceu,
I think that
    useithreads: undef
should work, using exactly the string which is returned by
    perl -V:useithreads
Actually, looking at this distropref file
https://github.com/eserte/srezic-cpan-distroprefs/blob/8c3ae5d7b4071f9639ccfcea4f44764c2699e27e/Devel-CallParser.yml#L5
it seems that the value is interepreted as a regexp, so you want to
anchor it with ^ and $ for extra safety.
I'm afraid that neither the options you proposed: I tried both and the
result is the same: Kwalify doesn't complain anymore but the
distribution is not skipped.

On the other hand, using:

    useithreads: null

Generates the opposite outcome.

Not sure how Kwalify works (both Ruby's and Perl's implementation from
it), but the direct translation from Perl's undef would be null in YAML.
Slaven Rezic
2022-06-14 21:37:45 UTC
Permalink
12. 06. 2022. u 20:42, Alceu Rodrigues de Freitas Junior via
Post by Alceu Rodrigues de Freitas Junior via cpan-testers-discuss
Hello Slaven,
Post by Slaven Rezic
Post by Slaven Rezic
Hi Alceu,
I think that
    useithreads: undef
should work, using exactly the string which is returned by
    perl -V:useithreads
Actually, looking at this distropref file
https://github.com/eserte/srezic-cpan-distroprefs/blob/8c3ae5d7b4071f9639ccfcea4f44764c2699e27e/Devel-CallParser.yml#L5
it seems that the value is interepreted as a regexp, so you want to
anchor it with ^ and $ for extra safety.
I'm afraid that neither the options you proposed: I tried both and the
result is the same: Kwalify doesn't complain anymore but the
distribution is not skipped.
    useithreads: null
Generates the opposite outcome.
Not sure how Kwalify works (both Ruby's and Perl's implementation from
it), but the direct translation from Perl's undef would be null in YAML.
Hi Alceu,

Kwalify is just a schema for validating data structures and it does not
do any parsing or matching using the distroprefs data. The latter is
done by CPAN::Distroprefs.

That said, I tried "useithreads: undef" and it did not work. So it looks
like the matching is not done against what is displayed in "perl -V" (in
this case the string "undef"), but what is in the Config data structure
(the value undef).

However, the distroprefs code only does regexp matches against the
stringified values, so to match the stringified undef (the empty string)
one has to use '^$'. Below is a distroprefs file just for demonstration
purposes, and it works on my system.

Regards, Slaven

---
match:
distribution: Kwalify
perlconfig:
useithreads: '^$'
pl:
commandline: "echo unthreaded perl deteted; exit 1"
---
match:
distribution: Kwalify
perlconfig:
useithreads: '^define$'
pl:
commandline: "echo threading perl deteted; exit 1"
---
match:
distribution: Kwalify
pl:
commandline: "echo nothing matched; exit 1"
Alceu Rodrigues de Freitas Junior via cpan-testers-discuss
2022-06-15 03:39:44 UTC
Permalink
Hello Slaven,
Post by Slaven Rezic
Hi Alceu,
Kwalify is just a schema for validating data structures and it does
not do any parsing or matching using the distroprefs data. The latter
is done by CPAN::Distroprefs.
That said, I tried "useithreads: undef" and it did not work. So it
looks like the matching is not done against what is displayed in "perl
-V" (in this case the string "undef"), but what is in the Config data
structure (the value undef).
However, the distroprefs code only does regexp matches against the
stringified values, so to match the stringified undef (the empty
string) one has to use '^$'. Below is a distroprefs file just for
demonstration purposes, and it works on my system.
Thank you for that!

Just tried with the regex "^$" on OpenBSD 7.1 and worked without the
warning.

On the other hand, I tried both methods on my Ubuntu box and both worked
without any warning, which isn't the expected:

me:~/.cpan/prefs$ cat test.yml
---
disabled: 1
match:
  distribution: ^MIK/CryptX
  perlconfig:
    #useithreads: null
    useithreads: '^$'

me:~/.cpan/prefs$ cpan -t CryptX
CPAN: CPAN::SQLite loaded ok (v0.219)
Database was generated on Wed, 15 Jun 2022 03:16:47 GMT
Running test for module 'CryptX'
CPAN: YAML::XS loaded ok (v0.83)
CPAN: CPAN::Kwalify loaded ok (v5.50)

______________________ D i s t r o P r e f s ______________________
test.yml[0]
  MIK/CryptX-0.076.tar.gz
  [disabled] -- NA Disabled via prefs file
'/home/semantix/.cpan/prefs/test.yml' doc 0
me:~/.cpan/prefs$ vi test.yml

me:~/.cpan/prefs$ cat test.yml
---
disabled: 1
match:
  distribution: ^MIK/CryptX
  perlconfig:
    useithreads: null
    #useithreads: '^$'

me:~/.cpan/prefs$ cpan -t CryptX
CPAN: CPAN::SQLite loaded ok (v0.219)
Database was generated on Wed, 15 Jun 2022 03:16:47 GMT
Running test for module 'CryptX'
CPAN: YAML::XS loaded ok (v0.83)
CPAN: CPAN::Kwalify loaded ok (v5.50)

______________________ D i s t r o P r e f s ______________________
test.yml[0]
  MIK/CryptX-0.076.tar.gz
  [disabled] -- NA Disabled via prefs file
'/home/semantix/.cpan/prefs/test.yml' doc 0

Now, testing on OpenBSD, I got the warning if using "undef", as previous
stated.

Comparing the systems, the only thing I got that is different is the
perl itself:

[***@cpan-smoker-openbsd:~/cpan-openbsd-smoker]$ mversion CPAN::Kwalify
5.50
[***@cpan-smoker-openbsd:~/cpan-openbsd-smoker]$ mversion CPAN::Distroprefs
6.0001
[***@cpan-smoker-openbsd:~/cpan-openbsd-smoker]$ perl -v

This is perl 5, version 32, subversion 1 (v5.32.1) built for i386-openbsd

The Ubuntu box is running:

perl 5, version 34, subversion 0 (v5.34.0) built for x86_64-linux.

Both without ithreads support, but the perl on OpenBSD is patched (by
the maintainers), so that might explain the difference.

Anyway, I think it's worth to document all this and I'm willing to
provide a PR for that. Any suggestions where I should do it? Maybe the
CPAN's distribution Pod?

Regards,

Alceu

Loading...