Missing short options in scsi_id man page
Environment
- Red Hat Enterprise Linux (RHEL) 6.2
- udev-147-2.40.el6.x86_64
Issue
- Is there any documentation on the short options to /sbin/scsi_id. The short options to /sbin/scsi_id aren't documented anywhere (except in the source code). These options (which are b, c, d, e, f, g, i, p, s, u) should be documented alongside the long options. Can this be added to the man page?
Resolution
Update to udev-147-2.57
or later to resolve this issue. The man page for scsi_id now contains the short options.
Root Cause
The short options for the scsi_id command were documented in the source code. The same information was not found in the man page.
Diagnostic Steps
The variable names are somewhat descriptive in lieu of official documentation:
static int set_options(int argc, char **argv, const char *short_opts,
char *target, char *maj_min_dev)
{
int option;
/*
* optind is a global extern used by getopt. Since we can call
* set_options twice (once for command line, and once for config
* file) we have to reset this back to 1. [Note glibc handles
* setting this to 0, but klibc does not.]
*/
optind = 1;
while (1) {
option = getopt(argc, argv, short_options);
if (option == -1)
break;
if (optarg)
dprintf("option '%c' arg '%s'\n", option, optarg);
else
dprintf("option '%c'\n", option);
switch (option) {
case 'b':
all_good = 0;
break;
case 'c':
default_callout = optarg;
break;
case 'd':
dev_specified = 1;
strncpy(maj_min_dev, optarg, MAX_NAME_LEN);
break;
case 'e':
use_stderr = 1;
break;
case 'f':
strncpy(config_file, optarg, MAX_NAME_LEN);
break;
case 'g':
all_good = 1;
break;
case 'i':
display_bus_id = 1;
break;
case 'p':
if (strcmp(optarg, "0x80") == 0) {
default_page_code = 0x80;
} else if (strcmp(optarg, "0x83") == 0) {
default_page_code = 0x83;
} else {
log_message(LOG_WARNING,
"Unknown page code '%s'\n", optarg);
return -1;
}
break;
case 's':
sys_specified = 1;
strncpy(target, sysfs_mnt_path, MAX_NAME_LEN);
strncat(target, optarg, MAX_NAME_LEN);
break;
case 'u':
reformat_serial = 1;
break;
case 'v':
debug++;
break;
case 'V':
log_message(LOG_WARNING, "scsi_id version: %s\n",
SCSI_ID_VERSION);
exit(0);
break;
default:
log_message(LOG_WARNING,
"Unknown or bad option '%c' (0x%x)\n",
option, option);
return -1;
}
}
return 0;
}
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments