Re: failing to build preproc.c on solaris with sun studio

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Andres Freund <andres(at)anarazel(dot)de>, John Naylor <john(dot)naylor(at)enterprisedb(dot)com>, Michael Meskes <meskes(at)postgresql(dot)org>, Noah Misch <noah(at)leadboat(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: failing to build preproc.c on solaris with sun studio
Date: 2022-09-14 04:34:19
Message-ID: 20220914043419.GV31833@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 14, 2022 at 03:08:06PM +1200, Thomas Munro wrote:
> On Wed, Sep 14, 2022 at 10:23 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> > Given the simplicity of this case, though, I suppose we could
> > have a little not-very-general shell/python/whatever wrapper script --
> > just compute a checksum of the input and keep the output files around.
>
> Something as dumb as this perhaps...

> if [ -z "$c_file" ] ; then
> c_file="(echo "$y_file" | sed 's/\.y/.tab.c/')"
> fi

This looks wrong. I guess you mean to use $() and missing "$" ?

It could be:
[ -z "$c_file" ] &&
c_file=${y_file%.y}.tab.c

> if [ -z "$SIMPLE_BISON_CACHE_PATH" ] ; then
> SIMPLE_BISON_CACHE_PATH="/tmp/simple-bison-cache"
> fi

Should this default to CCACHE_DIR? Then it would work under cirrusci...

> h_file="$(echo $c_file | sed 's/\.c/.h/')"

Could be ${c_file%.c}.h

> if [ ! -e "$cached_c_file" -o ! -e "$cached_h_file" ] ; then

You could write the easy case first (I forget whether it's considered to
be more portable to write && outside of []).

> if [ -e "$cached_c_file" ] && [ -e "$cached_h_file" ] ; then

I can't see what part of this would fail to handle filenames with spaces
(?)

--
Justin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-09-14 04:35:57 Re: Expand palloc/pg_malloc API
Previous Message John Naylor 2022-09-14 04:27:45 Re: build remaining Flex files standalone