mbj4668 / pyang

An extensible YANG validator and converter in python
ISC License
530 stars 342 forks source link

pyang 2.5.3 is broken under Ubuntu jammy (conflicting option string error) #813

Open ClemsonJeeper opened 2 years ago

ClemsonJeeper commented 2 years ago

root@086d13eff3dd:~# pyang -v pyang 2.5.3 root@086d13eff3dd:~# pyang --plugindir=/usr/local/lib/python3.10/dist-packages/pyang/plugins Traceback (most recent call last): File "/usr/local/bin/pyang", line 580, in <module> run() File "/usr/local/bin/pyang", line 215, in run p.add_opts(optparser) File "/usr/local/lib/python3.10/dist-packages/pyang/plugins/lint.py", line 67, in add_opts optparser.add_options(optlist) File "/usr/lib/python3.10/optparse.py", line 1027, in add_options self.add_option(option) File "/usr/lib/python3.10/optparse.py", line 1008, in add_option self._check_conflict(option) File "/usr/lib/python3.10/optparse.py", line 980, in _check_conflict raise OptionConflictError( optparse.OptionConflictError: option --lint: conflicting option string(s): --lint

2.5.2 works fine:

`root@086d13eff3dd:~# pyang -v pyang 2.5.2 root@086d13eff3dd:~# pyang --plugindir=/usr/local/lib/python3.10/dist-packages/pyang/plugins

:0: error: premature end of file` Looks like changes in pyang binary itself might be the culprit
mbj4668 commented 2 years ago

FWIW, this is not just ubuntu jammy, and not just pyang 2.5.3. You get the same problem in earlier pyang versions if you do pyang --plugindir DIR (i.e. w/o the =).

The bug is that we try to initialize the same plugin twice b/c you're adding the default plugindir to the pluginpath.

So the simple workaround is to not add the default plugindir.