Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Korsgaard <peter@korsgaard.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] build: fix umask test
Date: Mon, 30 May 2016 09:55:39 +0200	[thread overview]
Message-ID: <87mvn82d50.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <20160530070635.GA27560@airbook.vandijck-laurijssen.be> (Kurt Van Dijck's message of "Mon, 30 May 2016 09:06:35 +0200")

>>>>> "Kurt" == Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be> writes:

 > Some shells' builtin umask does not print 2 leading 0's for the umask.
 > Not doing so would break the comparison.
 > This patch makes sure that the umask has (at least) 4 digits.

 > Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
 > ---
 >  Makefile | 2 +-
 >  1 file changed, 1 insertion(+), 1 deletion(-)

 > diff --git a/Makefile b/Makefile
 > index 63502d0..9a36769 100644
 > --- a/Makefile
 > +++ b/Makefile
 > @@ -26,7 +26,7 @@
 
 >  # Trick for always running with a fixed umask
 >  UMASK = 0022
 > -ifneq ($(shell umask),$(UMASK))
 > +ifneq ($(shell printf "%04o\n" `umask`),$(UMASK))

Thanks, but with at least zsh this doesn't work:

zsh --version
zsh 5.0.7 (x86_64-pc-linux-gnu)

umask
022

printf "%04o\n" $(umask)
0026

It seems like the printf arguments are always handled as decimal.

It does work on bash though:

bash --version
GNU bash, version 4.3.33(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

umask
0022

printf "%04o\n" $(umask)
0022

It seems we need to use the base#number syntax, E.G. 8#`umask` to get
zsh to interprete it as octal, but bash doesn't seem to like it :/

But the real question is why this happens in the first place? We do set
SHELL=bash, so all of this should be running under bash where it works.

What shell are you using and how is your setup?

-- 
Bye, Peter Korsgaard

  reply	other threads:[~2016-05-30  7:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-30  7:06 [Buildroot] [PATCH] build: fix umask test Kurt Van Dijck
2016-05-30  7:55 ` Peter Korsgaard [this message]
2016-05-30  8:05   ` Peter Korsgaard
2016-05-30  9:17     ` Thomas Petazzoni
2016-05-30  9:53       ` Kurt Van Dijck
2016-05-30  9:59         ` Peter Korsgaard
2016-05-30 21:09           ` Kurt Van Dijck
2016-05-30 21:31             ` Arnout Vandecappelle
2016-05-31  7:43               ` Kurt Van Dijck
2016-05-31  7:48                 ` Peter Korsgaard
2016-05-31  9:35                   ` Kurt Van Dijck
2016-05-30  9:56       ` Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mvn82d50.fsf@dell.be.48ers.dk \
    --to=peter@korsgaard.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox