Skip to contentSkip to conversation

Fix umask settings for non-bash shells for root user

PATCH New Petr Vorel 6 participants 9 messages Jun 15, 2015 – Oct 3, 2015

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/1 Fix umask settings for non-bash shells for root user

From: Petr Vorel <[email protected]>

.bash_profile is not readed by some shells (e.g. busybox), so move umask into .profile. Here it's also loaded .bashrc, when presented and shell is bash.

CREDITS: inspired by Debian skeleton files.

---
 system/skeleton/root/.bash_profile |  7 -------
 system/skeleton/root/.profile      | 10 ++++++++++
 2 files changed, 10 insertions(+), 7 deletions(-)
 delete mode 100644 system/skeleton/root/.bash_profile
 create mode 100644 system/skeleton/root/.profile
system/skeleton/root/.bash_profile deleted +0 -7
deleted file mode 100644
index 0ee04a3..0000000
@@ -1,7 +0,0 @@
-# .bash_profile
-
-umask 022
-
-if [ -f ~/.bashrc ]; then
-    source ~/.bashrc
-fi
system/skeleton/root/.profile new file +10 -0
new file mode 100644
index 0000000..452ae20
@@ -0,0 +1,10 @@
+# ~/.profile: executed by the command interpreter for login shells.
+# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
+# exists.
+umask 022
+
+if [ -n "$BASH_VERSION" ]; then
+    if [ -f ~/.bashrc ]; then
+        source ~/.bashrc
+    fi
+fi
Signature · 1 line
1.8.0
#1 lore raw

PATCH 1/1 Fix umask settings for non-bash shells for root user

Dear Petr Vorel,

Adding Yann, Arnout and Peter in Cc.

Quoted 35 lines · Petr Vorel

From: Petr Vorel <[email protected]>

.bash_profile is not readed by some shells (e.g. busybox), so move umask into .profile. Here it's also loaded .bashrc, when presented and shell is bash.

CREDITS: inspired by Debian skeleton files.

---
 system/skeleton/root/.bash_profile |  7 -------
 system/skeleton/root/.profile      | 10 ++++++++++
 2 files changed, 10 insertions(+), 7 deletions(-)
 delete mode 100644 system/skeleton/root/.bash_profile
 create mode 100644 system/skeleton/root/.profile
system/skeleton/root/.bash_profile deleted +0 -7
deleted file mode 100644
index 0ee04a3..0000000
@@ -1,7 +0,0 @@
-# .bash_profile
-
-umask 022
-
-if [ -f ~/.bashrc ]; then
-    source ~/.bashrc
-fi
system/skeleton/root/.profile new file +0 -0
new file mode 100644
index 0000000..452ae20

system/skeleton/root/.profile line 10

Quoted 10 lines
system/skeleton/root/.profile new file +10 -0
@@ -0,0 +1,10 @@
+# ~/.profile: executed by the command interpreter for login shells.
+# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
+# exists.
+umask 022
+
+if [ -n "$BASH_VERSION" ]; then
+    if [ -f ~/.bashrc ]; then
+        source ~/.bashrc
+    fi
+fi

Well, actually, I am wondering if we need to bundle a .profile file at all. Our system/skeleton/root/ directory contains:

-rw-r--r--  1 thomas thomas    0 oct.   4  2014 .bash_history
-rw-r--r--  1 thomas thomas  175 oct.   4  2014 .bash_logout
-rw-rw-r--  1 thomas thomas   78 mars   5 15:40 .bash_profile

I don't really see why we need any of those three files in our default skeleton. Maybe we should simply remove them, use the default behavior of whatever shell is installed, and let users provide their own custom configuration if needed through a post-build script or rootfs overlay.

Yann, Arnout, Peter, your thoughts?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 Fix umask settings for non-bash shells for root user

Petr, All,

On 2015-08-29 10:57 +0200, Thomas Petazzoni spake thusly:

Quoted 54 lines · Petr Vorel
Quoted 35 lines

From: Petr Vorel <[email protected]>

.bash_profile is not readed by some shells (e.g. busybox), so move umask into .profile. Here it's also loaded .bashrc, when presented and shell is bash.

CREDITS: inspired by Debian skeleton files.

