Skip to content
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

Use correct argument type for valueDecoder method #30

Merged
merged 1 commit into from
Apr 24, 2023

Conversation

droideck
Copy link

No description provided.

@droideck
Copy link
Author

@silent-nekto, @dmiller7, @haxtibal, could you please check that this change fixes #28 issue for you?

@haxtibal
Copy link

@silent-nekto, @dmiller7, @haxtibal, could you please check that this change fixes #28 issue for you?

Changing the lambda for the recursiveFlag=True case seems correct, afaikt. Sadly it's not sufficient to resolve the pysnmp error.

pysnmp passes its own lambdas as substrateFun into the decoder. We can't change that from pyasn1 code base. Changing the substrateFun signature was an API breakage, so I'm afraid clients (like pysnmp) need to be adapted.

In 93e11a2, Ilya mentioned

Previously published API is implemented as a thin wrapper on top of that ensuring backward compatibility.

But that doesn't seem to keep substrateFun compatible, does it?

@dmiller7
Copy link

@droideck sorry this didn't work for me - as @haxtibal has said the pysnmp error is still present for me.

I'm guessing that a short term fix might be for pysnmp to change its dependencies from

pyasn1>=0.2.3

to

pyasn1>=0.2.3,<0.5

But I don't think I know enough to be sure. I was hoping that a fix might be put in place here rather than pysnmp as I think pysnmp seems to be between maintainers.

@droideck droideck merged commit ce6f7f0 into pyasn1:main Apr 24, 2023
13 checks passed
@bdraco
Copy link

bdraco commented Apr 29, 2023

https://pypi.org/project/pysnmplib/ has picked up pysnmp

edit: this turned out to be a unresolvable dependency hell conflict between pyasn1 and pysnmplib-pyasn1 since they both use the same namespace.

It would be nice to let them know about the breaking change as everything is failing with

