and B is in some other file system.
[bug introduced in coreutils-9.0]
+ 'id xyz' now uses the name 'xyz' to determine groups, instead of xyz's uid.
+ [bug introduced in coreutils-8.22]
+
On macOS, 'mv A B' no longer fails with "Operation not supported"
when A and B are in the same tmpfs file system.
[bug introduced in coreutils-9.0]
int optc;
int selinux_enabled = (is_selinux_enabled () > 0);
bool smack_enabled = is_smack_enabled ();
- char *pw_name = NULL;
initialize_main (&argc, &argv);
set_program_name (argv[0]);
/* For each username/userid to get its pw_name field */
for (; optind < n_ids; optind++)
{
+ char *pw_name = NULL;
struct passwd *pwd = NULL;
char const *spec = argv[optind];
/* Disallow an empty spec here as parse_user_spec() doesn't
specify a noop or "reset special bits" depending on the system. */
if (*spec)
{
- if (parse_user_spec (spec, &euid, NULL, NULL, NULL) == NULL)
- {
- /* parse_user_spec will only extract a numeric spec,
- so we lookup that here to verify and also retrieve
- the PW_NAME used subsequently in group lookup. */
- pwd = getpwuid (euid);
- }
+ if (parse_user_spec (spec, &euid, NULL, &pw_name, NULL) == NULL)
+ pwd = pw_name ? getpwnam (pw_name) : getpwuid (euid);
}
if (pwd == NULL)
{
- error (0, errno, _("%s: no such user"), quote (argv[optind]));
+ error (0, errno, _("%s: no such user"), quote (spec));
ok &= false;
- continue;
}
- pw_name = xstrdup (pwd->pw_name);
- ruid = euid = pwd->pw_uid;
- rgid = egid = pwd->pw_gid;
- print_stuff (pw_name);
+ else
+ {
+ if (!pw_name)
+ pw_name = xstrdup (pwd->pw_name);
+ ruid = euid = pwd->pw_uid;
+ rgid = egid = pwd->pw_gid;
+ print_stuff (pw_name);
+ }
free (pw_name);
}
}
if (rgid == NO_GID && errno)
die (EXIT_FAILURE, errno, _("cannot get real GID"));
}
- print_stuff (pw_name);
+ print_stuff (NULL);
}
return ok ? EXIT_SUCCESS : EXIT_FAILURE;
if (just_user)
print_user (use_real ? ruid : euid);
- /* print_group and print_group_lists functions return true on successful
+ /* print_group and print_group_list return true on successful
execution but false if something goes wrong. We then AND this value with
the current value of 'ok' because we want to know if one of the previous
users faced a problem in these functions. This value of 'ok' is later used