* [ptxdist] [PATCH] bin/ptxdist: check_dirs_mkdir() utilize umask
@ 2012-01-26 9:29 Andreas Bießmann
2012-01-26 15:18 ` Michael Olbrich
2012-02-03 10:48 ` [ptxdist] [PATCH v2] bin/ptxdist: set umask globally Andreas Bießmann
0 siblings, 2 replies; 6+ messages in thread
From: Andreas Bießmann @ 2012-01-26 9:29 UTC (permalink / raw)
To: PTXdist list
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.
Signed-off-by: Andreas Bießmann <biessmann@corscience.de>
---
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptxdist] [PATCH] bin/ptxdist: check_dirs_mkdir() utilize umask
2012-01-26 9:29 [ptxdist] [PATCH] bin/ptxdist: check_dirs_mkdir() utilize umask Andreas Bießmann
@ 2012-01-26 15:18 ` Michael Olbrich
2012-01-26 16:08 ` Andreas Bießmann
2012-02-03 10:48 ` [ptxdist] [PATCH v2] bin/ptxdist: set umask globally Andreas Bießmann
1 sibling, 1 reply; 6+ messages in thread
From: Michael Olbrich @ 2012-01-26 15:18 UTC (permalink / raw)
To: ptxdist
On Thu, Jan 26, 2012 at 10:29:00AM +0100, Andreas Bießmann 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ßmann <biessmann@corscience.de>
> ---
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptxdist] [PATCH] bin/ptxdist: check_dirs_mkdir() utilize umask
2012-01-26 15:18 ` Michael Olbrich
@ 2012-01-26 16:08 ` Andreas Bießmann
0 siblings, 0 replies; 6+ messages in thread
From: Andreas Bießmann @ 2012-01-26 16:08 UTC (permalink / raw)
To: ptxdist
Hi Michael,
On Thu, 26 Jan 2012 16:18:00 +0100, Michael Olbrich wrote:
> On Thu, Jan 26, 2012 at 10:29:00AM +0100, Andreas Bießmann 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?
well ... we could. Will you find a place to set the mask?
best regards
Andreas Bießmann
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ptxdist] [PATCH v2] bin/ptxdist: set umask globally
2012-01-26 9:29 [ptxdist] [PATCH] bin/ptxdist: check_dirs_mkdir() utilize umask Andreas Bießmann
2012-01-26 15:18 ` Michael Olbrich
@ 2012-02-03 10:48 ` Andreas Bießmann
2012-02-07 13:22 ` Michael Olbrich
1 sibling, 1 reply; 6+ messages in thread
From: Andreas Bießmann @ 2012-02-03 10:48 UTC (permalink / raw)
To: PTXdist list
Signed-off-by: Andreas Bießmann <biessmann@corscience.de>
---
Michael,
how about this one?
regards
Andreas
bin/ptxdist | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/bin/ptxdist b/bin/ptxdist
index 74a5a23..a35ef18 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -19,6 +19,7 @@ PTXDIST_COLLECTIONCONFIG_DEFAULT='${PTXDIST_WORKSPACE}/selected_collectionconfig
PTXDIST_TOOLCHAIN_DEFAULT='${PTXDIST_WORKSPACE}/selected_toolchain'
PTXDIST_PTXRC_DEFAULT=${PTXDIST_PTXRC:-'${HOME}/.ptxdist/ptxdistrc-${PTXDIST_VERSION_PTXRC}'}
+umask 0022
#
# menu_select
--
1.7.8.3
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptxdist] [PATCH v2] bin/ptxdist: set umask globally
2012-02-03 10:48 ` [ptxdist] [PATCH v2] bin/ptxdist: set umask globally Andreas Bießmann
@ 2012-02-07 13:22 ` Michael Olbrich
2012-02-07 13:36 ` Michael Olbrich
0 siblings, 1 reply; 6+ messages in thread
From: Michael Olbrich @ 2012-02-07 13:22 UTC (permalink / raw)
To: ptxdist
On Fri, Feb 03, 2012 at 11:48:14AM +0100, Andreas Bießmann wrote:
> Signed-off-by: Andreas Bießmann <biessmann@corscience.de>
> ---
> Michael,
>
> how about this one?
Hmmm, I've been playing with this a bit. What error do you get? For me
mkdir -m755 overwrites anything set with umask.
Michael
> regards
>
> Andreas
>
> bin/ptxdist | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/bin/ptxdist b/bin/ptxdist
> index 74a5a23..a35ef18 100755
> --- a/bin/ptxdist
> +++ b/bin/ptxdist
> @@ -19,6 +19,7 @@ PTXDIST_COLLECTIONCONFIG_DEFAULT='${PTXDIST_WORKSPACE}/selected_collectionconfig
> PTXDIST_TOOLCHAIN_DEFAULT='${PTXDIST_WORKSPACE}/selected_toolchain'
> PTXDIST_PTXRC_DEFAULT=${PTXDIST_PTXRC:-'${HOME}/.ptxdist/ptxdistrc-${PTXDIST_VERSION_PTXRC}'}
>
> +umask 0022
>
> #
> # menu_select
> --
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptxdist] [PATCH v2] bin/ptxdist: set umask globally
2012-02-07 13:22 ` Michael Olbrich
@ 2012-02-07 13:36 ` Michael Olbrich
0 siblings, 0 replies; 6+ messages in thread
From: Michael Olbrich @ 2012-02-07 13:36 UTC (permalink / raw)
To: ptxdist
On Tue, Feb 07, 2012 at 02:22:56PM +0100, Michael Olbrich wrote:
> On Fri, Feb 03, 2012 at 11:48:14AM +0100, Andreas Bießmann wrote:
> > Signed-off-by: Andreas Bießmann <biessmann@corscience.de>
> > ---
> > Michael,
> >
> > how about this one?
>
> Hmmm, I've been playing with this a bit. What error do you get? For me
> mkdir -m755 overwrites anything set with umask.
maybe you need to use a GNU mkdir?
Michael
> > regards
> >
> > Andreas
> >
> > bin/ptxdist | 1 +
> > 1 files changed, 1 insertions(+), 0 deletions(-)
> >
> > diff --git a/bin/ptxdist b/bin/ptxdist
> > index 74a5a23..a35ef18 100755
> > --- a/bin/ptxdist
> > +++ b/bin/ptxdist
> > @@ -19,6 +19,7 @@ PTXDIST_COLLECTIONCONFIG_DEFAULT='${PTXDIST_WORKSPACE}/selected_collectionconfig
> > PTXDIST_TOOLCHAIN_DEFAULT='${PTXDIST_WORKSPACE}/selected_toolchain'
> > PTXDIST_PTXRC_DEFAULT=${PTXDIST_PTXRC:-'${HOME}/.ptxdist/ptxdistrc-${PTXDIST_VERSION_PTXRC}'}
> >
> > +umask 0022
> >
> > #
> > # menu_select
> > --
> > 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
>
--
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-02-07 13:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-26 9:29 [ptxdist] [PATCH] bin/ptxdist: check_dirs_mkdir() utilize umask Andreas Bießmann
2012-01-26 15:18 ` Michael Olbrich
2012-01-26 16:08 ` Andreas Bießmann
2012-02-03 10:48 ` [ptxdist] [PATCH v2] bin/ptxdist: set umask globally Andreas Bießmann
2012-02-07 13:22 ` Michael Olbrich
2012-02-07 13:36 ` Michael Olbrich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox