Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 213125 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]
python-wrapper-fix_argv0.patch
python-wrapper-fix_argv0.patch (text/plain), 1.41 KB, created by
Arfrever Frehtes Taifersar Arahesis (RETIRED)
on 2009-12-15 19:04:14 UTC
(
hide
)
Description:
python-wrapper-fix_argv0.patch
Filename:
MIME Type:
Creator:
Arfrever Frehtes Taifersar Arahesis (RETIRED)
Created:
2009-12-15 19:04:14 UTC
Size:
1.41 KB
patch
obsolete
>Index: python-wrapper.c >=================================================================== >--- python-wrapper.c (revision 254) >+++ python-wrapper.c (working copy) >@@ -156,7 +156,7 @@ > { > return NULL; > } >- /* walk backwards through the list */ >+ /* Walk backwards through the list. */ > while (n--) > { > if (! ret) >@@ -167,7 +167,7 @@ > return ret; > } > >-int main(__attribute__((unused)) int argc, char** argv) >+int main(int argc, char** argv) > { > if (strlen(program_description) == 0) > abort(); >@@ -199,20 +199,24 @@ > > if (strchr(EPYTHON, '/')) > { >- argv[0] = (char*) EPYTHON; >- execv(EPYTHON, argv); >+ fprintf(stderr, "Invalid value of EPYTHON variable or invalid configuration of Python wrapper\n"); > return EXIT_ERROR; > } > >+ /* Update argv[0], if a script with a Python shebang is probably being executed. >+ * argv[0] can be "python", when "#!/usr/bin/env python" shebang is used. */ >+ if (argc >= 2 && (argv[0][0] == '/' || strcmp(argv[0], "python") == 0) && argv[1][0] == '/') >+ argv[0] = argv[1]; >+ else if (argc >= 3 && argv[0][0] == '/' && argv[1][0] == '-' && argv[2][0] == '/') >+ argv[0] = argv[2]; >+ > const char* path = find_path(argv[0]); >- if (*path) >+ if (path) > { >- argv[0] = dir_cat(path, EPYTHON); >- execv(argv[0], argv); >+ execv(dir_cat(path, EPYTHON), argv); > /* If this failed, then just search the PATH. */ > } > >- argv[0] = (char*) EPYTHON; > execvp(EPYTHON, argv); > return EXIT_ERROR; > }
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