2012/4/24 ольга крыжановская <[email protected]>:
> David, termclock.sh from Roland is no longer working with git 20120424
> HEAD of ast-open on Suse Linux 12.1. Running the script gives me this
> error:
>
> termclock.sh[309]: main[239]: main_loop[166]: get_term_size[85]: tput:
> not found [No such file or directory]
> termclock.sh: Couldn't get terminal size.
>
> It fails because it can not find the tput utility on Linux on the 2nd
> call, the 1st call works. The bug goes away if I change this line in
> the script:
> --------------------------------
> Index: termclock.sh
> ===================================================================
> --- termclock.sh        (revision 17)
> +++ termclock.sh        (working copy)
> @@ -30,7 +30,7 @@
>  #
>
>  # Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in
> /usr/bin are not POSIX-conformant
> -export PATH='/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin'
> +#export PATH='/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin'
>
>  # Make sure all math stuff runs in the "C" locale to avoid problems
>  # with alternative # radix point representations (e.g. ',' instead of
> --------------------------------
>
> I think the PATH lookup is broken in ksh some how.

Here is a reduced testcase for Olga's problem:
-- snip --
export PATH='/not/here/path:/bin:/usr/bin'

# Get terminal size and put values into a compound variable with the integer
# members "columns" and "lines"
function get_term_size
{
        nameref rect=$1

        rect.columns=${ tput cols ; } || return 1
        rect.lines=${ tput lines ; }  || return 1

        return 0
}

compound r
get_term_size r || print 'FAIL'
print -C r
-- snip --

The testcase fails like this:
-- snip --
$ ksh /tmp/chickenterror.sh
/tmp/chickenterror.sh[16]: get_term_size[10]: tput: not found [No such
file or directory]
FAIL
(columns=169;lines='')
-- snip --

After some digging it turned out that replacing '/not/here/path' with
'/tmp' fixes the problem... AFAIK this looks like having an element in
PATH which points to a non-existing directory causes the failure...
;-(

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)

_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to