AbstractTransportDispatcher._cbFun(<pysnmp.carri...x7ff257601110>, ('192.168.210.25', 161), b'00\x02\x01\...B\x02\x01\xef')
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.11/site-packages/pysnmp/carrier/base.py", line 80, in _cbFun
    self.__recvCallables[recvId](
  File "/usr/local/lib/python3.11/site-packages/pysnmp/entity/engine.py", line 151, in __receiveMessageCbFun
    self.msgAndPduDsp.receiveMessage(
  File "/usr/local/lib/python3.11/site-packages/pysnmp/proto/rfc3412.py", line 291, in receiveMessage
    msgVersion = verdec.decodeMessageVersion(wholeMsg)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pysnmp/proto/api/verdec.py", line 15, in decodeMessageVersion
    seq, wholeMsg = decoder.decode(
                    ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyasn1/codec/ber/decoder.py", line 2003, in __call__
    for asn1Object in streamingDecoder:
  File "/usr/local/lib/python3.11/site-packages/pyasn1/codec/ber/decoder.py", line 1918, in __iter__
    for asn1Object in self._singleItemDecoder(
  File "/usr/local/lib/python3.11/site-packages/pyasn1/codec/ber/decoder.py", line 1778, in __call__
    for value in concreteDecoder.valueDecoder(
  File "/usr/local/lib/python3.11/site-packages/pyasn1/codec/ber/decoder.py", line 654, in valueDecoder
    for chunk in substrateFun(asn1Object, substrate, length, options):

@lextm
Copy link

lextm commented Apr 29, 2023

@bdraco what you said is completely wrong. pysnmplib depends on its own pysnmp-pyasn1, not pyasn1 from this repo, https://pypistats.org/packages/pysnmplib If you mixed pysnmplib with pyasn1, then that's your own mistake.

@bdraco
Copy link

bdraco commented Apr 29, 2023

You are right about that (although not the nicest way to say it). It looks like there we have a dep conflict somewhere since we are getting both installed and pyasn1 and pysnmp-pyasn1 share the same namespace of pyasn1. https://pypi.org/project/pysnmp-pyasn1/

@bdraco
Copy link

bdraco commented Apr 29, 2023

Its actually much worse dep hell since both pysnmp-pyasn1 and pyasn1 are using the same namespace. But thats not pyasn1's fault

pysnmp-pyasn1==1.1.2
  - pysnmplib==5.0.21 [requires: pysnmp-pyasn1>=1.0.3,<2.0.0]
    - brother==2.3.0 [requires: pysnmplib>=5.0.21]
pyasn1==0.4.8
  - adb-shell==0.4.3 [requires: pyasn1]
    - androidtv==0.0.70 [requires: adb-shell>=0.4.0]
  - oauth2client==4.1.3 [requires: pyasn1>=0.1.7]
  - pyasn1-modules==0.2.8 [requires: pyasn1>=0.4.6,<0.5.0]
    - google-auth==2.17.3 [requires: pyasn1-modules>=0.2.1]
      - gassist-text==0.0.10 [requires: google-auth>=0.3.0,<3]
      - google-api-core==2.11.0 [requires: google-auth>=2.14.1,<3.0dev]
        - google-api-python-client==2.71.0 [requires: google-api-core>=1.31.5,<3.0.0dev,!=2.3.0,!=2.2.*,!=2.1.*,!=2.0.*]
        - google-cloud-pubsub==2.13.11 [requires: google-api-core>=1.32.0,<3.0.0dev,!=2.7.*,!=2.6.*,!=2.5.*,!=2.4.*,!=2.3.*,!=2.2.*,!=2.1.*,!=2.0.*]
          - google-nest-sdm==2.2.4 [requires: google-cloud-pubsub>=2.1.0]
      - google-api-python-client==2.71.0 [requires: google-auth>=1.19.0,<3.0.0dev]
      - google-auth-httplib2==0.1.0 [requires: google-auth]
        - google-api-python-client==2.71.0 [requires: google-auth-httplib2>=0.1.0]
      - google-auth-oauthlib==1.0.0 [requires: google-auth>=2.15.0]
        - google-nest-sdm==2.2.4 [requires: google-auth-oauthlib>=0.4.1]
        - gspread==5.5.0 [requires: google-auth-oauthlib>=0.4.1]
      - google-nest-sdm==2.2.4 [requires: google-auth>=1.22.0]
      - gspread==5.5.0 [requires: google-auth>=1.12.0]
    - oauth2client==4.1.3 [requires: pyasn1-modules>=0.0.5]
    - slixmpp==1.8.2 [requires: pyasn1-modules]
      - aioharmony==0.2.10 [requires: slixmpp]
  - pysmb==1.2.9.1 [requires: pyasn1]
    - pyairvisual==2022.12.1 [requires: pysmb>=1.2.6,<2.0.0]
  - python-jose==3.3.0 [requires: pyasn1]
    - pycognito==2022.12.0 [requires: python-jose>=3.2.0]
      - hass-nabucasa==0.66.2 [requires: pycognito==2022.12.0]
    - warrant-lite==1.0.4 [requires: python-jose>=3.0,<4.0]
      - pyoverkiz==1.7.7 [requires: warrant-lite>=1.0.4,<2.0.0]
  - rsa==4.8 [requires: pyasn1>=0.1.3]
    - adb-shell==0.4.3 [requires: rsa]
      - androidtv==0.0.70 [requires: adb-shell>=0.4.0]
    - google-auth==2.17.3 [requires: rsa>=3.1.4,<5]
      - gassist-text==0.0.10 [requires: google-auth>=0.3.0,<3]
      - google-api-core==2.11.0 [requires: google-auth>=2.14.1,<3.0dev]
        - google-api-python-client==2.71.0 [requires: google-api-core>=1.31.5,<3.0.0dev,!=2.3.0,!=2.2.*,!=2.1.*,!=2.0.*]
        - google-cloud-pubsub==2.13.11 [requires: google-api-core>=1.32.0,<3.0.0dev,!=2.7.*,!=2.6.*,!=2.5.*,!=2.4.*,!=2.3.*,!=2.2.*,!=2.1.*,!=2.0.*]
          - google-nest-sdm==2.2.4 [requires: google-cloud-pubsub>=2.1.0]
      - google-api-python-client==2.71.0 [requires: google-auth>=1.19.0,<3.0.0dev]
      - google-auth-httplib2==0.1.0 [requires: google-auth]
        - google-api-python-client==2.71.0 [requires: google-auth-httplib2>=0.1.0]
      - google-auth-oauthlib==1.0.0 [requires: google-auth>=2.15.0]
        - google-nest-sdm==2.2.4 [requires: google-auth-oauthlib>=0.4.1]
        - gspread==5.5.0 [requires: google-auth-oauthlib>=0.4.1]
      - google-nest-sdm==2.2.4 [requires: google-auth>=1.22.0]
      - gspread==5.5.0 [requires: google-auth>=1.12.0]
    - oauth2client==4.1.3 [requires: rsa>=3.1.4]
    - python-jose==3.3.0 [requires: rsa]
      - pycognito==2022.12.0 [requires: python-jose>=3.2.0]
        - hass-nabucasa==0.66.2 [requires: pycognito==2022.12.0]
      - warrant-lite==1.0.4 [requires: python-jose>=3.0,<4.0]
        - pyoverkiz==1.7.7 [requires: warrant-lite>=1.0.4,<2.0.0]
  - slixmpp==1.8.2 [requires: pyasn1]
    - aioharmony==0.2.10 [requires: slixmpp]

@bdraco
Copy link

bdraco commented Apr 29, 2023

Opened pysnmp/pysnmp#51 to see if pysnmp-pyasn1 could be dropped now that asn1 has a maintainer to fix the dep hell.

@lextm
Copy link

lextm commented Apr 29, 2023

@bdraco This is not a dep hell, but what naturally happened when people tried to save a collapsed stack like pysnmp. Please read etingof/pysnmp#429 to learn more of the background.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants