Util-Linux Archive on lore.kernel.org
 help / Atom feed
* [PATCH 2/2] su-common.c: prefer ENV_SUPATH over ENV_ROOTPATH
@ 2019-01-10  0:28 Stanislav Brabec
  2019-01-10 11:28 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Stanislav Brabec @ 2019-01-10  0:28 UTC (permalink / raw)
  To: util-linux

ENV_SUPATH and ENV_ROOTPATH are equivalent and ENV_ROOTPATH takes
precedence in both login and su. It makes no sense. More logical would be
precedence of ENV_SUPATH in su and ENV_ROOTPATH in login.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
---
 login-utils/login.1     | 2 +-
 login-utils/runuser.1   | 2 +-
 login-utils/su-common.c | 4 ++--
 login-utils/su.1        | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/login-utils/login.1 b/login-utils/login.1
index cb8addec3..b73eae147 100644
--- a/login-utils/login.1
+++ b/login-utils/login.1
@@ -282,7 +282,7 @@ a regular user logs in.  The default value is
 (string)
 .RS 4
 If set, it will be used to define the PATH environment variable when
-the superuser logs in.  The default value is
+the superuser logs in.  ENV_ROOTPATH takes precedence.  The default value is
 .I /usr\:/local\:/sbin:\:/usr\:/local\:/bin:\:/sbin:\:/bin:\:/usr\:/sbin:\:/usr\:/bin
 .RE
 .SH FILES
diff --git a/login-utils/runuser.1 b/login-utils/runuser.1
index bf0d02471..221672200 100644
--- a/login-utils/runuser.1
+++ b/login-utils/runuser.1
@@ -183,7 +183,7 @@ default value is
 .B ENV_SUPATH
 (string)
 .RS 4
-Defines the PATH environment variable for root. The default value is
+Defines the PATH environment variable for root.  ENV_SUPATH takes precedence.  The default value is
 .IR /usr/local/sbin:\:/usr/local/bin:\:/sbin:\:/bin:\:/usr/sbin:\:/usr/bin .
 .RE
 .PP
diff --git a/login-utils/su-common.c b/login-utils/su-common.c
index 19074247c..0e44eb87c 100644
--- a/login-utils/su-common.c
+++ b/login-utils/su-common.c
@@ -989,8 +989,8 @@ static void setenv_path(const struct passwd *pw)
 	if (pw->pw_uid)
 		rc = logindefs_setenv("PATH", "ENV_PATH", _PATH_DEFPATH);
 
-	else if ((rc = logindefs_setenv("PATH", "ENV_ROOTPATH", NULL)) != 0)
-		rc = logindefs_setenv("PATH", "ENV_SUPATH", _PATH_DEFPATH_ROOT);
+	else if ((rc = logindefs_setenv("PATH", "ENV_SUPATH", NULL)) != 0)
+		rc = logindefs_setenv("PATH", "ENV_ROOTPATH", _PATH_DEFPATH_ROOT);
 
 	if (rc)
 		err(EXIT_FAILURE, _("failed to set the PATH environment variable"));
diff --git a/login-utils/su.1 b/login-utils/su.1
index d6a064fd2..5ae6d6b2d 100644
--- a/login-utils/su.1
+++ b/login-utils/su.1
@@ -209,7 +209,7 @@ default value is
 .B ENV_SUPATH
 (string)
 .RS 4
-Defines the PATH environment variable for root.  The default value is
+Defines the PATH environment variable for root.  ENV_SUPATH takes precedence.  The default value is
 .IR /usr/local/sbin:\:/usr/local/bin:\:/sbin:\:/bin:\:/usr/sbin:\:/usr/bin .
 .RE
 .PP
-- 
2.20.1


-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                         e-mail: sbrabec@suse.com
Køi¾íkova 148/34 (Corso IIa)                  tel: +49 911 7405384547
186 00 Praha 8-Karlín                          fax:  +420 284 084 001
Czech Republic                                    http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] su-common.c: prefer ENV_SUPATH over ENV_ROOTPATH
  2019-01-10  0:28 [PATCH 2/2] su-common.c: prefer ENV_SUPATH over ENV_ROOTPATH Stanislav Brabec
@ 2019-01-10 11:28 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2019-01-10 11:28 UTC (permalink / raw)
  To: Stanislav Brabec; +Cc: util-linux

On Thu, Jan 10, 2019 at 01:28:54AM +0100, Stanislav Brabec wrote:
>  login-utils/login.1     | 2 +-
>  login-utils/runuser.1   | 2 +-
>  login-utils/su-common.c | 4 ++--
>  login-utils/su.1        | 2 +-
>  4 files changed, 5 insertions(+), 5 deletions(-)

Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-10  0:28 [PATCH 2/2] su-common.c: prefer ENV_SUPATH over ENV_ROOTPATH Stanislav Brabec
2019-01-10 11:28 ` Karel Zak

Util-Linux Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/util-linux/0 util-linux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 util-linux util-linux/ https://lore.kernel.org/util-linux \
		util-linux@vger.kernel.org util-linux@archiver.kernel.org
	public-inbox-index util-linux


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.util-linux


AGPL code for this site: git clone https://public-inbox.org/ public-inbox