diff -Naur psmisc-23.2-old/ChangeLog psmisc-23.2-new/ChangeLog --- psmisc-23.2-old/ChangeLog 2018-08-13 13:25:48.670327531 +0200 +++ psmisc-23.2-new/ChangeLog 2018-09-18 13:13:41.336594226 +0200 @@ -2,9 +2,11 @@ =============== * misc: Command names increased from 16 to 64 characters * buildsys: signals.c depends on signames.h !16 + * docs: Fix fuser.1 groff errors Debian #900225 * killall: look at all namespaces by default * killall: Fix -INT option parsing #11 - * killall: change to getopt_long without _only #12 + * killall: ignore -n 0 #15 + * killall: another crack at fixing getopt #12 #13 * peekfd: Attach to all threads option !15 * pslog: Define PATH_MAX if required Debian:#905797 diff -Naur psmisc-23.2-old/doc/fuser.1 psmisc-23.2-new/doc/fuser.1 --- psmisc-23.2-old/doc/fuser.1 2016-09-21 13:18:43.691359617 +0200 +++ psmisc-23.2-new/doc/fuser.1 2018-09-12 14:13:48.728646493 +0200 @@ -21,15 +21,14 @@ .RB [ \-i ] .RB [ \-M ] .RB [ \-w ] -.RB [ \- \fISIGNAL\fR] +.RB [ \-\c +.IR SIGNAL ] ] -.IR name " ..." +.IR name " \&...\&" .br -.B fuser -.RB \-l +.B fuser \-l .br -.B fuser -.RB \-V +.B fuser \-V .ad b .SH DESCRIPTION .B fuser @@ -88,7 +87,7 @@ and the remote address. All fields are optional, but commas in front of missing fields must be present: .PP -\fB[\fR\fIlcl_port\fR\fB][\fR,\fB[\fR\fIrmt_host\fR\fB][\fR,\fB[\fIrmt_port\fR\fB]]] +.RI [ lcl_port ][,[ rmt_host ][,[ rmt_port ]]] .PP Either symbolic or numeric values can be used for IP addresses and port numbers. @@ -97,19 +96,21 @@ outputs only the PIDs to stdout, everything else is sent to stderr. .SH OPTIONS .TP -\fB\-a\fR, \fB\-\-all\fR +.BR \-a ", " \-\-all Show all files specified on the command line. By default, only files that are accessed by at least one process are shown. .TP -\fB\-c\fR +.B \-c Same as \-m option, used for POSIX compatibility. .TP -\fB\-f\fR +.B \-f Silently ignored, used for POSIX compatibility. .TP -\fB\-k\fR, \fB\-\-kill\fR +.BR \-k ", "\-\-kill Kill processes accessing the file. Unless changed with -\fB\-\fR\fISIGNAL\fR, SIGKILL is sent. An +.BI \- SIGNAL\/\c +, SIGKILL is sent. +An .B fuser process never kills itself, but may kill other .B fuser @@ -117,22 +118,23 @@ .B fuser is set to its real user ID before attempting to kill. .TP -\fB\-i\fR, \fB\-\-interactive\fR -Ask the user for confirmation before killing a process. This option is +.BR \-i ", " \-\-interactive +Ask the user for confirmation before killing a process. +This option is silently ignored if .B \-k is not present too. .TP -\fB\-I\fR, \fB\-\-inode\fR +.BR \-I ", " \-\-inode For the name space .B file -let all comparisions be based on the inodes of the specified file(s) +let all comparisons be based on the inodes of the specified file(s) and never on the file names even on network based file systems. .TP -\fB\-l\fR, \fB\-\-list\-signals\fR +.BR \-l ", " \-\-list\-signals List all known signal names. .TP -\fB\-m\fR \fINAME\fR, \fB\-\-mount\fR \fINAME\fR +.BI -m " NAME \fR, " "\-\-mount " NAME .I NAME specifies a file on a mounted file system or a block device that is mounted. All processes accessing files on that file system are listed. @@ -140,21 +142,21 @@ .IR NAME /. to use any file system that might be mounted on that directory. .TP -\fB\-M\fR, \fB\-\-ismountpoint\fR +.BR \-M ", " \-\-ismountpoint Request will be fulfilled only if .I NAME -specifies a mountpoint. This is an invaluable seatbelt which prevents +specifies a mountpoint. This is an invaluable seat belt which prevents you from killing the machine if .I NAME happens to not be a filesystem. .TP -\fB\-w\fP +.B \-w Kill only processes which have write access. This option is silently ignored if .B \-k is not present too. .TP -\fB\-n \fISPACE\fR, \fB\-\-namespace\fR \fISPACE\fR +.BI \-n " SPACE\fR, " "\-\-namespace " SPACE Select a different name space. The name spaces .B file (file names, the default), @@ -163,10 +165,13 @@ .B tcp (local TCP ports) are supported. For ports, either the port number or the symbolic name can be specified. If there is no ambiguity, the -shortcut notation \fIname\fB/\fIspace\fR (e.g. \fI80\fB/\fItcp\fR) +shortcut notation +.IB name / space +(e.g., +.IB 80 / tcp \fR) can be used. .TP -\fB\-s\fR, \fB\-\-silent\fR +.BR \-s ", " \-\-silent Silent operation. .B \-u and @@ -176,20 +181,20 @@ must not be used with .BR \-s . .TP -\fB\-\fISIGNAL\fR +.BI \- SIGNAL Use the specified signal instead of SIGKILL when killing processes. -Signals can be specified either by name (e.g. -.BR \-HUP ) or by -number (e.g. +Signals can be specified either by name (e.g., +.BR \-HUP ) +or by number (e.g., .BR \-1 ). This option is silently ignored if the .B \-k option is not used. .TP -\fB\-u\fR, \fB\-\-user\fR +.BR \-u ", " \-\-user Append the user name of the process owner to each PID. .TP -\fB\-v\fR, \fB\-\-verbose\fR +.BR \-v ", " \-\-verbose Verbose mode. Processes are shown in a .BR ps -like @@ -201,15 +206,15 @@ .B kernel is shown instead of the PID. .TP -\fB\-V\fR, \fB\-\-version\fR +.BR \-V ", " \-\-version Display version information. .TP -\fB\-4\fR, \fB\-\-ipv4\fR +.BR \-4 ", " \-\-ipv4 Search only for IPv4 sockets. This option must not be used with the .B \-6 option and only has an effect with the tcp and udp namespaces. .TP -\fB\-6\fR, \fB\-\-ipv6\fR +.BR \-6 ", " \-\-ipv6 Search only for IPv6 sockets. This option must not be used with the .B \-4 option and only has an effect with the tcp and udp namespaces. @@ -224,7 +229,7 @@ .B fuser \-km /home kills all processes accessing the file system /home in any way. .TP -\fBif fuser \-s /dev/ttyS1; then :; else \fIsomething\fB; fi\fR +.BI "if fuser \-s /dev/ttyS1; then :; else " something "; fi" invokes .I something if no other process is using /dev/ttyS1. diff -Naur psmisc-23.2-old/src/killall.c psmisc-23.2-new/src/killall.c --- psmisc-23.2-old/src/killall.c 2018-08-13 13:24:42.767618335 +0200 +++ psmisc-23.2-new/src/killall.c 2018-09-18 13:09:23.948951682 +0200 @@ -350,8 +350,8 @@ lencomm = endcomm - startcomm; if (lencomm < 0) lencomm = 0; - if (lencomm > sizeof comm -1) - lencomm = sizeof comm -1; + if (lencomm > COMM_LEN -1) + lencomm = COMM_LEN -1; strncpy(comm, startcomm, lencomm); comm[lencomm] = '\0'; @@ -857,9 +857,9 @@ opterr = 0; #ifdef WITH_SELINUX - while ( (optc = getopt_long(argc,argv,"egy:o:ilqrs:u:vwZ:VIn:",options,NULL)) != -1) { + while ( (optc = getopt_long_only(argc,argv,"egy:o:ilqrs:u:vwZ:VIn:",options,NULL)) != -1) { #else - while ( (optc = getopt_long(argc,argv,"egy:o:ilqrs:u:vwVIn:",options,NULL)) != -1) { + while ( (optc = getopt_long_only(argc,argv,"egy:o:ilqrs:u:vwVIn:",options,NULL)) != -1) { #endif switch (optc) { case 'e': @@ -914,7 +914,7 @@ ignore_case = 1; } else { sig_num = get_signal (argv[optind]+1, "killall"); - skip_error=1; + skip_error=optind; } break; case 'V': @@ -922,13 +922,20 @@ if (strcmp(argv[optind-1],"-V") == 0 || strncmp(argv[optind-1],"--",2) == 0) { print_version(); return 0; + } else { + sig_num = get_signal (argv[optind]+1, "killall"); + skip_error=optind; } - sig_num = get_signal (argv[optind]+1, "killall"); break; - case 'n': - opt_ns_pid = atoi(optarg); - if (opt_ns_pid == 0) + case 'n': { + long num; + char *end = NULL; + errno = 0; + num = strtol(optarg, &end, 10); + if (errno != 0 || optarg == end || end == NULL) usage(_("Invalid namespace PID")); + opt_ns_pid = (pid_t) num; + } break; #ifdef WITH_SELINUX case 'Z': @@ -943,6 +950,15 @@ break; #endif /*WITH_SELINUX*/ case '?': + if (skip_error == optind) + break; + /* Sigh, this is a hack because -ve could be -version or + * -verbose */ + if (strncmp(argv[optind-1], "-ve", 3) == 0) { + verbose=1; + exact=1; + break; + } /* Signal names are in uppercase, so check to see if the argv * is upper case */ if (argv[optind-1][1] >= 'A' && argv[optind-1][1] <= 'Z') { @@ -952,9 +968,6 @@ if (argv[optind-1][1] >= '0' && argv[optind-1][1] <= '9') { sig_num = atoi(argv[optind-1]+1); } else { - if (skip_error) - skip_error=0; - else usage(NULL); } }