[util-linux] 2.22.1-4: #872787

kzak kzak at fedoraproject.org
Fri Nov 16 12:00:37 UTC 2012


commit 84d2be4ab357d6f98b38dd1c1ea878362eaad0cb
Author: Karel Zak <kzak at redhat.com>
Date:   Fri Nov 16 13:00:20 2012 +0100

    2.22.1-4: #872787
    
    Signed-off-by: Karel Zak <kzak at redhat.com>

 0210-su-fix-COMMAND-not-specified-error.patch |   62 +++++++++++++++++++++++++
 util-linux.spec                               |   37 +++------------
 2 files changed, 70 insertions(+), 29 deletions(-)
---
diff --git a/0210-su-fix-COMMAND-not-specified-error.patch b/0210-su-fix-COMMAND-not-specified-error.patch
new file mode 100644
index 0000000..c1818c0
--- /dev/null
+++ b/0210-su-fix-COMMAND-not-specified-error.patch
@@ -0,0 +1,62 @@
+From 360e088738aa792bf6c52e777d64b5163b45362a Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at redhat.com>
+Date: Wed, 7 Nov 2012 15:20:39 +0100
+Subject: [PATCH] su: fix "COMMAND not specified" error
+
+ # su
+ su: COMMAND not specified
+
+This error message make sense for "runuser -u <user> <command>" only.
+
+Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=872787
+Signed-off-by: Karel Zak <kzak at redhat.com>
+---
+ login-utils/su-common.c | 29 +++++++++++++++++++----------
+ 1 file changed, 19 insertions(+), 10 deletions(-)
+
+diff --git a/login-utils/su-common.c b/login-utils/su-common.c
+index 1fa76c8..5abdc84 100644
+--- a/login-utils/su-common.c
++++ b/login-utils/su-common.c
+@@ -761,19 +761,28 @@ su_main (int argc, char **argv, int mode)
+       ++optind;
+     }
+ 
+-  /* if not "-u <user>" specified then fallback to classic su(1) */
+-  if (!runuser_user && optind < argc)
+-    new_user = argv[optind++];
+-  else {
+-      /* runuser -u <command> */
+-    new_user = runuser_user;
+-    if (shell || fast_startup || command || simulate_login) {
+-      errx(EXIT_FAILURE,
++  switch (su_mode) {
++  case RUNUSER_MODE:
++    if (runuser_user) {
++      /* runuser -u <user> <command> */
++      new_user = runuser_user;
++      if (shell || fast_startup || command || simulate_login) {
++        errx(EXIT_FAILURE,
+ 	   _("options --{shell,fast,command,session-command,login} and "
+ 	     "--user are mutually exclusive."));
++      }
++      if (optind == argc)
++        errx(EXIT_FAILURE, _("COMMAND not specified."));
++
++      break;
+     }
+-    if (optind == argc)
+-      errx(EXIT_FAILURE, _("COMMAND not specified."));
++    /* fallthrough if -u <user> is not specified, then follow
++     * traditional su(1) behavior
++     */
++  case SU_MODE:
++    if (optind < argc)
++      new_user = argv[optind++];
++    break;
+   }
+ 
+   if ((num_supp_groups || use_gid) && restricted)
+-- 
+1.7.11.7
+
diff --git a/util-linux.spec b/util-linux.spec
index a2faa3d..e5550fb 100644
--- a/util-linux.spec
+++ b/util-linux.spec
@@ -2,7 +2,7 @@
 Summary: A collection of basic system utilities
 Name: util-linux
 Version: 2.22.1
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ and BSD with advertising and Public Domain
 Group: System Environment/Base
 URL: http://en.wikipedia.org/wiki/Util-linux
@@ -124,6 +124,7 @@ Patch206: 0206-su-add-segmentation-fault-reporting-of-the-child-pro.patch
 Patch207: 0207-su-fixed-a-typo-in-pam-error-message.patch
 Patch208: 0208-runuser-add-u-to-not-execute-shell.patch
 Patch209: 0209-build-sys-move-runuser-to-sbin-dir.patch
+Patch210: 0210-su-fix-COMMAND-not-specified-error.patch
 
 %description
 The util-linux package contains a large variety of low-level system
@@ -235,34 +236,9 @@ SMP systems.
 %setup -q -a 11 -n %{name}-%{upstream_version}
 cp %{SOURCE8} %{SOURCE9} .
 
-%patch0 -p1
-%patch1 -p1
-%patch2 -p1
-%patch3 -p1
-%patch4 -p1
-
-%patch101 -p1
-%patch102 -p1
-%patch103 -p1
-%patch104 -p1
-%patch105 -p1
-%patch106 -p1
-%patch107 -p1
-%patch108 -p1
-%patch109 -p1
-%patch110 -p1
-%patch111 -p1
-
-%patch200 -p1
-%patch201 -p1
-%patch202 -p1
-%patch203 -p1
-%patch204 -p1
-%patch205 -p1
-%patch206 -p1
-%patch207 -p1
-%patch208 -p1
-%patch209 -p1
+for p in %{patches}; do
+  %{__patch} -p1 -F%{_default_patch_fuzz} %{_default_patch_flags} -i "$p"
+done
 
 %build
 unset LINGUAS || :
@@ -803,6 +779,9 @@ fi
 
 
 %changelog
+* Fri Nov 16 2012 Karel Zak <kzak at redhat.com> 2.22.1-4
+- fix #872787 - su: COMMAND not specified
+
 * Thu Nov  1 2012 Karel Zak <kzak at redhat.com> 2.22.1-3
 - backport upstream runuser(1)
 - enable su(1)


More information about the scm-commits mailing list