Bug 243615

Summary: tmpwatch doesn't honor --fuser
Product: Red Hat Enterprise Linux 5 Reporter: Jack Neely <jjneely>
Component: psmiscAssignee: Tomas Smetana <tsmetana>
Status: CLOSED ERRATA QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: 5.0   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2007-1009 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-11-21 12:02:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jack Neely 2007-06-10 19:36:39 UTC
Description of problem:
tmpwatch does not honor the --fuser or -s arguments.  Therefore, when used to
clean /tmp it deletes things like the GDM socket, X sockets, the font server
sockets, etc.

Version-Release number of selected component (if applicable):
tmpwatch-2.9.7-1.1.el5.1
  
Actual results:
From a RHEL 5 Server box:

[root@xen00 tmp]# ls -la /tmp
total 36
drwxrwxrwt  6 root root 4096 Jun 10 14:24 .
drwxr-xr-x 26 root root 4096 Jun 10 14:24 ..
drwxrwxrwt  2 root root 4096 Jun 10 14:24 .font-unix
srw-rw-rw-  1 root root    0 Jun 10 14:24 .gdm_socket
drwxrwxrwt  2 root root 4096 Jun 10 14:24 .ICE-unix
drwxrwxrwx  2 root root 4096 Jun 10 14:24 .pk11ipc1
-r--r--r--  1 root root   11 Jun 10 14:24 .X0-lock
drwxrwxrwt  2 root root 4096 Jun 10 14:24 .X11-unix
[root@xen00 tmp]# date
Sun Jun 10 15:27:02 EDT 2007
[root@xen00 tmp]# /usr/sbin/tmpwatch -s -a -f --test -v 1 /tmp
grace period is 3600
cleaning up directory /tmp
cleaning up directory /tmp/.pk11ipc1
removing file /tmp/.X0-lock
cleaning up directory /tmp/.X11-unix
removing file /tmp/.X11-unix/X0
removing directory /tmp/.X11-unix
cleaning up directory /tmp/.font-unix
removing file /tmp/.font-unix/fs7100
removing file /tmp/.gdm_socket
cleaning up directory /tmp/.ICE-unix


Expected results:
From a RHEL 4 box (tmpwatch-2.9.1-1):

[root@tweety cron.hourly]# ls -la /tmp
total 48
drwxrwxrwt   5 root    root  4096 Jun 10 14:22 .
drwxr-xr-x  25 root    root  4096 May  2 13:00 ..
drwxrwxrwt   2 root    root  4096 May  2 13:00 .font-unix
srw-rw-rw-   1 root    root     0 May  2 13:00 .gdm_socket
-rw-------   1 jjneely ncsu   419 Jun 10 14:19 krb5cc_18536_JFHdUb
drwx------   2 root    root 16384 Feb  2 12:50 lost+found
srwxr-xr-x   1 root    root     0 Jun 10 14:22 .root-sock-test
-rw-------   1 jjneely ncsu   130 Jun 10 14:19 tkt18536_WFBIpa
drwxrwxrwt   2 root    root  4096 May  2 13:00 .X11-unix
[root@tweety cron.hourly]# date
Sun Jun 10 15:27:19 EDT 2007
[root@tweety cron.hourly]# /usr/sbin/tmpwatch -s -a -f --test -v 1 /tmp
grace period is 3600
cleaning up directory /tmp
removing file /tmp/.root-sock-test
removing file /tmp/tkt18536_WFBIpa
removing file /tmp/krb5cc_18536_JFHdUb
cleaning up directory /tmp/.X11-unix
file is already in use or open: /tmp/.X11-unix/X0
removing directory /tmp/.X11-unix
file is already in use or open: /tmp/.gdm_socket
cleaning up directory /tmp/.font-unix
file is already in use or open: /tmp/.font-unix/fs7100
removing directory /tmp/.font-unix

Comment 1 Jack Neely 2007-06-10 20:28:58 UTC
Arg...this is fuser's fault.  fuser is returning a non-zero error code when the
'-s' option is used with it.

From RHEL 5:
[root@xen00 tmpwatch-2.9.7]# fuser /tmp/.gdm_socket 
/tmp/.gdm_socket:     1919  2015
[root@xen00 tmpwatch-2.9.7]# echo $?
0
[root@xen00 tmpwatch-2.9.7]# fuser -s /tmp/.gdm_socket 
[root@xen00 tmpwatch-2.9.7]# echo $?
1
[root@xen00 tmpwatch-2.9.7]# rpm -qf /sbin/fuser
psmisc-22.2-5

RHEL 4:
[root@tweety cron.hourly]# fuser /tmp/.gdm_socket
/tmp/.gdm_socket:     4044
[root@tweety cron.hourly]# echo $?
0
[root@tweety cron.hourly]# fuser -s /tmp/.gdm_socket
[root@tweety cron.hourly]# echo $?
0
[root@tweety cron.hourly]# rpm -qf /sbin/fuser 
psmisc-21.4-4.1


Comment 2 Miloslav Trmač 2007-06-11 13:23:40 UTC
Probably http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=361639, fixed in
psmisc-22.3.

Comment 8 errata-xmlrpc 2007-11-21 12:02:19 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2007-1009.html