This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: fcntl.ioctl have a bit problem.
Type: behavior Stage: test needed
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: amaury.forgeotdarc, fullsail, mwh, nnorwitz
Priority: normal Keywords:

Created on 2005-08-18 08:53 by fullsail, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (6)
msg26073 - (view) Author: Raise L. Sail (fullsail) Date: 2005-08-18 08:53
First, I write python program on Linux.

The function ioctl of fcntl module, take a integer
parameter
as ioctl command. in python 2.3.x, if this command
value is more than 0x80000000, interpreter will popup
some warnning message. but in python 2.4.x, it raise a
exception directly.

My solution is writing one cutoms module in C. but this
is so ugly.

There are some ioctl command value are more than
0x80000000,  I think we should not reject "negative"
ioctl command.

enjoy.
msg26074 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2005-08-23 12:10
Logged In: YES 
user_id=6656

I think this is fixed in CVS HEAD.  Can you try that?

As a workaround, you can probably pass ~int(~v&0xFFFFFFFF) to ioctl 
instead of v (which is very ugly, yes, but probably not as ugly as a C 
extension).
msg26075 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2005-10-04 04:49
Logged In: YES 
user_id=33168

This could be related to: patch 1309352.
msg26076 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2005-10-04 10:10
Logged In: YES 
user_id=6656

Uh, no, that patch is about fcntl, this report is about ioctl.  ioctl has been 
fixed in CVS, afaik, so this report should probably be closed unless the 
OP shows up and tells us it isn't.

Something similar should almost certainly be done to fcntl.  That's what 
1309352 is about.  Maybe I should have fixed fcntl when I did ioctl, but I 
actually use ioctl and don't use fnctl myself...
msg26077 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2005-10-04 17:12
Logged In: YES 
user_id=33168

Ah, I see.  I was confused since both are in the fcntl
module.  I agree this bug isn't related to the patch.

This got me looking into fcntl.ioctl() and I wonder if
there's still not a problem.  In the patch, I had to make
arg a long which is consistent with fcntl() doc.  ioctl()
says the param is ..., so I don't know if it should be an
int or a long.  The current ioctl uses an int (lines 98 and
175).  ISTM that arg should probably be unsigned (like the
code variable) or a long here.  (By unsigned I mean at least
the format 'I' instead of 'i', if not the variable itself.)
 Any ideas?
msg89979 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-07-01 14:52
This was fixed in 2.5 with issue1231069.
History
Date User Action Args
2022-04-11 14:56:12adminsetgithub: 42288
2009-07-01 14:52:41amaury.forgeotdarcsetstatus: open -> closed

nosy: + amaury.forgeotdarc
messages: + msg89979

resolution: duplicate
2009-03-20 22:12:36ajaksu2setstage: test needed
type: behavior
versions: + Python 2.6, - Python 2.4
2005-08-18 08:53:58fullsailcreate