[issue30430] Cannot write to a tun interface file

2017-05-22 Thread Rémy Léone
Rémy Léone added the comment: I've tackle the 1. by replacing write/open with os.write/os.open. I still get : $ python3 simple_incorrect.py b'\xc3\xa9' Traceback (most recent call last): File "simple_incorrect.py", line 32, in os.write(tun, incorrect_frame) OSError: [Errno 22] Invalid argu

[issue30430] Cannot write to a tun interface file

2017-05-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: I know nothing about TUN but you may simply be hitting this code path: https://github.com/spotify/linux/blob/master/drivers/net/tun.c#L601-L614 Since: >>> ('e'.encode()[0] & 0xf0) in (0x40, 0x60) True >>> ('é'.encode()[0] & 0xf0) in (0x40, 0x60) False writing '

[issue30430] Cannot write to a tun interface file

2017-05-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: So basically the write() system call seems to be returning EINVAL. Can I suggest the following steps: 1. try to reproduce using os.open() and os.write() instead of open() and write() (just to make sure something doesn't get in the way) 2. if it still fails,

[issue30430] Cannot write to a tun interface file

2017-05-22 Thread Rémy Léone
Rémy Léone added the comment: The question I'm the most interested about is why depending on what the bytes object contains I get a different result. In one case the bytes are written fine to the TUN interface file descriptor and in the other case I get an Errno22. My assumption is that the by

[issue30430] Cannot write to a tun interface file

2017-05-22 Thread Rémy Léone
Rémy Léone added the comment: Traceback (most recent call last): File "simple_incorrect.py", line 31, in tun.write(incorrect_frame) OSError: [Errno 22] Invalid argument -- ___ Python tracker

[issue30430] Cannot write to a tun interface file

2017-05-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: Would you care to post the detailed error and traceback here? Not everyone wants to set up a TUN interface to try to reproduce :-) -- nosy: +pitrou ___ Python tracker ___

[issue30430] Cannot write to a tun interface file

2017-05-22 Thread Rémy Léone
New submission from Rémy Léone: I cannot write certain bytes object to a tun interface file. I've added a working and unworking example in the attached file. I'm running on Ubuntu16.04 with Python 3.5.2 -- components: IO files: simple_incorrect.py messages: 294143 nosy: Rémy Léone prior