{"action":"created","issue":{"url":"https://api.github.com/repos/DanBloomberg/leptonica/issues/220","repository_url":"https://api.github.com/repos/DanBloomberg/leptonica","labels_url":"https://api.github.com/repos/DanBloomberg/leptonica/issues/220/labels{/name}","comments_url":"https://api.github.com/repos/DanBloomberg/leptonica/issues/220/comments","events_url":"https://api.github.com/repos/DanBloomberg/leptonica/issues/220/events","html_url":"https://github.com/DanBloomberg/leptonica/pull/220","id":188793813,"number":220,"title":"Handle $TMPDIR when located under /tmp","user":{"login":"knowledgejunkie","id":486417,"avatar_url":"https://avatars.githubusercontent.com/u/486417?v=3","gravatar_id":"","url":"https://api.github.com/users/knowledgejunkie","html_url":"https://github.com/knowledgejunkie","followers_url":"https://api.github.com/users/knowledgejunkie/followers","following_url":"https://api.github.com/users/knowledgejunkie/following{/other_user}","gists_url":"https://api.github.com/users/knowledgejunkie/gists{/gist_id}","starred_url":"https://api.github.com/users/knowledgejunkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knowledgejunkie/subscriptions","organizations_url":"https://api.github.com/users/knowledgejunkie/orgs","repos_url":"https://api.github.com/users/knowledgejunkie/repos","events_url":"https://api.github.com/users/knowledgejunkie/events{/privacy}","received_events_url":"https://api.github.com/users/knowledgejunkie/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-11-11T16:12:11Z","updated_at":"2016-11-27T22:56:45Z","closed_at":"2016-11-11T17:52:01Z","pull_request":{"url":"https://api.github.com/repos/DanBloomberg/leptonica/pulls/220","html_url":"https://github.com/DanBloomberg/leptonica/pull/220","diff_url":"https://github.com/DanBloomberg/leptonica/pull/220.diff","patch_url":"https://github.com/DanBloomberg/leptonica/pull/220.patch"},"body":"When adding the remainder of the cdir string to give the full value of pathout in genPathname(), the current code hardcodes a $TMPDIR string length of 4 characters (src/utils.c, lines 3004-5).\r\n\r\nThe result of this hardcoding is that the function will re-append any additional characters in the $TMPDIR string beyond \"/tmp\" into the pathout string when determining its full contents.\r\n\r\nThis causes failures when trying to open and write to files in $TMPDIR on Debian (and possibly other Linux distributions) that do not use plain /tmp as $TMPDIR for an unprivileged user. On Debian, a regular user's $TMPDIR is /tmp/username, not /tmp.\r\n\r\nThis commit aims to ensure that the full $TMPDIR string length is used and that only nested path entries below $TMPDIR (and not \"/tmp\") are appended when determining pathout.\r\n\r\nDiagnosed using strace after failures running tesseract-ocr and gscan2pdf. No failures were observed when running as the superuser; strace confirmed the issue was broken pathnames and not r/w privileges."},"comment":{"url":"https://api.github.com/repos/DanBloomberg/leptonica/issues/comments/263154122","html_url":"https://github.com/DanBloomberg/leptonica/pull/220#issuecomment-263154122","issue_url":"https://api.github.com/repos/DanBloomberg/leptonica/issues/220","id":263154122,"user":{"login":"chewi","id":35072,"avatar_url":"https://avatars.githubusercontent.com/u/35072?v=3","gravatar_id":"","url":"https://api.github.com/users/chewi","html_url":"https://github.com/chewi","followers_url":"https://api.github.com/users/chewi/followers","following_url":"https://api.github.com/users/chewi/following{/other_user}","gists_url":"https://api.github.com/users/chewi/gists{/gist_id}","starred_url":"https://api.github.com/users/chewi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chewi/subscriptions","organizations_url":"https://api.github.com/users/chewi/orgs","repos_url":"https://api.github.com/users/chewi/repos","events_url":"https://api.github.com/users/chewi/events{/privacy}","received_events_url":"https://api.github.com/users/chewi/received_events","type":"User","site_admin":false},"created_at":"2016-11-27T22:56:45Z","updated_at":"2016-11-27T22:56:45Z","body":"I may be misunderstanding you but I don't think so, `dir` will begin `/tmp` on entering the function. As I said, this worked under 1.73. I'll try to figure this out ASAP."}}
{"actor":{"display_login":"chewi"}}