Most programs take care to operate on all command-line-specified
operands before exiting. That is an important feature that allows
to identify all problems with the first run. However, groups would
exit upon the first problematic user name.
Bug introduced via commit
v6.10-56-g167b8025ac.
* src/groups.c (main): Do not exit immediately upon error.
* tests/misc/groups-process-all.sh: New file. Test for this.
* tests/local.mk (all_tests): Add it.
* NEWS (Bug fixes): Mention this.
specifying -x nfs no longer hangs with problematic nfs mounts.
[bug introduced in coreutils-8.21]
+ `groups inva:lid root` no longer exits immediately upon failure.
+ Now, it prints a diagnostic or a line to stdout for each argument.
+ [bug introduced in the bourne-shell-to-C rewrite for coreutils-6.11]
+
split no longer exits when invocations of a --filter return EPIPE.
[bug introduced in coreutils-8.26]
else
{
/* At least one argument. Divulge the details of the specified users. */
- while (optind < argc)
+ for ( ; optind < argc; optind++)
{
struct passwd *pwd = getpwnam (argv[optind]);
if (pwd == NULL)
- die (EXIT_FAILURE, 0, _("%s: no such user"),
- quote (argv[optind]));
+ {
+ error (0, 0, _("%s: no such user"), quote (argv[optind]));
+ ok = false;
+ continue;
+ }
ruid = pwd->pw_uid;
rgid = egid = pwd->pw_gid;
printf ("%s : ", argv[optind]);
- if (!print_group_list (argv[optind++], ruid, rgid, egid, true, ' '))
+ if (!print_group_list (argv[optind], ruid, rgid, egid, true, ' '))
ok = false;
putchar ('\n');
}
tests/misc/false-status.sh \
tests/misc/fold.pl \
tests/misc/groups-dash.sh \
+ tests/misc/groups-process-all.sh \
tests/misc/groups-version.sh \
tests/misc/head-c.sh \
tests/misc/head-pos.sh \
--- /dev/null
+#!/bin/sh
+# Ensure groups processes all arguments before exiting.
+# With coreutils-2.27 and prior, it would exit upon first failure.
+
+# Copyright (C) 2017 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ groups
+
+returns_ 1 groups :1 :2 :3 2> err || fail=1
+test $(wc -l < err) = 3 || fail=1
+
+Exit $fail