Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix daemon.is_fifo and .is_mq under Python 3 #4

Closed
wants to merge 1 commit into from
Closed

Fix daemon.is_fifo and .is_mq under Python 3 #4

wants to merge 1 commit into from

Conversation

Jajcus
Copy link
Contributor

@Jajcus Jajcus commented Aug 7, 2015

The 'path' parameter was not properly converted from Unicode
and the functions would always fail when a path was provided.

Test code:

#!/usr/bin/python3

import os
import posix
from systemd.daemon import _is_fifo

posix.mkfifo("test.fifo")
try:
    assert not _is_fifo(0, None)
    assert not _is_fifo(0, "test.fifo")
    fd = os.open("test.fifo", os.O_RDONLY|os.O_NONBLOCK)
    assert _is_fifo(fd, None)
    assert _is_fifo(fd, "test.fifo")
finally:
    os.unlink("test.fifo")

The 'path' parameter was not properly converted from Unicode
and the functions would always fail when a path was provided.
mmazur pushed a commit to pld-linux/systemd that referenced this pull request Aug 7, 2015
keszybz pushed a commit that referenced this pull request Aug 7, 2015
The 'path' parameter was not properly converted from Unicode
and the functions would always fail when a path was provided.

#4
keszybz added a commit that referenced this pull request Aug 7, 2015
This is based on the code in #4
by Jacek Konieczny <j.konieczny@eggsoft.pl>.
@keszybz
Copy link
Member

keszybz commented Aug 7, 2015

Merged as 71d8261. Thanks!

No tabs please. I also started a 'tests' branch based on your example. Will merge it to master when there's more of them. Adding a proper test suite has been on my todo list for ever... I'd be happy to take pull requests with tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants