Bug 623788

Summary: Init script fails for restart if daemon is running.
Product: [Fedora] Fedora Reporter: Orion Poplawski <orion>
Component: autofsAssignee: Ian Kent <ikent>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: high    
Version: 13CC: erik, ikent, jmoyer, michal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: autofs-5.0.5-28.fc13 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 624919 (view as bug list) Environment:
Last Closed: 2010-09-08 02:20:48 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:
Bug Depends On:    
Bug Blocks: 624919    

Description Orion Poplawski 2010-08-12 19:02:55 UTC
Description of problem:

The init script is broken for restarts.  I think this fixes:

diff -u -r1.1 autofs-5.0.5-make-redhat-init-script-more-lsb-compliant.patch
--- autofs-5.0.5-make-redhat-init-script-more-lsb-compliant.patch       24 May
2010 03:01:04 -0000       1.1
+++ autofs-5.0.5-make-redhat-init-script-more-lsb-compliant.patch       19 Jul
2010 17:47:14 -0000
@@ -61,7 +61,7 @@

  function restart() {
 -      stop
-+      status > /dev/null 2>&1
++      status -p /var/run/autofs.pid -l autofs $prog > /dev/null 2>&1
 +      if [ $? -eq 0 ]; then
 +              stop
 +      fi

Comment 1 Michal Jaegermann 2010-08-12 22:38:42 UTC
(In reply to comment #0)

> The init script is broken for restarts.  I think this fixes:

It appears that this should read:

   status -p /var/run/autofs.pid -l $prog

instead of 

   status -p /var/run/autofs.pid -l autofs $prog

but this indeed fixes the problem for me.  autofs-5.0.5-26.fc13 has surely broken startup script as 'status > /dev/null 2>&1' invariably ends as 1.

Comment 2 Orion Poplawski 2010-08-12 22:46:29 UTC
I think my original is correct. -p is pid file, -l is lock file name, and then you pass the program name.

Comment 3 Michal Jaegermann 2010-08-12 23:04:06 UTC
(In reply to comment #2)
> I think my original is correct. -p is pid file, -l is lock file name, and then
> you pass the program name.    

Yes, I think that you are right. OTOH it appears that just
'status -p /var/run/autofs.pid' is good enough and remaining arguments are not that essential.

Comment 4 Ian Kent 2010-08-18 05:01:58 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > I think my original is correct. -p is pid file, -l is lock file name, and then
> > you pass the program name.    
> 
> Yes, I think that you are right. OTOH it appears that just
> 'status -p /var/run/autofs.pid' is good enough and remaining arguments are not
> that essential.

It turns out that changing the status call to "status autofs"
will use the correct pid file.

Comment 5 Ian Kent 2010-08-18 05:02:33 UTC
*** Bug 624694 has been marked as a duplicate of this bug. ***

Comment 6 Fedora Update System 2010-08-18 05:06:03 UTC
autofs-5.0.5-27.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/autofs-5.0.5-27.fc13

Comment 7 Ian Kent 2010-08-18 05:08:41 UTC
(In reply to comment #6)
> autofs-5.0.5-27.fc13 has been submitted as an update for Fedora 13.
> http://admin.fedoraproject.org/updates/autofs-5.0.5-27.fc13

Can you all try this build please.

Comment 8 Michal Jaegermann 2010-08-18 05:26:17 UTC
(In reply to comment #7)
> 
> Can you all try this build please.

Yes, it does work in my tests.  OTOH I noticed only now that while running
'service autofs status' you are going full blast:

case "$1" in
...
        status)
                status -p /var/run/autofs.pid -l autofs $prog
                ;;
...

Does it matter that two ways in two places are used or this is by design?

Comment 9 Ian Kent 2010-08-18 06:34:39 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > 
> > Can you all try this build please.
> 
> Yes, it does work in my tests.  OTOH I noticed only now that while running
> 'service autofs status' you are going full blast:
> 
> case "$1" in
> ...
>         status)
>                 status -p /var/run/autofs.pid -l autofs $prog
>                 ;;
> ...
> 
> Does it matter that two ways in two places are used or this is by design?

From a sensibility point of view it probably does matter.

It turns out that "status autofs" is equivalent to
"status -p /var/run/autofs.pid" as long as the pid file is
located in /var/run.

So it would only be a problem if the location of the pid
file changed which isn't likely. At some point I'll need
to go over the entire init script and fix these little
inconsistencies, but for now I'd rather leave it as it is.

Comment 10 Ian Kent 2010-08-18 06:47:14 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > (In reply to comment #7)
> > > 
> > > Can you all try this build please.
> > 
> > Yes, it does work in my tests.  OTOH I noticed only now that while running
> > 'service autofs status' you are going full blast:
> > 
> > case "$1" in
> > ...
> >         status)
> >                 status -p /var/run/autofs.pid -l autofs $prog
> >                 ;;
> > ...
> > 
> > Does it matter that two ways in two places are used or this is by design?
> 
> From a sensibility point of view it probably does matter.
> 
> It turns out that "status autofs" is equivalent to
> "status -p /var/run/autofs.pid" as long as the pid file is
> located in /var/run.

Similarly the "autofs" parameter also covers the -l.

The reason that the -p and the -l was needed in the first
place was that $prog is not the same as the base name of
the pid and lock files, which is autofs rather than
automount.

Comment 11 Fedora Update System 2010-08-20 01:29:05 UTC
autofs-5.0.5-27.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update autofs'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/autofs-5.0.5-27.fc13

Comment 12 Fedora Update System 2010-08-27 03:30:31 UTC
autofs-5.0.5-28.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/autofs-5.0.5-28.fc13

Comment 13 Fedora Update System 2010-09-08 02:20:35 UTC
autofs-5.0.5-28.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.