mbj4668 / pyang

An extensible YANG validator and converter in python
ISC License
535 stars 344 forks source link

Check for copyright statement should be relaxed #757

Closed llhotka closed 2 years ago

llhotka commented 3 years ago

In the --ietf mode, pyang checks for the presence of IETF Trust copyright statement and requires that the module description contain text matching the following regular expression (lines 143–155 in pyang/plugins/ietf.py):

r"""Copyright \(c\) [0-9]+ IETF Trust and the persons identified as
authors of the code\.  All rights reserved\.

Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4\.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
\(https?://trustee.ietf.org/license-info\)\.

This version of this YANG module is part of
RFC .+(\s+\(https?://www.rfc-editor.org/info/rfc.+\))?; see
the RFC itself for full legal notices\."""

This is too strict and may lead to false warnings – especially the last paragraph may not be appropriate in some cases. For example, in draft-ietf-dnsop-iana-class-type-yang the YANG module itself isn't contained in the RFC but generated from an IANA registry, so a different wording is needed.

RFC 8407 only requires in section 3.1 that [the] module "description" statement MUST contain a reference to the latest approved IETF Trust Copyright statement …

I would therefore suggest to at least remove the last paragraph from the copyright statement check.

mbj4668 commented 2 years ago

This seems reasonable, since the last paragraph isn't part of the TLP.

However, it might be useful to still check for the last paragraph if the module is an IETF module (name is ietf-...)

llhotka commented 2 years ago

I would then change it to a warning, as RFC 8407 doesn't require this exact wording.

mbj4668 commented 2 years ago

Agreed. But note that the current test is also just a warning.

llhotka commented 2 years ago

Aha, OK, isn't it that all warnings are turned into errors in --strict or --ietf modes?

Anyhow, given that pyang --ietf is involved in several places of the RFC workflow, I think it should interfere with it only in case of violating RFC 8407 requirements. We cannot expect an RFC editor to be able to judge whether pyang's complaints may be ignored or not.