[PATCH] fix 4.0.17 usermod breakage

Greg Schafer <[email protected]> Wed, 12 Jul 2006 14:41:48 +1000
Newsgroups gmane.linux.pld.shadow.general
Message-ID <[email protected]>
--ZPt4rx8FFjLCG7dd
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit

Hi

The following change:


2006-06-25  Tomasz K³oczko  <[email protected]>

        * src/usermod.c: fixes in getopt_long() optstring: s/a/a:/ and added h.


has broken the semantics of "usermod -G group -a".

Back in October before usermod was rewritten for getopt_long() use, the
usage string was:

"Usage: %s\t[-u uid [-o]] [-g group] [[-G group,...] [-a]] \n"

which makes perfect sense.

I suggest the "s/a/a:/" change be reverted, the usage be rewritten and the
man page be clarified. Suggested patch attached.

Regards
Greg

--ZPt4rx8FFjLCG7dd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="shadow-4.0.17.patch"

diff -Naur shadow-4.0.17.orig/man/usermod.8.xml shadow-4.0.17/man/usermod.8.xml
--- shadow-4.0.17.orig/man/usermod.8.xml	2006-06-16 16:11:04.000000000 +0000
+++ shadow-4.0.17/man/usermod.8.xml	2006-07-12 04:26:20.000000000 +0000
@@ -39,11 +39,11 @@
       <varlistentry>
 	<term>
 	  <option>-a</option>, <option>--append</option>
-	  <replaceable>GROUP</replaceable>
 	</term>
 	<listitem>
 	  <para>
-	    Add the user to the supplemental group.
+	    Add the user to the supplemental group(s). Use only with
+	    <option>-G</option> option.
 	  </para>
 	</listitem>
       </varlistentry>
diff -Naur shadow-4.0.17.orig/src/usermod.c shadow-4.0.17/src/usermod.c
--- shadow-4.0.17.orig/src/usermod.c	2006-06-25 13:10:29.000000000 +0000
+++ shadow-4.0.17/src/usermod.c	2006-07-12 04:32:29.000000000 +0000
@@ -276,7 +276,8 @@
 	fprintf (stderr, _("Usage: usermod [options] LOGIN\n"
 			   "\n"
 			   "Options:\n"
-			   "  -a, --append GROUP		append the user to the supplemental GROUP\n"
+			   "  -a, --append			append the user to the supplemental GROUPS\n"
+			   "				(use only with -G)\n"
 			   "  -c, --comment COMMENT		new value of the GECOS field\n"
 			   "  -d, --home HOME_DIR		new home directory for the user account\n"
 			   "  -e, --expiredate EXPIRE_DATE	set account expiration date to EXPIRE_DATE\n"
@@ -922,7 +923,7 @@
 			{NULL, 0, NULL, '\0'}
 		};
 		while ((c =
-			getopt_long (argc, argv, "a:c:d:e:f:g:G:hl:Lmop:s:u:U",
+			getopt_long (argc, argv, "ac:d:e:f:g:G:hl:Lmop:s:u:U",
 				     long_options, NULL)) != -1) {
 			switch (c) {
 			case 'a':

--ZPt4rx8FFjLCG7dd
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline