Bugs item #1226969, was opened at 2005-06-24 15:05 Message generated for change (Comment added) made by loewis You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1226969&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: Python Interpreter Core Group: Python 2.4 >Status: Closed >Resolution: Invalid Priority: 5 Submitted By: jacobo_es (jacobo_es) Assigned to: Nobody/Anonymous (nobody) Summary: segfault in os module Initial Comment: python crashes when a bad parameters are passed to execl function of the os module: >>> import os >>> os.execl("/bin/bash") Segmentation Fault (core dumped) No matter the platform (on ppc raises a bus error) and the version of C compiler, always crashes, python versions used are 2.4.1 and 2.4c1. Proved on MacOSX (ppc), and Knoppix, Red Hat Enterprise and debian woody 3.0 (x86). However, on 2.2.3 version not crashes. ---------------------------------------------------------------------- >Comment By: Martin v. Löwis (loewis) Date: 2005-08-06 15:19 Message: Logged In: YES user_id=21627 There is nothing wrong with Python here. It is not Python that crashes, but /bin/bash. Just try a different binary (/usr/bin/id worked for me); use strace to see that it is indeed the new process that crashes. Closing as invalid. ---------------------------------------------------------------------- Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-06-26 08:19 Message: Logged In: YES user_id=1188172 First, Python does not call the C execl functions, but translates them to execv calls. For execv called like Python does: ~/tmp> ./execv zsh: 15395 segmentation fault ./execv ~/tmp> cat execv.c #include <unistd.h> #include <errno.h> int main() { const char* args[1]; args[0] = NULL; execv("/bin/bash", args); return errno; } For execl on the C layer, my Linux doesn't want that: ~/tmp> gcc -o execl execl.c execl.c: In function `main': execl.c:4: error: too few arguments to function 'execl' ~/tmp> cat execv.c #include <unistd.h> int main() { execl("/bin/bash"); return 0; } ---------------------------------------------------------------------- Comment By: jacobo_es (jacobo_es) Date: 2005-06-26 01:15 Message: Logged In: YES user_id=1302185 I tried this directly on the C layer, too, and not raises a signal 11, segmentation fault, just the function execl() isn't executed and the program flow goes, not raises a sigsegv, and that's not happen in the same way in python, that abort the python interpreter and dump a core file. -( tmp )- ./p execl not executed. -( tmp )- cat p.c #include <stdio.h> int main() { execl("/bin/bash"); fprintf(stderr, "execl not executed.\n"); exit(-1); } ---------------------------------------------------------------------- Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-06-24 16:53 Message: Logged In: YES user_id=1188172 This behaviour was introduced with the fixing of bug #952953, where someone complained that he couldn't call execl with only one argument. I tried this directly on the C layer on Linux, and it segfaults too. Are there OSes where this is legal? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1226969&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com