Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fgUgd-00048J-Ei for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Jul 2018 12:39:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fgUgb-00048p-Q6 for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Jul 2018 12:39:05 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fgUg0-0001SK-Eh for pgsql-hackers@lists.postgresql.org; Fri, 20 Jul 2018 12:38:28 +0000 Received: from mx.wagner.pp.ru ([2a01:4f8:c17:2e5b::2]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fgUfw-0001Qb-Gn for pgsql-hackers@postgresql.org; Fri, 20 Jul 2018 12:38:26 +0000 Received: from fafnir.local.vm (unknown [93.174.131.141]) by mx.wagner.pp.ru (Postfix) with ESMTPSA id 558EAE0124 for ; Fri, 20 Jul 2018 15:38:21 +0300 (MSK) Date: Fri, 20 Jul 2018 15:38:20 +0300 From: Victor Wagner To: pgsql-hackers Subject: Non-portable shell code in pg_upgrade tap tests Message-ID: <20180720153820.69e9ae6c@fafnir.local.vm> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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. --