From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mediacenter.hi.pengutronix.de ([2001:6f8:1178:2::65]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1RqR5M-00034z-QD for ptxdist@pengutronix.de; Thu, 26 Jan 2012 16:18:00 +0100 Received: from mol by mediacenter.hi.pengutronix.de with local (Exim 4.72) (envelope-from ) id 1RqR5M-0006l4-PD for ptxdist@pengutronix.de; Thu, 26 Jan 2012 16:18:00 +0100 Date: Thu, 26 Jan 2012 16:18:00 +0100 From: Michael Olbrich Message-ID: <20120126151800.GL25121@pengutronix.de> References: <1327570140-3611-1-git-send-email-biessmann@corscience.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1327570140-3611-1-git-send-email-biessmann@corscience.de> Subject: Re: [ptxdist] [PATCH] bin/ptxdist: check_dirs_mkdir() utilize umask Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de On Thu, Jan 26, 2012 at 10:29:00AM +0100, Andreas Bie=DFmann wrote: > In some cases the check_dirs_mkdir() function will create directories on = the > way (parents) with insufficient rights. Therefore the chmod/chown later on > will fail due to missing rights. > = > This patch forces 'umask 0022' for creating the directories on the way and > additionally add the missing '-m755' switch to the 'sudo'-variant. Hmmm, we're mkdir etc. elsewhere as well. Shouldn't we just jet umask globally sometime at the beginning of ptxdist? michael > Signed-off-by: Andreas Bie=DFmann > --- > bin/ptxdist | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > = > diff --git a/bin/ptxdist b/bin/ptxdist > index 52e9c76..74a5a23 100755 > --- a/bin/ptxdist > +++ b/bin/ptxdist > @@ -398,7 +398,7 @@ check_dirs_mkdir() { > = > # create dir if not exiting > if [ ! -d "${dir}" ]; then > - if ! mkdir -m755 -p -- "${dir}" 2> /dev/null; then > + if ! (umask 0022 && mkdir -m755 -p -- "${dir}") 2> /dev/null; then > echo > echo "error: '${dir}'" > echo " does not exist and cannot be created!" > @@ -410,8 +410,8 @@ check_dirs_mkdir() { > exit 1 > fi > echo > - echo sudo mkdir -p "${dir}" > - sudo mkdir -p "${dir}" > + echo "umask 0022 && sudo mkdir -m755 -p \"${dir}\"" > + (umask 0022 && sudo mkdir -m755 -p "${dir}") > echo sudo chown "${UID}" "${dir}" > sudo chown "${UID}" "${dir}" > fi > -- = > 1.7.8.3 > = > = > -- = > ptxdist mailing list > ptxdist@pengutronix.de -- = Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | -- = ptxdist mailing list ptxdist@pengutronix.de