bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

./configure vs. user-defined bash function "print"


From: Greg Minshall
Subject: ./configure vs. user-defined bash function "print"
Date: Tue, 08 Jul 2014 06:51:46 +0300

hi.  the following fragment from a ./configure
----
# Prefer a ksh shell builtin over an external printf program on Solaris,
# but without wasting forks for bash or zsh.
if test -z "$BASH_VERSION$ZSH_VERSION" \
    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
  as_echo='print -r --'
  as_echo_n='print -rn --'
elif
----
plays poorly with a user-defined bash function named "print" (basically,
a front end to pr(1)).  ./configure hangs, waiting for print to end
(which, in turn, is waiting on a end-of-file on stdin).

i've seen an idiom like "`echo | print -r -- $as_echo` used before, and
maybe that's to avoid this sort of situation?

what i can't explain is why the "test -z $BASH_VERSION..." is failing to
prevent this code from running.  here's the system i'm running:
----
Linux ip-10-236-170-110 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 
2013 x86_64 x86_64 x86_64 GNU/Linux
----
and, sure enough, a "#! /bin/sh" a) has a blank BASH_VERSION, b)
interprets "print" as a call to the user-defined function.  possibly
you'll have more sense of why that's happening.

cheers, Greg Minshall
----
autoconf details:
----
% autoconf --version
autoconf (GNU Autoconf) 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David J. MacKenzie and Akim Demaille.
% 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]