Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:olh:SLE_11
python.6852
python-2.6.7-canonicalize2.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File python-2.6.7-canonicalize2.patch of Package python.6852
Index: Python/sysmodule.c =================================================================== --- Python/sysmodule.c.orig 2012-02-08 18:43:31.000000000 +0100 +++ Python/sysmodule.c 2012-02-08 18:45:38.000000000 +0100 @@ -1550,67 +1550,16 @@ char *p = NULL; Py_ssize_t n = 0; PyObject *a; -#ifdef HAVE_READLINK - char link[MAXPATHLEN+1]; - char argv0copy[2*MAXPATHLEN+1]; - int nr = 0; - if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) - nr = readlink(argv0, link, MAXPATHLEN); - if (nr > 0) { - /* It's a symlink */ - link[nr] = '\0'; - if (link[0] == SEP) - argv0 = link; /* Link to absolute path */ - else if (strchr(link, SEP) == NULL) - ; /* Link without path */ - else { - /* Must join(dirname(argv0), link) */ - char *q = strrchr(argv0, SEP); - if (q == NULL) - argv0 = link; /* argv0 without path */ - else { - /* Must make a copy */ - strcpy(argv0copy, argv0); - q = strrchr(argv0copy, SEP); - strcpy(q+1, link); - argv0 = argv0copy; - } - } - } -#endif /* HAVE_READLINK */ -#if SEP == '\\' /* Special case for MS filename syntax */ - if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) { - char *q; -#if defined(MS_WINDOWS) && !defined(MS_WINCE) - /* This code here replaces the first element in argv with the full - path that it represents. Under CE, there are no relative paths so - the argument must be the full path anyway. */ - char *ptemp; - if (GetFullPathName(argv0, - sizeof(fullpath), - fullpath, - &ptemp)) { - argv0 = fullpath; - } +#ifndef HAVE_CANONICALIZE_FILE_NAME +#error "canonicalize_file_name() is not available. Please update your glibc" #endif - p = strrchr(argv0, SEP); - /* Test for alternate separator */ - q = strrchr(p ? p : argv0, '/'); - if (q != NULL) - p = q; - if (p != NULL) { - n = p + 1 - argv0; - if (n > 1 && p[-1] != ':') - n--; /* Drop trailing separator */ - } + int errnum; + + if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) { + argv0 = canonicalize_file_name(argv0); + if (argv0 == NULL) argv0 = strdup(argv[0]); } -#else /* All other filename syntaxes */ if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) { -#if defined(HAVE_REALPATH) - if (realpath(argv0, fullpath)) { - argv0 = fullpath; - } -#endif p = strrchr(argv0, SEP); } if (p != NULL) { @@ -1624,10 +1573,10 @@ n--; /* Drop trailing separator */ #endif /* Unix */ } -#endif /* All others */ a = PyString_FromStringAndSize(argv0, n); if (a == NULL) Py_FatalError("no mem for sys.path insertion"); + if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) free(argv0); if (PyList_Insert(path, 0, a) < 0) Py_FatalError("sys.path.insert(0) failed"); Py_DECREF(a); Index: configure.in =================================================================== --- configure.in.orig 2012-02-08 18:43:31.000000000 +0100 +++ configure.in 2012-02-08 18:43:31.000000000 +0100 @@ -2643,7 +2643,7 @@ getpriority getpwent getspnam getspent getsid getwd \ kill killpg lchmod lchown lstat mkfifo mknod mktime \ mremap nice pathconf pause plock poll pthread_init \ - putenv readlink realpath \ + putenv readlink realpath canonicalize_file_name \ select setegid seteuid setgid \ setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \ sigaction siginterrupt sigrelse strftime \ Index: pyconfig.h.in =================================================================== --- pyconfig.h.in.orig 2009-10-27 13:30:12.000000000 +0100 +++ pyconfig.h.in 2012-02-08 18:43:31.000000000 +0100 @@ -79,6 +79,9 @@ /* Define to 1 if you have the `chflags' function. */ #undef HAVE_CHFLAGS +/* 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
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor