[New-bugs-announce] [issue7938] makesetup interprets macros -DA=B as a Make variable definition
Willem de Bruijn
report at bugs.python.org
Tue Feb 16 01:44:32 CET 2010
New submission from Willem de Bruijn <wdebruij at dds.nl>:
(this is very low priority: an issue in a nonstandard build)
I am porting Python 2.6.4 to a system with only partial Posix support that requires static linking for all modules. To enable sqlite, I added the line
_sqlite3 _sqlite/cache.c _sqlite/connection.c _sqlite/cursor.c _sqlite/microprotocols.c _sqlite/module.c _sqlite/prepare_protocol.c _sqlite/row.c _sqlite/statement.c _sqlite/util.c -DMODULE_NAME='"sqlite3"' -IModules/_sqlite ...
to Modules/Setup, but found that it would not end up in the main binary. Instead of adding it to MODOBJS, makesetup put it in BASEMODLIBS
The problem occurs in Modules/makesetup, line 131, which matches all lines containing "=" and treats them as Make definitions. In this case, it matches the equal sign in the C macro MODULE_NAME.
The problem goes away when I tighten the check at that line:
- *=*) DEFS="$line$NL$DEFS"; continue;;
+ [[:alpha:]]*=*) DEFS="$line$NL$DEFS"; continue;;
(see the attached file for the trivial patch in diff -Nur format)
This patch comes with a big warning: my sh-regex foo is very poor. I wanted to write a test that only accepted ^[:alpha:][^ ]*=*, but that
did not work. The above did, but I cannot oversee all consequences.
title: makesetup interprets macros -DA=B as a Make variable definition
type: compile error
versions: Python 2.6
Added file: http://bugs.python.org/file16227/pydiff
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce