Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mjlMk-0000W0-T8 for pgsql-www@arkaria.postgresql.org; Sun, 07 Nov 2021 16:49:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mjlMj-0003GW-Mq for pgsql-www@arkaria.postgresql.org; Sun, 07 Nov 2021 16:49:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mjlMj-0003GN-Fg for pgsql-www@lists.postgresql.org; Sun, 07 Nov 2021 16:49:57 +0000 Received: from 1.mo583.mail-out.ovh.net ([188.165.57.91]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mjlMf-0007Rt-OI for pgsql-www@lists.postgresql.org; Sun, 07 Nov 2021 16:49:57 +0000 Received: from player726.ha.ovh.net (unknown [10.108.4.136]) by mo583.mail-out.ovh.net (Postfix) with ESMTP id 5EDF32225C for ; Sun, 7 Nov 2021 16:49:52 +0000 (UTC) Received: from nilsand.re (host86-151-117-224.range86-151.btcentralplus.com [86.151.117.224]) (Authenticated sender: nils@nilsand.re) by player726.ha.ovh.net (Postfix) with ESMTPSA id 2F62523F612D4 for ; Sun, 7 Nov 2021 16:49:51 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-104R005a57a2890-9302-416d-b0cd-05ded975440e, A30032F0AD3D7EF83CAF17ECBC208C94BEB1E863) smtp.auth=nils@nilsand.re X-OVh-ClientIp: 86.151.117.224 Date: Sun, 7 Nov 2021 16:49:51 +0000 From: Nils To: pgsql-www@lists.postgresql.org Subject: [PATCH] Improve portability of pgweb/load_initial_data.sh Message-ID: <20211107164951.wxcyp7iar2s4mjkn@nixos> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Ovh-Tracer-Id: 265712378243349807 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddruddtgdeludcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecunecujfgurhepfffhvffukfggtggusehttdertddttddvnecuhfhrohhmpefpihhlshcuoehnihhlshesnhhilhhsrghnugdrrhgvqeenucggtffrrghtthgvrhhnpeefleefveffhfekjeelffeifeejleeujeeghfefueegiefhvdeuueejleejueelvdenucfkpheptddrtddrtddrtddpkeeirdduhedurdduudejrddvvdegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejvdeirdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepnhhilhhssehnihhlshgrnhgurdhrvgdprhgtphhtthhopehpghhsqhhlqdiffiifsehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The shell script doesn't use bash extensions and bash may not be available on all systems at that location. If CDPATH is set, in certain cases, the call to cd can result in unwanted behaviour. --- pgweb/load_initial_data.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pgweb/load_initial_data.sh b/pgweb/load_initial_data.sh index fb16e70c..c419f298 100755 --- a/pgweb/load_initial_data.sh +++ b/pgweb/load_initial_data.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # We keep this in a separate script because using initial_data.xxx in django will overwrite # critical data in the database when running a 'syncdb'. We'd like to keep the ability to @@ -8,7 +8,7 @@ echo WARNING: this may overwrite some data in the database with an initial set o echo 'Are you sure you want this (answer "yes" to overwrite)' read R -cd $(dirname $0) +CDPATH= cd $(dirname $0) if [ "$R" == "yes" ]; then find . -name data.json | xargs ../manage.py loaddata -- 2.31.1