---
 system/skeleton/root/.bash_profile |  7 -------
 system/skeleton/root/.profile      | 10 ++++++++++
 2 files changed, 10 insertions(+), 7 deletions(-)
 delete mode 100644 system/skeleton/root/.bash_profile
 create mode 100644 system/skeleton/root/.profile
system/skeleton/root/.bash_profile deleted +0 -7
deleted file mode 100644
index 0ee04a3..0000000
@@ -1,7 +0,0 @@
-# .bash_profile
-
-umask 022
-
-if [ -f ~/.bashrc ]; then
-    source ~/.bashrc
-fi
system/skeleton/root/.profile new file +0 -0
new file mode 100644
index 0000000..452ae20

system/skeleton/root/.profile line 10

Quoted 10 lines
system/skeleton/root/.profile new file +10 -0
@@ -0,0 +1,10 @@
+# ~/.profile: executed by the command interpreter for login shells.
+# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
+# exists.
+umask 022
+
+if [ -n "$BASH_VERSION" ]; then
+    if [ -f ~/.bashrc ]; then
+        source ~/.bashrc
+    fi
+fi

Well, actually, I am wondering if we need to bundle a .profile file at all. Our system/skeleton/root/ directory contains:

(quoted diff) +0 -3
-rw-r--r--  1 thomas thomas    0 oct.   4  2014 .bash_history
-rw-r--r--  1 thomas thomas  175 oct.   4  2014 .bash_logout
-rw-rw-r--  1 thomas thomas   78 mars   5 15:40 .bash_profile
Quoted 6 lines

I don't really see why we need any of those three files in our default skeleton. Maybe we should simply remove them, use the default behavior of whatever shell is installed, and let users provide their own custom configuration if needed through a post-build script or rootfs overlay.

Yann, Arnout, Peter, your thoughts?

My opinion? Here's what I'd do ;-)

git rm system/skeleton/root/.bash_*

And maybe provide a simple .profile *iff* needed.

As for bash, our bash.mk may install those .bash_* files in /root/ .

Furthermore, I'd also like /etc/profile be cleaned-up of all the mess, moving each (interesting) parts to separate files in /etc/profile.d/ .

And while at it:

git rm system/skeleton/root/.empty

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 1/1 Fix umask settings for non-bash shells for root user

Dear Yann E. MORIN,

Quoted 5 lines · Yann E. MORIN
Quoted 1 line

Yann, Arnout, Peter, your thoughts?

My opinion? Here's what I'd do ;-)

git rm system/skeleton/root/.bash_*

That's also what I want to do.

Quoted 1 line

And maybe provide a simple .profile *iff* needed.

Can you check if a .profile is really needed? If so, can you submit a patch series cleaning up .bash_* ?

Quoted 1 line

As for bash, our bash.mk may install those .bash_* files in /root/ .

Right.

Quoted 2 lines

Furthermore, I'd also like /etc/profile be cleaned-up of all the mess, moving each (interesting) parts to separate files in /etc/profile.d/ .

Why not, but let's say it's a separate matter.

Quoted 3 lines

And while at it:

git rm system/skeleton/root/.empty

Why? Git doesn't track empty directories, so we have those .empty files all over the place. I don't see what would recreate the root/ directory for the root user if we don't keep it in the skeleton. Am I missing something?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH 1/1 Fix umask settings for non-bash shells for root user

Thomas, All,

On 2015-08-29 11:29 +0200, Thomas Petazzoni spake thusly:

Quoted 6 lines · Yann E. MORIN
Quoted 4 lines
Quoted 1 line

Yann, Arnout, Peter, your thoughts?

My opinion? Here's what I'd do ;-)
git rm system/skeleton/root/.bash_*

Quoted 6 lines

That's also what I want to do.

Quoted 1 line

And maybe provide a simple .profile *iff* needed.

Can you check if a .profile is really needed? If so, can you submit a patch series cleaning up .bash_* ?

After the release, maybe?

Quoted 4 lines
Quoted 2 lines

Furthermore, I'd also like /etc/profile be cleaned-up of all the mess, moving each (interesting) parts to separate files in /etc/profile.d/ .

Why not, but let's say it's a separate matter.

Yes.

Quoted 8 lines
Quoted 3 lines

And while at it:

git rm system/skeleton/root/.empty

Why? Git doesn't track empty directories, so we have those .empty files all over the place. I don't see what would recreate the root/ directory for the root user if we don't keep it in the skeleton. Am I missing something?

Right. I was thinking of keeping a .profile in that directory. If there is a .profile, there is no need for .empty . If there is no .profile (and no other file), we need to keep .empty , yes.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH 1/1 Fix umask settings for non-bash shells for root user

Dear Yann E. MORIN,

Quoted 6 lines · Yann E. MORIN
Quoted 4 lines
Quoted 1 line

And maybe provide a simple .profile *iff* needed.

Can you check if a .profile is really needed? If so, can you submit a patch series cleaning up .bash_* ?

After the release, maybe?

Absolutely, this is post 2015.08 stuff.

Quoted 8 lines
Quoted 4 lines

Why? Git doesn't track empty directories, so we have those .empty files all over the place. I don't see what would recreate the root/ directory for the root user if we don't keep it in the skeleton. Am I missing something?

Right. I was thinking of keeping a .profile in that directory. If there is a .profile, there is no need for .empty . If there is no .profile (and no other file), we need to keep .empty , yes.

Ah, ok, I see. We're on the same line then. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#6 lore raw

PATCH 1/1 Fix umask settings for non-bash shells for root user

In reply to Yann E. MORIN
Quoted 3 lines · Yann E. MORIN

Petr, All,

On 2015-08-29 10:57 +0200, Thomas Petazzoni spake thusly:

[snip]

Quoted 12 lines
Quoted 12 lines

Well, actually, I am wondering if we need to bundle a .profile file at all. Our system/skeleton/root/ directory contains:

(quoted diff) +0 -3
-rw-r--r--  1 thomas thomas    0 oct.   4  2014 .bash_history
-rw-r--r--  1 thomas thomas  175 oct.   4  2014 .bash_logout
-rw-rw-r--  1 thomas thomas   78 mars   5 15:40 .bash_profile

I don't really see why we need any of those three files in our default skeleton. Maybe we should simply remove them, use the default behavior of whatever shell is installed, and let users provide their own custom configuration if needed through a post-build script or rootfs overlay.

Quoted 5 lines
Quoted 1 line

Yann, Arnout, Peter, your thoughts?

My opinion? Here's what I'd do ;-)

git rm system/skeleton/root/.bash_*

+1

Even when bash is the default shell, none of these are needed IMHO.

Regards,
Arnout

Quoted 15 lines

And maybe provide a simple .profile *iff* needed.

As for bash, our bash.mk may install those .bash_* files in /root/ .

Furthermore, I'd also like /etc/profile be cleaned-up of all the mess, moving each (interesting) parts to separate files in /etc/profile.d/ .

And while at it:

git rm system/skeleton/root/.empty

Regards,
Yann E. MORIN.

Signature · 6 lines
Arnout Vandecappelle      arnout dot vandecappelle at essensium dot com
Senior Embedded Software Architect . . . . . . +32-478-010353 (mobile)
Essensium, Mind division . . . . . . . . . . . . . . http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium . . . . . BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#7 lore raw

PATCH 1/1 Fix umask settings for non-bash shells for root user

Quoted 9 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

My opinion? Here's what I'd do ;-)

git rm system/skeleton/root/.bash_*

+1

Even when bash is the default shell, none of these are needed IMHO.

+1 from here as well (for 2015.11).

Signature · 2 lines
Venlig hilsen,
Peter Korsgaard 
#8 lore raw

PATCH 1/1 Fix umask settings for non-bash shells for root user

Hi Petr, all

The idea behind that patch has be respinned and reworked into a series to cleanup /etc/profile a little bit.
You can find it there:
http://lists.busybox.net/pipermail/buildroot/2015-October/140786.html

Thank you very much.

Quoted 12 lines · Peter Korsgaard
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

My opinion? Here's what I'd do ;-)

git rm system/skeleton/root/.bash_*

+1

Even when bash is the default shell, none of these are needed IMHO.

+1 from here as well (for 2015.11).

Quoted 8 lines

--
Venlig hilsen,
Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20151003/e4c74e65/attachment.html>