Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 221107 Details for
Bug 286191
app-eselect/eselect-python: python-wrapper sometimes breaks init scripts using start-stop-daemon with Python scripts
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for dev-lang/python:2.6
python-2.6-process_data.patch (text/plain), 1.67 KB, created by
Arfrever Frehtes Taifersar Arahesis (RETIRED)
on 2010-02-25 10:25:57 UTC
(
hide
)
Description:
Patch for dev-lang/python:2.6
Filename:
MIME Type:
Creator:
Arfrever Frehtes Taifersar Arahesis (RETIRED)
Created:
2010-02-25 10:25:57 UTC
Size:
1.67 KB
patch
obsolete
>--- Modules/main.c >+++ Modules/main.c >@@ -452,7 +452,19 @@ > filename = argv[_PyOS_optind]; > > #else >- filename = argv[_PyOS_optind]; >+ filename = strdup(argv[_PyOS_optind]); >+ char *new_script_name = getenv("PYTHON_SCRIPT_NAME"); >+ if (new_script_name != NULL) { >+ size_t old_script_name_length = strlen(argv[_PyOS_optind]); >+ size_t new_script_name_length = strlen(new_script_name); >+ size_t i; >+ for (i = 0; i < old_script_name_length; i++) { >+ if (i <= new_script_name_length) >+ argv[_PyOS_optind][i] = new_script_name[i]; >+ else >+ argv[_PyOS_optind][i] = '\0'; >+ } >+ } > #endif > } > >--- Modules/python.c >+++ Modules/python.c >@@ -6,6 +6,11 @@ > #include <floatingpoint.h> > #endif > >+#ifdef __linux__ >+#include <linux/prctl.h> >+#include <sys/prctl.h> >+#endif >+ > int > main(int argc, char **argv) > { >@@ -20,5 +25,12 @@ > m = fpgetmask(); > fpsetmask(m & ~FP_X_OFL); > #endif >+ >+#ifdef __linux__ >+ char *process_name = getenv("PYTHON_PROCESS_NAME"); >+ if (process_name) >+ prctl(PR_SET_NAME, process_name); >+#endif >+ > return Py_Main(argc, argv); > } >--- Python/sysmodule.c >+++ Python/sysmodule.c >@@ -1490,6 +1490,7 @@ > makeargvobject(int argc, char **argv) > { > PyObject *av; >+ char *script_name = getenv("PYTHON_SCRIPT_NAME"); > if (argc <= 0 || argv == NULL) { > /* Ensure at least one (empty) argument is seen */ > static char *empty_argv[1] = {""}; >@@ -1514,7 +1515,11 @@ > } else > v = PyString_FromString(argv[i]); > #else >- PyObject *v = PyString_FromString(argv[i]); >+ PyObject *v; >+ if (i == 0 && script_name != NULL) >+ v = PyString_FromString(script_name); >+ else >+ v = PyString_FromString(argv[i]); > #endif > if (v == NULL) { > Py_DECREF(av);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 286191
:
205104
|
213083
|
213125
|
220639
|
220641
|
221107
|
222473
|
222883
|
222885
|
222887
|
223211
|
223213