[OE-core] [PATCH 2/2] base-files: ignore "mesg n" error messages

Patrick Ohly patrick.ohly at intel.com
Wed Jul 12 08:44:12 UTC 2017


When using "su - myuser" to change from root to a non-privileged user,
"mesg n" from the default .profile fails with "mesg: error: tty device
is not owned by group `tty' or "mesg: cannot open /dev/ttyS0:
Permission denied", depending on whether mesg comes from busybox or
util-linux.

This does not happen during a normal login because permissions on
/dev/tty* get changed while doing that, something that isn't possible
with plain "su -".

As the error can't be avoided and failures of mesg probably aren't
particularly important, now error messages get dumped to /dev/null.

[YOCTO #11127]

Signed-off-by: Patrick Ohly <patrick.ohly at intel.com>
---
 meta/recipes-core/base-files/base-files/share/dot.profile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-core/base-files/base-files/share/dot.profile b/meta/recipes-core/base-files/base-files/share/dot.profile
index 979793e..a873160 100644
--- a/meta/recipes-core/base-files/base-files/share/dot.profile
+++ b/meta/recipes-core/base-files/base-files/share/dot.profile
@@ -7,4 +7,5 @@ fi
 # path set by /etc/profile
 # export PATH
 
-mesg n
+# Might fail after "su - myuser" when /dev/tty* is not writable by "myuser".
+mesg n 2>/dev/null
-- 
git-series 0.9.1



More information about the Openembedded-core mailing list