Message27555
Logged In: YES
user_id=288734
I've practically never used python. I just found
this bug in the interpreter while porting the
tool to the current Solaris compiler release, so please
keep that in mind about my lack of python knowledge.
I also have no idea who's who as well in the python
world so forgive me if I've stepped on anyone's
toes.
I don't follow the remark about "making ioctl
'safe'". I never said anything about making it
"safe". It's about a bug.
I also never said anything about the interpreter
crashing. The interpreter never crashed. The
pty test just simply failed since the module
name passed to the OS's ioctl was corrupted.
Are you sure you responded to the right bug
report with these remarks?
Anyways...
This problem should be reduced to a classic
data marshaling problem between python data
space and C data space which should have already
been addressed in many contexts many times before
in the interpreter. How are python strings
converted for use by C in similar situations?
This problem I encountered is either a bug in
the code that passed the string to the ioctl
service by not putting an explicit '\0' on the
end of the "ptem" string, or it is a bug in the
fcntlmodule.c which should have done it for it.
Which is it?
If a python code isn't expected to put a literal
null at the end of their string when passing to
a C service, then ioctl needs to be fixed similar
to the way in my patch.
As for null-terminating other raw data, I don't
see the point other than a defensive programming
practice.
The problem I ran across is limited to just
a data marshaling problem. The patch only
touched the case when the type of data passed
to ioctl is known to be a string.
As for the buffer vs. documentation, the
buffer could be changed to 1025 for the string
case, or the documentation could be updated
to clarify that, unlike raw data, strings are
limited to 1023 to leave room for the
requisite null that conversion to a C string
requires. I don't think anyone would care
either way as long as it is qualified.
Since python strings serve dual roles of being
both raw data and being just textual containers,
one can't assume that a string passed to ioctl
is always meant to be just a textual string. Going
the 1025 route is probably a 'better' approach due to
python string's duality.
|
|
| Date |
User |
Action |
Args |
| 2007-08-23 14:37:57 | admin | link | issue1433877 messages |
| 2007-08-23 14:37:57 | admin | create | |
|