pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tels <nospam-pg-abuse@bloodgate.com>
To: "Dagfinn Ilmari Mannsåker" <ilmari@ilmari.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Victor Wagner <vitus@wagner.pp.ru>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Non-portable shell code in pg_upgrade tap tests
Date: Sat, 21 Jul 2018 18:49:33 -0400
Message-ID: <4aca1a4e7e8e82513988a7236e227c2d.squirrel@sm.webmail.pair.com> (raw)
In-Reply-To: <d8j60181qpn.fsf@dalvik.ping.uio.no>
References: <20180720153820.69e9ae6c@fafnir.local.vm>
	<17833.1532096747@sss.pgh.pa.us>
	<20180720175508.07776219@fafnir.local.vm>
	<c96303c04c360bbedaa04f90f515745b.squirrel@sm.webmail.pair.com>
	<4263.1532186967@sss.pgh.pa.us>
	<d8j60181qpn.fsf@dalvik.ping.uio.no>

Moin,

On Sat, July 21, 2018 12:47 pm, Dagfinn Ilmari Mannsåker wrote:
> Tom Lane <tgl@sss.pgh.pa.us> writes:
>
>> "Tels" <nospam-pg-abuse@bloodgate.com> 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 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.
>
> PGDATA is built from `pwd`, so it breaks if the build directory has a
> space in it. Because it's testing for the absence of files, it doesn't
> actually break the test, but would fail to detect the bugs it's trying
> to.

Thanx for the fix. But perhaps I should have been a bit more specific in
my first message, spaces are not the only character this can break at.

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):

 te@pc:~$ mkdir 'test$test'
 te@pc:~$ touch 'test$test/test'
 te@pc:~$ find 'test$test/test' -type f
 test$test/test
 te@pc:~$ find "test$test/test" -type f
 find: ‘test/test’: No such file or directory

So I've grown the habit to always use '' instead of "". Not sure if this
is specific to bash vs. sh or PC vs Mac, tho.

Best wishes,

Tels




view thread (17+ messages)  latest in thread

Message-ID: <4aca1a4e7e8e82513988a7236e227c2d.squirrel@sm.webmail.pair.com>
Permalink:  ../4aca1a4e7e8e82513988a7236e227c2d.squirrel@sm.webmail.pair.com/
Also on:    postgresql.org/message-id/4aca1a4e7e8e82513988a7236e227c2d.squirrel@sm.webmail.pair.com

 · 

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: nospam-pg-abuse@bloodgate.com, ilmari@ilmari.org, tgl@sss.pgh.pa.us, vitus@wagner.pp.ru
  Subject: Re: Non-portable shell code in pg_upgrade tap tests
  In-Reply-To: <4aca1a4e7e8e82513988a7236e227c2d.squirrel@sm.webmail.pair.com>

* 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