Giter VIP home page Giter VIP logo

Comments (13)

sudipm-mukherjee avatar sudipm-mukherjee commented on June 9, 2024 1

Thanks @thekix. It works on the simple test case I had. I have now sent the deb file to the original reporter of the problem and I will let you know after he replies. Thanks for the quick fix.

from offlineimap3.

nicolas33 avatar nicolas33 commented on June 9, 2024

The documentation says that the remotepasseval configuration option (I guess that's what is used) must return a unicode string (str). If not offlineimap fails at encoding the bytes.

I wonder offlineimap should return a more user-friendly error message, though.

from offlineimap3.

sudipm-mukherjee avatar sudipm-mukherjee commented on June 9, 2024

@nicolas33 A git grep remotepasseval doesnot show anything has changed between offlineimap and offlineimap3 so I will assume that the behaviour between them will remain same (unless I missed something). But David has mentioned in his bug report that this works with offlineimap.

from offlineimap3.

sudipm-mukherjee avatar sudipm-mukherjee commented on June 9, 2024

Just an update, I am able to reproduce the problem but I do see the problem with offlineimap also. I have requested David to reconfirm https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=973408#17 with offlineimap.

from offlineimap3.

nicolas33 avatar nicolas33 commented on June 9, 2024

Please, make sure the user is returning a str type as requested by the documentation. It was already required with offlineimap (while some unsupported use cases did not hurt).

from offlineimap3.

nicolas33 avatar nicolas33 commented on June 9, 2024

Notice that I mean str in the python3 world. This means python unicode. The user might add something like mypasswordvar.decode('utf-8') if encoded in utf-8 just before returning the password.

from offlineimap3.

sudipm-mukherjee avatar sudipm-mukherjee commented on June 9, 2024

@nicolas33 offlineimaprc has remotepasseval = subprocess.check_output(['secret-tool', 'lookup', 'isp', 'mail']).strip(). With that I have tested and it does work with offlineimap but fails with offlineimap3. But it looks to be a difference of python2 and python3.

sudip@debian:~$ python2.7  -c "import subprocess; print(subprocess.check_output(['secret-tool', 'lookup', 'isp','mail']).strip())"
test1235

`sudip@debian:~$` python3.8  -c "import subprocess; print(subprocess.check_output(['secret-tool', 'lookup', 'isp','mail']).strip())"
b'test1235'

sudip@debian:~$ python3.8  -c "import subprocess; print(subprocess.check_output(['secret-tool', 'lookup', 'isp','mail']).strip().decode('utf8'))"
test1235

So, with python2 I get test1235 which is a string and so offlineimap works. But with python3, I get a byte array (not string) and so offlineimap3 does not work which is exactly what you have said before. But after I added a decode, even though I now get a string but offlineimap3 still does not work and is now giving a different trace.

New trace:

ERROR: While attempting to sync account 'Gmail'
  sequence item 2: expected str instance, bytes found
ERROR: Exceptions occurred during the run!
ERROR: While attempting to sync account 'Gmail'
  sequence item 2: expected str instance, bytes found

Traceback:
  File "/usr/lib/python3/dist-packages/offlineimap/accounts.py", line 298, in syncrunner
    self.__sync()
  File "/usr/lib/python3/dist-packages/offlineimap/accounts.py", line 374, in __sync
    remoterepos.getfolders()
  File "/usr/lib/python3/dist-packages/offlineimap/repository/IMAP.py", line 446, in getfolders
    imapobj = self.imapserver.acquireconnection()
  File "/usr/lib/python3/dist-packages/offlineimap/imapserver.py", line 579, in acquireconnection
    self.__authn_helper(imapobj)
  File "/usr/lib/python3/dist-packages/offlineimap/imapserver.py", line 443, in __authn_helper
    if func(imapobj):
  File "/usr/lib/python3/dist-packages/offlineimap/imapserver.py", line 369, in __authn_plain
    imapobj.authenticate('PLAIN', self.__plainhandler)
  File "/usr/lib/python3/dist-packages/imaplib2.py", line 691, in authenticate
    typ, dat = self._simple_command('AUTHENTICATE', mechanism.upper())
  File "/usr/lib/python3/dist-packages/imaplib2.py", line 1684, in _simple_command
    return self._command_complete(self._command(name, *args), kw)
  File "/usr/lib/python3/dist-packages/imaplib2.py", line 1404, in _command
    literal = literator(data, rqb)
  File "/usr/lib/python3/dist-packages/imaplib2.py", line 2247, in process
    ret = self.mech(self.decode(data))
  File "/usr/lib/python3/dist-packages/offlineimap/imapserver.py", line 213, in __plainhandler
    retval = NULL.join((authz, authc, passwd))

from offlineimap3.

thekix avatar thekix commented on June 9, 2024

Hi,

sorry about my delay, I was busy these days. How can I reproduce the error? How can I configure the my user to use the remotepasseval variable? Any how-to to do it?

Thanks a lot,
regards,
kix

from offlineimap3.

sudipm-mukherjee avatar sudipm-mukherjee commented on June 9, 2024

@thekix

  1. install libsecret-tools
  2. store a password: secret-tool store --label='mail' isp mail
  3. verify the password is saved: secret-tool lookup isp mail
  4. In .offlineimaprc use remotepasseval = subprocess.check_output(['secret-tool', 'lookup', 'isp', 'mail']).strip() instead of remotepass. And add a python file with "import subprocess" to pythonfile in [general]
    My .offlineimaprc says:
[general]
ui = ttyui
accounts = Gmail
pythonfile = /home/sudip/offlineimap.py

And the file "/home/sudip/offlineimap.py" only has import subprocess

from offlineimap3.

thekix avatar thekix commented on June 9, 2024

Hi @sudipm-mukherjee

Thanks a lot for your quick reply. I think the bug is now solved. Please, can you test it?

I also uploaded some patches about code style, docstrings and some pylint warnings.

from offlineimap3.

sudipm-mukherjee avatar sudipm-mukherjee commented on June 9, 2024

@thekix thanks again, That issue is fixed now. But there is another one. And, as before it works with offlineimap but fails with offlineimap3.

Steps to reporduce:

  1. extract the attached file and use it as pythonfile in [general].
  2. Add nametrans to your .offlineimaprc.
    nametrans = lambda foldername: foldername.decode('imap4-utf-7').encode('utf-8')

Do you want me to open a separate issue for this?

offlineimap.zip

from offlineimap3.

thekix avatar thekix commented on June 9, 2024

Hi @sudipm-mukherjee

Thanks for this new report. I am working on it. Please, open a new issue to close it using the new patch, then we have these problems documented for the future.

Regards,
kix

from offlineimap3.

sudipm-mukherjee avatar sudipm-mukherjee commented on June 9, 2024

Thanks @thekix. #23 has been opened for this.

from offlineimap3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.