Bug 882411

Summary: fuser prints PIDs with "%6d" causing large PIDs to be glued together
Product: [openSUSE] openSUSE 13.1 Reporter: Forgotten User EFDsKzgQWr <forgotten_EFDsKzgQWr>
Component: BasesystemAssignee: E-mail List <bnc-team-screening>
Status: VERIFIED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: forgotten_EFDsKzgQWr
Version: Final   
Target Milestone: ---   
Hardware: x86-64   
OS: openSUSE 13.1   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Forgotten User EFDsKzgQWr 2014-06-12 08:16:06 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0

If you have kernel.pid_max set to something larger than 99999 you will get PIDs
with 6 digits.

In this case fuser will produce output like:

90594
92545
95039
95459
95484
96321
97059
99381101264105909107266108324111597112058112778113808114386115892
11634011692811844711863511866212092712094912133912137712266412557
81264441273851276511277821279161280461285201319471323681323711327
34132898133141133641135616137231138589138637138638139038143840144
31914517114693214939414939515138815455915640215908116164316804316
89671691781745131749521753821763021832481833121860151897181975321
98419200172200691202418205571213815215965216406218121219993221441
22652222872922957722957823038123099923408023655524012424111324237
0245389245543

on its standard output. This is caused by the printf("%6d", pptr->pid) statement.

As a result of this constructs like:

  pids=$(fuser -m filesystem 2>/dev/null)
  for pid in $pids
  do
    kill -KILL $pid
  done

will fail.

E.g. such a construct is present in the High Availability product in:
/usr/lib/ocf/resource.d/heartbeat/Filesystem which will lead to the unability to unmount a file system.

BTW. "fuser -m -k -KILL filesystem" should work correctly.

Reproducible: Always

Steps to Reproduce:
1. As root set kernel.pid_max to something larger than 99999. E.g.
# sysctl -w kernel.pid_max=999999
2. run the fuser command:
$ fuser -m / 2>/dev/null
Actual Results:  
95484
96321
97059
99381101264105909107266

Expected Results:  
95484
96321
97059
99381
101264
105909
107266
Comment 1 Forgotten User EFDsKzgQWr 2014-06-12 09:29:32 UTC
I believe changing the printf("%6d", pptr->pid) statement into printf(" %5d", pptr->pid) will fix the problem.
Comment 2 Forgotten User EFDsKzgQWr 2014-06-12 09:41:20 UTC
Oops. This is already fixed in 13.1