-
Notifications
You must be signed in to change notification settings - Fork 559
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
BBC: Blead Breaks JSON::DWIW #22685
Comments
Error message:
|
On Sun, Oct 20, 2024 at 09:51:05PM -0700, mauke wrote:
Error message:
```
Unparseable XSUB parameter: 'SV *' in DWIW.xs, line 1775
The line in the XS file is:
code_point_to_utf8_str(SV *, SV * code_point_sv)
It appears to be trying to skip assigning the first arg (the object) to a
local variable. But as far as I can tell, this isn't documented
as allowable XS syntax. So the author seems to be relying on a bug.
My recent changes made such an unparseable parameter declaration an error;
previously the declaration was silently skipped (although the argument
number was still incremented).
Note that the XS parser doesn't understand or parse C type syntax. It
just expects a parameter declaration to be of the general form:
(IN/OUT/etc)? (unparsed line noise)? var_name (= (unparsed line noise))?
It assumes that the first chunk of line noise is the C type, and the
second chunk of line noise is the default expression, if any. It can't
know that 'SV *' is a valid C type syntax, just that it is something
where there isn't a var name at the end.
Or to put it another way, the XS parser can't distinguish between
these two parameter declarations:
SV*
SV* foo+
To us humans, the first is obviously a var-less C type declaration,
while the second is obviously a typo. The XS parser would see both those
parameter declarations as just unparsebale. If we allow the first, we have
to allow the second too.
The three options seem to be:
1) Revert to 5.40 behaviour: any unparsebale parameter declaration is
treated as "silently skip the next arg". This would include typos
such as 'SV* foo+'.
2) As 5.40, but add a warning that the parameter declaration is unparseable
and is being skipped.
3) Keep the new behaviour which makes it an error.
I favour 2 or 3, with leaning towards 3. But if more distros are affected,
then I would lean towards 2.
Note that JSON::DWIW hasn't been updated since 2010, and the author hasn't
been active on CPAN since 2012. So getting a fixed release might not be
straightforward.
I have no idea of the popularity of otherwise of this distro.
…--
The Enterprise successfully ferries an alien VIP from one place to another
without serious incident.
-- Things That Never Happen in "Star Trek" #7
|
The breaking commit:
|
On Mon, Oct 21, 2024 at 03:33:41AM -0700, David Mitchell wrote:
The three options seem to be:
1) Revert to 5.40 behaviour: any unparsebale parameter declaration is
treated as "silently skip the next arg". This would include typos
such as 'SV* foo+'.
2) As 5.40, but add a warning that the parameter declaration is unparseable
and is being skipped.
3) Keep the new behaviour which makes it an error.
I favour 2 or 3, with leaning towards 3. But if more distros are affected,
then I would lean towards 2.
Or I've just thought of a fourth option.
We could officially sanction 'SV*' as the text for a placeholder parameter
i.e. the XS equivalent of perl's ($a, undef, $b) = (...).
Then that would work (by accident) on older versions, and would work
officially on newer releases. Any other unrecognised text would continue
to warn or die depending on which option we choose.
…--
"I do not resent criticism, even when, for the sake of emphasis,
it parts for the time with reality".
-- Winston Churchill, House of Commons, 22nd Jan 1941.
|
I've done that with a name but no defined type in the past:
|
I've just created PR #22761 with two commits. The first just adds tests to confirm that using a parameter without a type acts as a placeholder (as it always has). The second commit addresses this ticket and also ticket #22686, which are both concerned with using 'SV *' as a placeholder. Traditionally, XS silently ignored any parameter declaration it couldn't parse: so acting as a placeholder as a side-effect. My recent work made unparseable parameter declarations an error, which broke these two distributions. This commit makes an explicit exception for 'SV *', which now acts as a placeholder again. Any other unrecognised parameter declaration is still a syntax error. |
This is a bug report for perl from "Carlos Guevara" [email protected],
generated with the help of perlbug 1.43 running under perl 5.41.6.
BBC: Blead Breaks JSON::DWIW
Please see http://fast-matrix.cpantesters.org/?dist=JSON::DWIW
Flags
Perl configuration
The text was updated successfully, but these errors were encountered: