Re: Non-portable shell code in pg_upgrade tap tests

2018-07-23 Thread Noah Misch
On Sun, Jul 22, 2018 at 02:53:51PM -0400, Tom Lane wrote: > Noah Misch writes: > > On Sun, Jul 22, 2018 at 10:46:03AM -0400, Tom Lane wrote: > >> The pg_upgrade makefile does in fact use $(SHELL), so it will default to > >> whatever shell configure used. > > > It will not, because we don't set

Re: Non-portable shell code in pg_upgrade tap tests

2018-07-22 Thread Tom Lane
Michael Paquier writes: > On Sun, Jul 22, 2018 at 02:53:51PM -0400, Tom Lane wrote: >> A quick trawl of the buildfarm logs says most of our animals compute >> SHELL = /bin/sh anyway, and so would be unaffected. There's a sizable >> population that find /bin/bash though, and one active critter

Re: Non-portable shell code in pg_upgrade tap tests

2018-07-22 Thread Michael Paquier
On Sun, Jul 22, 2018 at 02:53:51PM -0400, Tom Lane wrote: > Oh! Hm, I wonder whether we shouldn't do that, ie add SHELL = @SHELL@ > to Makefile.global.in. That sounds like a good idea to me. > A quick trawl of the buildfarm logs says most of our animals compute > SHELL = /bin/sh anyway, and so

Re: Non-portable shell code in pg_upgrade tap tests

2018-07-22 Thread Tom Lane
Noah Misch writes: > On Sun, Jul 22, 2018 at 10:46:03AM -0400, Tom Lane wrote: >> The pg_upgrade makefile does in fact use $(SHELL), so it will default to >> whatever shell configure used. > It will not, because we don't set $(SHELL) anywhere. $(SHELL) is not @SHELL@. > In our makefiles,

Re: Non-portable shell code in pg_upgrade tap tests

2018-07-22 Thread Noah Misch
On Sun, Jul 22, 2018 at 10:46:03AM -0400, Tom Lane wrote: > Noah Misch writes: > > I'd say the right way to fix this is the one specified in > > https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/The-Make-Macro-SHELL.html, > > in particular: > > > Using @SHELL@ means that

Re: Non-portable shell code in pg_upgrade tap tests

2018-07-22 Thread Tom Lane
Noah Misch writes: > I'd say the right way to fix this is the one specified in > https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/The-Make-Macro-SHELL.html, > in particular: > Using @SHELL@ means that your makefile will benefit from the same improved > shell, such as bash

Re: Non-portable shell code in pg_upgrade tap tests

2018-07-22 Thread Noah Misch
On Fri, Jul 20, 2018 at 11:09:13AM -0400, Tom Lane wrote: > Victor Wagner writes: > > Tom Lane wrote: > >> Please send a patch. Most of us do not have access to old shells > > > Here it goes. Previous letter was written before fixed tests were > > completed, because this old machine is slow. >

Re: Non-portable shell code in pg_upgrade tap tests

2018-07-21 Thread Tom Lane
"Tels" writes: > Looking at your new patch, I notice you used "" for quoting, not ''. (Not > sure which variant Tom used when pushing a patch). > I'm not a shell expert, but I think '' are safer, as "" still has some > interpolation from the shell (at least on the systems I use regulary): We

Re: Non-portable shell code in pg_upgrade tap tests

2018-07-21 Thread Tels
Moin, On Sat, July 21, 2018 12:47 pm, Dagfinn Ilmari Mannsåker wrote: > Tom Lane writes: > >> "Tels" writes: >>> + *) if [ `find ${PGDATA} -type f ! -perm 640 | wc -l` -ne 0 ]; then >> >>> Shouldn't ${PGDATA} in the above as argument to find be quoted, >>> otherwise >>> the shell would

Re: Non-portable shell code in pg_upgrade tap tests

2018-07-21 Thread Tom Lane
ilm...@ilmari.org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=) writes: > Tom Lane writes: >> Hmm. Yeah, probably. I don't think this script is meant to be run with >> arbitrary values of PGDATA, but most of the other uses are quoted, so >> for consistency's sake this should be too. > Attached

Re: Non-portable shell code in pg_upgrade tap tests

2018-07-21 Thread Dagfinn Ilmari Mannsåker
Tom Lane writes: > "Tels" writes: >> +*) if [ `find ${PGDATA} -type f ! -perm 640 | wc -l` -ne 0 ]; then > >> Shouldn't ${PGDATA} in the above as argument to find be quoted, otherwise >> the shell would get confused if it contains spaces or other special >> characters? > > Hmm. Yeah,

Re: Non-portable shell code in pg_upgrade tap tests

2018-07-21 Thread Tom Lane
"Tels" writes: > + *) if [ `find ${PGDATA} -type f ! -perm 640 | wc -l` -ne 0 ]; then > Shouldn't ${PGDATA} in the above as argument to find be quoted, otherwise > the shell would get confused if it contains spaces or other special > characters? Hmm. Yeah, probably. I don't think

Re: Non-portable shell code in pg_upgrade tap tests

2018-07-20 Thread Tels
Moin, On Fri, July 20, 2018 10:55 am, Victor Wagner wrote: > On Fri, 20 Jul 2018 10:25:47 -0400 > Tom Lane wrote: > >> Victor Wagner writes: >> > 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

Re: Non-portable shell code in pg_upgrade tap tests

2018-07-20 Thread Tom Lane
Victor Wagner writes: > Tom Lane wrote: >> Please send a patch. Most of us do not have access to old shells > Here it goes. Previous letter was written before fixed tests were > completed, because this old machine is slow. Thanks. Will check on my own dinosaurs, and push if I don't find a

Re: Non-portable shell code in pg_upgrade tap tests

2018-07-20 Thread Victor Wagner
On Fri, 20 Jul 2018 10:25:47 -0400 Tom Lane wrote: > Victor Wagner writes: > > 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 > >

Re: Non-portable shell code in pg_upgrade tap tests

2018-07-20 Thread Tom Lane
Victor Wagner writes: > 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) OK ... > It is quite easy to replace $() syntax

Non-portable shell code in pg_upgrade tap tests

2018-07-20 Thread Victor Wagner
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