Non-portable shell code in pg_upgrade tap tests

Поиск
Список
Период
Сортировка
От Victor Wagner
Тема Non-portable shell code in pg_upgrade tap tests
Дата
Msg-id 20180720153820.69e9ae6c@fafnir.local.vm
обсуждение исходный текст
Ответы Re: Non-portable shell code in pg_upgrade tap tests  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
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.

--





В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Expression errors with "FOR UPDATE" and postgres_fdw withpartition wise join enabled.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Non-portable shell code in pg_upgrade tap tests