[Python-bugs-list] [ python-Bugs-668662 ] Compiling C sources with absolute path bug

SourceForge.net noreply@sourceforge.net
Wed, 15 Jan 2003 11:00:01 -0800


Bugs item #668662, was opened at 2003-01-15 20:59
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=668662&group_id=5470

Category: Distutils
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Pearu Peterson (pearu)
Assigned to: Nobody/Anonymous (nobody)
Summary: Compiling C sources with absolute path bug

Initial Comment:
Py-2.3 distutils is broken in the following situation
when building extension modules:
If a file in C sources list is given with absolute
path, say
/path/to/foo.c then Py-2.3 distutils tries to create
the corresponding    
object file to /path/to/foo.o (earlier versions would
create it to, say, build/temp.linux-i686-2.2/foo.o).
This causes problems when
1) an user does not have permissions to write to
/path/to/, e.g. in multiuser systems
2) an user builds extension modules, say, using
different compilers or flags. Then /path/to/foo.o will
be in a way for subsequent builds.
IMHO, distutils should not create any files outside the
given
build directory, unless explicitely specified using
--build-temp.

Fix:
The problematic code seems to be in the method
ccompiler.object_filenames in file distutils/ccompiler.py.
As a fix, I suggest using the following object name for
a C source if given with absolute path: 
  ./build/temp.linux-i686-2.2/path/to/foo.o.

This can be achived by inserting the following line
just after
the line `base, ext = os.path.splitext(src_name)`:

 base = base[os.path.isabs(base):]

Pearu

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=668662&group_id=5470