{"action":"created","issue":{"url":"https://api.github.com/repos/OfflineIMAP/offlineimap/issues/466","repository_url":"https://api.github.com/repos/OfflineIMAP/offlineimap","labels_url":"https://api.github.com/repos/OfflineIMAP/offlineimap/issues/466/labels{/name}","comments_url":"https://api.github.com/repos/OfflineIMAP/offlineimap/issues/466/comments","events_url":"https://api.github.com/repos/OfflineIMAP/offlineimap/issues/466/events","html_url":"https://github.com/OfflineIMAP/offlineimap/issues/466","id":228885682,"number":466,"title":"Add `--batch` option to skip interactive password prompts","user":{"login":"shtrom","id":160280,"avatar_url":"https://avatars0.githubusercontent.com/u/160280?v=3","gravatar_id":"","url":"https://api.github.com/users/shtrom","html_url":"https://github.com/shtrom","followers_url":"https://api.github.com/users/shtrom/followers","following_url":"https://api.github.com/users/shtrom/following{/other_user}","gists_url":"https://api.github.com/users/shtrom/gists{/gist_id}","starred_url":"https://api.github.com/users/shtrom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shtrom/subscriptions","organizations_url":"https://api.github.com/users/shtrom/orgs","repos_url":"https://api.github.com/users/shtrom/repos","events_url":"https://api.github.com/users/shtrom/events{/privacy}","received_events_url":"https://api.github.com/users/shtrom/received_events","type":"User","site_admin":false},"labels":[{"id":10007144,"url":"https://api.github.com/repos/OfflineIMAP/offlineimap/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-05-16T00:51:04Z","updated_at":"2017-05-28T23:45:55Z","closed_at":"2017-05-20T22:38:53Z","body":"When passwords are stored in a separate (GPG-encrypted) store, and OfflineIMAP is started periodically by the system, it hangs when the GPG agent cannot decrypt the password (e.g., no passphrase cached), OfflineIMAP hangs indefinitely on the failure and doesn't remove the lock file, thus preventing any later instance (when a passphrase has been entered) from running.\r\n\r\n#### General informations\r\n\r\n- OS X Sierra\r\n- `offlineimap v7.1.0, imaplib2 v2.57 (bundled), Python v2.7.13`\r\n- CLI options: launched by `launchd` periodically\r\n```\r\n?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\r\n<plist version=\"1.0\">\r\n  <dict>\r\n    <key>EnvironmentVariables</key>\r\n    <dict>\r\n      <key>PATH</key>\r\n      <string>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin</string>\r\n    </dict>\r\n    <key>KeepAlive</key>\r\n    <false/>\r\n    <key>Label</key>\r\n    <string>homebrew.mxcl.offlineimap</string>\r\n    <key>ProgramArguments</key>\r\n    <array>\r\n      <string>/usr/local/opt/offlineimap/bin/offlineimap</string>\r\n    </array>\r\n    <key>StartInterval</key>\r\n    <integer>300</integer>\r\n    <key>RunAtLoad</key>\r\n    <true />\r\n    <key>StandardErrorPath</key>\r\n    <string>/dev/null</string>\r\n    <key>StandardOutPath</key>\r\n    <string>/dev/null</string>\r\n  </dict>\r\n</plist>\r\n```\r\n\r\n\r\n#### Configuration file offlineimaprc\r\nThe problem is when using pass with a GPG agent, but no passphrase configured in the agent (e.g., at night when I'm not at the station)\r\n\r\n```\r\nremotepasseval = get_pass(\"server/account\")\r\n```\r\n\r\n#### pythonfile (if any)\r\n\r\n```\r\n#! /usr/bin/env python\r\nfrom subprocess import check_output\r\n\r\ndef get_pass(account):\r\n        return check_output(\"pass %s | head -n 1\" % (account), shell=True).rstrip().decode(\"utf-8\")\r\n\r\nif __name__ == \"__main__\":\r\n    import sys\r\n    print(get_pass(sys.argv[1]))\r\n```\r\n\r\n#### Logs, error\r\n\r\n```\r\nomehani@ombp:~$ offlineimap\r\nOfflineIMAP 7.1.0\r\n  Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)\r\nAccount sync Account:\r\n *** Processing account Account\r\nAccount sync Account:\r\n Establishing connection to mail.account.net:993 (Account)\r\ngpg: decryption failed: No secret key\r\nEnter password for account 'Account':```\r\n\r\nIn batch mode, OfflineIMAP should just skip over the interactive password request.\r\n\r\n#### Steps to reproduce the error\r\n\r\n- Clear the GPG passphrase from the agent\r\n- Wait for the launchctl task to kick offs\r\n\r\nResult:\r\n- offlineimap process hangs indefinitely, and lockfile present for the account\r\n\r\nExpected result (if using a new option, e.g., `--batch`):\r\n- skip over any missing password and don't ask for input\r\n- clear up lock and terminate for accounts with missing info\r\n"},"comment":{"url":"https://api.github.com/repos/OfflineIMAP/offlineimap/issues/comments/304547903","html_url":"https://github.com/OfflineIMAP/offlineimap/issues/466#issuecomment-304547903","issue_url":"https://api.github.com/repos/OfflineIMAP/offlineimap/issues/466","id":304547903,"user":{"login":"nicolas33","id":90065,"avatar_url":"https://avatars3.githubusercontent.com/u/90065?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolas33","html_url":"https://github.com/nicolas33","followers_url":"https://api.github.com/users/nicolas33/followers","following_url":"https://api.github.com/users/nicolas33/following{/other_user}","gists_url":"https://api.github.com/users/nicolas33/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolas33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolas33/subscriptions","organizations_url":"https://api.github.com/users/nicolas33/orgs","repos_url":"https://api.github.com/users/nicolas33/repos","events_url":"https://api.github.com/users/nicolas33/events{/privacy}","received_events_url":"https://api.github.com/users/nicolas33/received_events","type":"User","site_admin":false},"created_at":"2017-05-28T23:45:55Z","updated_at":"2017-05-28T23:45:55Z","body":"Good idea! :-)"}}
{"actor":{"display_login":"nicolas33"}}