Don't let python die if no args are passed in
This commit is contained in:
parent
bcb2ee8134
commit
a101798a46
|
@ -1,17 +1,5 @@
|
|||
--- Python-2.4.1/pyconfig.h.in.canonicalize 2005-09-14 11:47:04.000000000 -0400
|
||||
+++ Python-2.4.1/pyconfig.h.in 2005-09-14 11:47:02.000000000 -0400
|
||||
@@ -58,6 +58,9 @@
|
||||
/* Define if pthread_sigmask() does not work on your system. */
|
||||
#undef HAVE_BROKEN_PTHREAD_SIGMASK
|
||||
|
||||
+/* Define to 1 if you have the `canonicalize_file_name' function. */
|
||||
+#undef HAVE_CANONICALIZE_FILE_NAME
|
||||
+
|
||||
/* Define to 1 if you have the `chown' function. */
|
||||
#undef HAVE_CHOWN
|
||||
|
||||
--- Python-2.4.1/Python/sysmodule.c.canonicalize 2005-09-14 11:53:30.000000000 -0400
|
||||
+++ Python-2.4.1/Python/sysmodule.c 2005-09-14 11:53:30.000000000 -0400
|
||||
--- Python-2.4.1/Python/sysmodule.c.canonicalize 2005-01-27 13:58:30.000000000 -0500
|
||||
+++ Python-2.4.1/Python/sysmodule.c 2005-09-23 10:48:14.000000000 -0400
|
||||
@@ -1168,11 +1168,13 @@
|
||||
void
|
||||
PySys_SetArgv(int argc, char **argv)
|
||||
|
@ -26,32 +14,32 @@
|
|||
PyObject *av = makeargvobject(argc, argv);
|
||||
PyObject *path = PySys_GetObject("path");
|
||||
if (av == NULL)
|
||||
@@ -1180,6 +1182,25 @@
|
||||
if (PySys_SetObject("argv", av) != 0)
|
||||
Py_FatalError("can't assign sys.argv");
|
||||
if (path != NULL) {
|
||||
@@ -1184,6 +1186,25 @@
|
||||
char *p = NULL;
|
||||
int n = 0;
|
||||
PyObject *a;
|
||||
+#ifdef HAVE_CANONICALIZE_FILE_NAME
|
||||
+ char *argv0;
|
||||
+ int n = 0;
|
||||
+ int errnum;
|
||||
+ PyObject *a;
|
||||
+
|
||||
+
|
||||
+ argv0 = canonicalize_file_name(argv[0]);
|
||||
+ errnum = errno;
|
||||
+ if (argv0 == NULL) {
|
||||
+ if (errno == ENOENT)
|
||||
+ /* strdup because we're going to free() it
|
||||
+ later no matter what */
|
||||
+ argv0 = strdup(argv[0]);
|
||||
+ else
|
||||
+ if (errnum != ENOENT)
|
||||
+ Py_FatalError(strerror(errnum));
|
||||
+ if (!argv0)
|
||||
+
|
||||
+ /* errnum == ENOENT; the input file name is empty, or
|
||||
+ * at least one of the path components does not exist
|
||||
+ * */
|
||||
+ /* strdup because we're going to free() it
|
||||
+ later no matter what */
|
||||
+ argv0 = strdup(argv[0]);
|
||||
+ if (argv0 == NULL)
|
||||
+ Py_FatalError("no mem for sys.argv");
|
||||
+ }
|
||||
+#else /* ! HAVE_CANONICALIZE_FILE_NAME */
|
||||
char *argv0 = argv[0];
|
||||
char *p = NULL;
|
||||
int n = 0;
|
||||
#ifdef HAVE_READLINK
|
||||
char link[MAXPATHLEN+1];
|
||||
char argv0copy[2*MAXPATHLEN+1];
|
||||
@@ -1256,9 +1277,13 @@
|
||||
#endif /* Unix */
|
||||
}
|
||||
|
@ -66,8 +54,8 @@
|
|||
if (PyList_Insert(path, 0, a) < 0)
|
||||
Py_FatalError("sys.path.insert(0) failed");
|
||||
Py_DECREF(a);
|
||||
--- Python-2.4.1/configure.in.canonicalize 2005-09-14 11:46:00.000000000 -0400
|
||||
+++ Python-2.4.1/configure.in 2005-09-14 11:47:22.000000000 -0400
|
||||
--- Python-2.4.1/configure.in.canonicalize 2005-03-28 18:23:34.000000000 -0500
|
||||
+++ Python-2.4.1/configure.in 2005-09-23 10:37:30.000000000 -0400
|
||||
@@ -2096,8 +2096,8 @@
|
||||
AC_MSG_RESULT(MACHDEP_OBJS)
|
||||
|
||||
|
@ -79,3 +67,15 @@
|
|||
gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
|
||||
getpriority getpwent getsid getwd \
|
||||
kill killpg lchown lstat mkfifo mknod mktime \
|
||||
--- Python-2.4.1/pyconfig.h.in.canonicalize 2004-10-13 11:30:55.000000000 -0400
|
||||
+++ Python-2.4.1/pyconfig.h.in 2005-09-23 10:37:30.000000000 -0400
|
||||
@@ -58,6 +58,9 @@
|
||||
/* Define if pthread_sigmask() does not work on your system. */
|
||||
#undef HAVE_BROKEN_PTHREAD_SIGMASK
|
||||
|
||||
+/* Define to 1 if you have the `canonicalize_file_name' function. */
|
||||
+#undef HAVE_CANONICALIZE_FILE_NAME
|
||||
+
|
||||
/* Define to 1 if you have the `chown' function. */
|
||||
#undef HAVE_CHOWN
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
Summary: An interpreted, interactive, object-oriented programming language.
|
||||
Name: %{python}
|
||||
Version: %{pybasever}.1
|
||||
Release: 8
|
||||
Release: 9
|
||||
License: PSF - see LICENSE
|
||||
Group: Development/Languages
|
||||
Provides: python-abi = %{pybasever}
|
||||
|
@ -358,6 +358,10 @@ rm -fr $RPM_BUILD_ROOT
|
|||
%{_libdir}/python%{pybasever}/lib-dynload/_tkinter.so
|
||||
|
||||
%changelog
|
||||
* Fri Sep 23 2005 Mihai Ibanescu <misa@redhat.com> 2.4.1-9
|
||||
- Fixed bug #169159 (don't let python core dump if no arguments are passed in)
|
||||
Reworked the patch from -8 a bit more.
|
||||
|
||||
* Thu Sep 22 2005 Peter Jones <pjones@redhat.com> 2.4.1-8
|
||||
- Fix bug #169046 more correctly.
|
||||
|
||||
|
|
Loading…
Reference in New Issue