pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Victor Wagner <vitus@wagner.pp.ru>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Non-portable shell code in pg_upgrade tap tests
Date: Fri, 20 Jul 2018 15:38:20 +0300
Message-ID: <20180720153820.69e9ae6c@fafnir.local.vm> (raw)

Collegues,

I've discovered that in the branch REL_11_STABLE there is shell script
src/bin/pg_upgrade/test.sh which doesn't work under Solaris 10.
(it uses $(command) syntax with is not compatible with original
Solaris /bin/sh)

I was quite surprised that this problem goes unnoticed on big buildfarm,
but after some investigation found out that both Solaris machines in
that buildfarm don't configure postgres with --enable-tap-tests.

Offending code is:

# make sure all directories and files have group permissions, on Unix hosts
# Windows hosts don't support Unix-y permissions.
case $testhost in
    MINGW*) ;;
    *)  if [ $(find ${PGDATA} -type f ! -perm 640 | wc -l) -ne 0 ]; then
            echo "files in PGDATA with permission != 640";
            exit 1;
        fi ;;
esac

case $testhost in
    MINGW*) ;;
    *)  if [ $(find ${PGDATA} -type d ! -perm 750 | wc -l) -ne 0 ]; then
            echo "directories in PGDATA with permission != 750";
            exit 1;
        fi ;;
esac


It is quite easy to replace $() syntax with backticks. Backticks are
not nestable and considered unsafe by modern shell scripting style
guides, but they do work with older shells.

--







view thread (17+ messages)  latest in thread

Message-ID: <20180720153820.69e9ae6c@fafnir.local.vm>
Permalink:  ../20180720153820.69e9ae6c@fafnir.local.vm/
Also on:    postgresql.org/message-id/20180720153820.69e9ae6c@fafnir.local.vm

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: vitus@wagner.pp.ru
  Subject: Re: Non-portable shell code in pg_upgrade tap tests
  In-Reply-To: <20180720153820.69e9ae6c@fafnir.local.vm>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox