Mailing List Archive

Bug with makesetup on FreeBSD
makesetup in Python 1.5.1 and 1.5.2 bombs on lines in the Setup file
that use backslash continuation to break a module spec across lines on
FreeBSD.

FreeBSD's /bin/sh is the culprit. It's read function doesn't continue
reading a line if the last char is a backslash. For example:
input being:
somemodule somemodule.c \
-lsomelib
doing a read line only gets the first line and makesetup barfs on line
154 with invalid word on \ (as opposed to bash (or other sh's) that get
"somemodule somemodule.c -lsomelib" back from read).

This patch to this works with both FreeBSD's sh and bash. What it does
is this:
While the last char of $line is a \, read another line and glue it to
the original minus the \.

*** makesetup Fri Apr 16 11:43:55 1999
--- makesetup Fri Apr 16 11:43:12 1999
***************
*** 104,107 ****
--- 104,115 ----
while read line
do
+ #to handle backslashes for sh's that don't automatically
+ #continue a read when the last char is a backslash
+ while echo $line | grep '\\$' > /dev/null
+ do
+ read extraline
+ line=`echo $line| sed s/.$//`$extraline
+ done
+
# Output DEFS in reverse order so first definition
overrides
case $line in

Cheers,
Drew Csillag
--
"There are two major products that come out of Berkeley:
LSD and UNIX. We don't believe this to be a coincidence."
- Jeremy S. Anderson
Bug with makesetup on FreeBSD [ In reply to ]
Andrew Csillag:
|makesetup in Python 1.5.1 and 1.5.2 bombs on lines in the Setup file
|that use backslash continuation to break a module spec across lines on
|FreeBSD.

BTW FWIW, I just built 1.5.2 last night on 3.0-RELEASE using the 1.5.2c1
port. Worked fine. But it may not invoke makesetup under the hood.

Randall
Bug with makesetup on FreeBSD [ In reply to ]
Randall Hopper wrote:
>
> Andrew Csillag:
> |makesetup in Python 1.5.1 and 1.5.2 bombs on lines in the Setup file
> |that use backslash continuation to break a module spec across lines on
> |FreeBSD.
>
> BTW FWIW, I just built 1.5.2 last night on 3.0-RELEASE using the 1.5.2c1
> port. Worked fine. But it may not invoke makesetup under the hood.
>
> Randall
It does invoke makesetup (that's how the Makefile in Modules gets
written). I'm also running FreeBSD 2.2.8, so it may be a bug in /bin/sh
that has been subsequently fixed... The quick test is to try this on
your 3.0 machine

$ read line
some text here\

On my 2.2.8 machine after I hit return after the \, I get a command line
prompt, not a "blank prompt" that would mean that the read wasn't done.

In either case, I was able to get the thing built without the patch, I
just had to type make -e SHELL=/usr/local/bin/bash, but that sucks.

Drew Csillag
--
"There are two major products that come out of Berkeley:
LSD and UNIX. We don't believe this to be a coincidence."
- Jeremy S. Anderson
Bug with makesetup on FreeBSD [ In reply to ]
Andrew Csillag:
|Randall Hopper wrote:
|> Andrew Csillag:
|> |makesetup in Python 1.5.1 and 1.5.2 bombs on lines in the Setup file
|> |that use backslash continuation to break a module spec across lines on
|> |FreeBSD.
|>
|> BTW FWIW, I just built 1.5.2 last night on 3.0-RELEASE using the 1.5.2c1
|> port. Worked fine. But it may not invoke makesetup under the hood.
|
|It does invoke makesetup (that's how the Makefile in Modules gets
|written). I'm also running FreeBSD 2.2.8, so it may be a bug in /bin/sh
|that has been subsequently fixed... The quick test is to try this on
|your 3.0 machine
|
|$ read line
|some text here\
|
|On my 2.2.8 machine after I hit return after the \, I get a command line
|prompt, not a "blank prompt" that would mean that the read wasn't done.

It must be something else then, because here with stock Bourne shell:

|$ read line
|some text here\
|$ echo $line
|some text here\

I get the same behavior you describe, but no build breakage.

Randall
Bug with makesetup on FreeBSD [ In reply to ]
|I figured it out! If you build out of the ports tree, it's Tkinter
|configuration is all on one line (see
|/usr/ports/lang/python/files/Setup.tk), not broken by using backslash
|continuation as is in the distributed Setup file. I was building from
|the source release from www.python.org, not from the ports tree as you
|did, hence why you didn't run into it and I did.

Ahh, makes sense. Glad you got to the bottom of it.

Randall
Bug with makesetup on FreeBSD [ In reply to ]
Randall Hopper wrote:
>
> Andrew Csillag:
> |Randall Hopper wrote:
> |> Andrew Csillag:
> |> |makesetup in Python 1.5.1 and 1.5.2 bombs on lines in the Setup file
> |> |that use backslash continuation to break a module spec across lines on
> |> |FreeBSD.
> |>
> |> BTW FWIW, I just built 1.5.2 last night on 3.0-RELEASE using the 1.5.2c1
> |> port. Worked fine. But it may not invoke makesetup under the hood.
> |
> |It does invoke makesetup (that's how the Makefile in Modules gets
> |written). I'm also running FreeBSD 2.2.8, so it may be a bug in /bin/sh
> |that has been subsequently fixed... The quick test is to try this on
> |your 3.0 machine
> |
> |$ read line
> |some text here\
> |
> |On my 2.2.8 machine after I hit return after the \, I get a command line
> |prompt, not a "blank prompt" that would mean that the read wasn't done.
>
> It must be something else then, because here with stock Bourne shell:
>
> |$ read line
> |some text here\
> |$ echo $line
> |some text here\
>
> I get the same behavior you describe, but no build breakage.
>
> Randall

I figured it out! If you build out of the ports tree, it's Tkinter
configuration is all on one line (see
/usr/ports/lang/python/files/Setup.tk), not broken by using backslash
continuation as is in the distributed Setup file. I was building from
the source release from www.python.org, not from the ports tree as you
did, hence why you didn't run into it and I did.
--
"There are two major products that come out of Berkeley:
LSD and UNIX. We don't believe this to be a coincidence."
- Jeremy S. Anderson