Skip to content

fixed RuntimeError in setup.py caused by pandoc on non-amd64 arches#820

Merged
zachriggle merged 1 commit intoGallopsled:devfrom
WGH-:pandoc-non-amd64-fix
Dec 29, 2016
Merged

fixed RuntimeError in setup.py caused by pandoc on non-amd64 arches#820
zachriggle merged 1 commit intoGallopsled:devfrom
WGH-:pandoc-non-amd64-fix

Conversation

@WGH-
Copy link
Copy Markdown
Contributor

@WGH- WGH- commented Dec 18, 2016

If pandoc is not installed locally, pwntools' setup.py tells pypandoc to download one.

Unfortunately, it fails on non-amd64 arches because
pypandocs provides precompiled binaries only for amd64.

Since pypandoc is not hard dependency for pwntools,
this error can be skipped without major harm.

In fact, pwntools' setup.py already handles ImportError
gracefully. The problem is, arch mismatch causes
a completely different exception.

@zachriggle
Copy link
Copy Markdown
Member

So you're running a 32-bit Python interpreter on a 64-bit OS?

setup.py Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this to handle all exceptions ("Exception as e") and simply print it out and continue.

@WGH-
Copy link
Copy Markdown
Contributor Author

WGH- commented Dec 19, 2016

Actually, I encountered this problem on 32 bit ARM. But it will manifest on any 32 bit machine, obviously.

@zachriggle
Copy link
Copy Markdown
Member

zachriggle commented Dec 19, 2016 via email

@zachriggle
Copy link
Copy Markdown
Member

zachriggle commented Dec 19, 2016 via email

@WGH-
Copy link
Copy Markdown
Contributor Author

WGH- commented Dec 19, 2016

Then how did you install a 64-bit pandoc? I'm confused.

I never did.

The message printed by pypandoc is somewhat misleading. pypandoc has hardcoded binary packages only for amd64. It (erroneously) assumes only i386 and amd64 ever exist, so instead of actually checking the arch, it checks arch word size. Since arm arch happens to be 32 bit one, the check fails.

https://github.com/bebraw/pypandoc/blob/master/pypandoc/pandoc_download.py#L139

I guess if you would try to call pypandoc.download_pandoc() on 64 bit arm (aarch64), it would try to install package for amd64, which would either fail a bit later or result in non-working installation.

If pandoc is not installed locally, pwntools' setup.py
tells pypandoc to download one.

Unfortunately, it fails on non-amd64 arches because
pypandocs provides precompiled binaries only for amd64.

Since pypandoc is not hard dependency for pwntools,
this error can be skipped without major harm.

In fact, pwntools' setup.py already handles ImportError
gracefully. The problem is, arch mismatch causes
a completely different exception.
@WGH- WGH- force-pushed the pandoc-non-amd64-fix branch from 451b283 to 0324ad5 Compare December 19, 2016 11:47
@WGH-
Copy link
Copy Markdown
Contributor Author

WGH- commented Dec 19, 2016

So I changed PR to catch all exceptions instead. Please check.

@zachriggle
Copy link
Copy Markdown
Member

This sounds like a PyPandoc issue, not a Pwntools issue. Please report this issue to PyPandoc and link to the issue here.

@zachriggle zachriggle added the bug label Dec 19, 2016
@zachriggle zachriggle added this to the Someday milestone Dec 19, 2016
@WGH-
Copy link
Copy Markdown
Contributor Author

WGH- commented Dec 25, 2016

In a way, it's indeed a pypandoc issue. I'll make an issue there.

However, the only way for them to fix it is to raise proper exception (or make binaries for all possible platforms, which sounds unlikely) instead of the one with misleading message. From the pwntools' perspective, nothing will change much, and this PR will still be ok.

@zachriggle
Copy link
Copy Markdown
Member

Yep! I just want to be able to cross-reference their issue

@zachriggle zachriggle merged commit b584ca3 into Gallopsled:dev Dec 29, 2016
@TethysSvensson TethysSvensson modified the milestones: 3.5.0, Someday Jan 10, 2017
@WGH- WGH- deleted the pandoc-non-amd64-fix branch July 21, 2017 21:59
Kyle-Kyle pushed a commit to Kyle-Kyle/pwntools that referenced this pull request Apr 25, 2021
* Added installation configuration for Gentoo

* Added check for sudo command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants