[ python-Bugs-1521375 ] ctypes test overwrites /dev/null
SourceForge.net
noreply at sourceforge.net
Thu Jul 13 15:56:59 CEST 2006
Bugs item #1521375, was opened at 2006-07-12 13:22
Message generated for change (Comment added) made by scotdoyle
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1521375&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Scot Doyle (scotdoyle)
Assigned to: Thomas Heller (theller)
Summary: ctypes test overwrites /dev/null
Initial Comment:
Steps to reproduce on Debian Sarge:
1. ls -l /dev/null
2. wget
http://www.python.org/ftp/python/2.5/Python-2.5b2.tgz
3. tar xvzf Pyth*
4. cd Pyth*
5. ./configure
6. make
7. su
8. make test
9. ls -l /dev/null
/dev/null goes from being a special character device to
a normal file of length zero.
The following command can be used instead of step 8
above to delete /dev/null
./python -c 'import ctypes.test.test_find'
To recreate /dev/null:
1. su
2. rm /dev/null
3. mknod -m 666 /dev/null c 1 3
4. chown root:root /dev/null
----------------------------------------------------------------------
>Comment By: Scot Doyle (scotdoyle)
Date: 2006-07-13 08:56
Message:
Logged In: YES
user_id=1554504
Yes, not executing the command was one way to fix the bug :-)
Thanks for catching that. I verified the new patch to work.
----------------------------------------------------------------------
Comment By: Thomas Heller (theller)
Date: 2006-07-13 03:28
Message:
Logged In: YES
user_id=11105
Scot, your patch is not correct because 'cmd' is never
executed. However, I was able to reproduce the overwriting
of /dev/null by calling 'ctypes.util.find_library' for a
shared lib that does not exist. Attached is a new patch
'util.diff' which fixes the problem for me. Can you please
verify that it also works for you?
Thanks for finding the bug and locating the problem!
----------------------------------------------------------------------
Comment By: Scot Doyle (scotdoyle)
Date: 2006-07-12 17:17
Message:
Logged In: YES
user_id=1554504
Hey Thomas, that pointer is just what I needed :-)
/dev/null was being deleted by gcc. Discussion at
http://www.cs.helsinki.fi/linux/linux-kernel/2001-38/1503.html
The attached patch fixed the problem on Debian Sarge and
Ubuntu 6.06.
----------------------------------------------------------------------
Comment By: Thomas Heller (theller)
Date: 2006-07-12 13:53
Message:
Logged In: YES
user_id=11105
Now, that is an 'interesting' bug. ctypes.util.find_library
does execute shell commands that happen to have '/dev/null'
in them, but it is completely unclear to me how one can
overwrite /dev/null (even if root). Can you see anything
that's wrong there (That code is not from me, and I'm not at
all an expert in linux programming)?
BTW, I cannot reproduce this on ubuntu with 'sudo ./python
-c "import ctypes.test.test_find"'.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1521375&group_id=5470
More information about the Python-bugs-list
mailing list