Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 446610 - sys-apps/portage-2.1.11.31 ctypes syncfs with pypy triggers RuntimeWarning: C function without declared arguments called
Summary: sys-apps/portage-2.1.11.31 ctypes syncfs with pypy triggers RuntimeWarning: C...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Low enhancement (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 445274
  Show dependency tree
 
Reported: 2012-12-09 15:43 UTC by Alex Xu (Hello71)
Modified: 2013-01-10 15:34 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Xu (Hello71) 2012-12-09 15:43:39 UTC
Consistently reproducible with different versions of pypy while unmerging (or depcleaning, but surprisingly *not* while installing or autocleaning):

/usr/lib64/portage/pym/portage/dbapi/vartree.py:4749: RuntimeWarning: C function without declared arguments called
  syncfs(fd)

I'm not familiar with Python or this codebase, but it *does* seem that syncfs is being called with an undefined argument in that scope, as fd is defined in the other if branch.
Comment 1 Zac Medico gentoo-dev 2012-12-09 20:38:00 UTC
It seems like a bug in pypy, because the relevant code should never call syncfs with an invalid file descriptor:

	try:
		fd = os.open(path, os.O_RDONLY)
	except OSError:
		pass
	else:
		try:
			syncfs(fd)
		except OSError:
			pass
		finally:
			os.close(fd)

If os.open fails, then it's supposed to raise OSError, and the else branch is not supposed to execute.
Comment 2 Zac Medico gentoo-dev 2012-12-27 03:16:12 UTC
I've reproduced this problem with pypy-2.0_beta1. It produces this warning message and returns -1 for all ctypes calls that I've tried. Here's a workaround which detects the failure and calls the "sync" program instead:

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9f65889534279731f4b00af243c1edc885eece09
Comment 3 Dirkjan Ochtman (RETIRED) gentoo-dev 2012-12-27 08:41:55 UTC
Have you filed a pypy bug yet?
Comment 4 Zac Medico gentoo-dev 2012-12-27 08:51:19 UTC
(In reply to comment #3)
> Have you filed a pypy bug yet?

No, I have not.
Comment 5 Zac Medico gentoo-dev 2013-01-10 15:34:24 UTC
The syncfs return value handling is in 2.1.11.39 and 2.2.0_alpha150.