Bug 146754 - Logical error in if-statements in /etc/init.d/autofs. Options ignored.
Logical error in if-statements in /etc/init.d/autofs. Options ignored.
Status: CLOSED DUPLICATE of bug 143206
Product: Fedora
Classification: Fedora
Component: autofs (Show other bugs)
3
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Moyer
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-02-01 05:53 EST by Tord Kolsrud
Modified: 2007-11-30 17:10 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-03-01 17:53:03 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch to explicitly set LC_ALL to C so grep statements will work. (305 bytes, patch)
2005-02-01 09:08 EST, Jeff Moyer
no flags Details | Diff

  None (edit)
Description Tord Kolsrud 2005-02-01 05:53:50 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5)
Gecko/20041111 Firefox/1.0

Description of problem:
I discovered that the option --ghost is being ignored by 
/etc/init.d/autofs on Fedora Core 3. 

When I examined what happend in /etc/init.d/autofs I found what I
guess is a logical error that probably affects the following options:
ghost, verbose and debug.

In /etc/init.d/autofs we find the following if-statement:

# Check for the ghost option
                if echo "$DAEMONOPTIONS $options" | grep -qE --
'\B-(g\b|-ghost\b)' ;
                then
                    startupoptions="$startupoptions --ghost"
                fi

This if-statement will on Fedore Core 3 not find the options -g or
--ghost, and therefore will never add the option --ghost to
$startupoptions, which causes the options to be ignored.

This bug can be reproduced by others by adding the --ghost option in
the file /etc/sysconfig/autofs, and check the automounting of nis-maps
with the command:
ps -ef | grep auto
You will notice that --ghost is not being used in the startup-command
for the automounters.

The bug itself is that the grep command can not find --ghost on Fedora
core 3 . As a proof run the following command:

[tord@itse6843]~% if echo "--ghost --timeout=60" | grep -qE --
'\B-(g\b|-ghost\b)' ;then echo "Found --ghost"; fi
[tord@itse6843]~%

A collegue of mine suggested to replace the grep-command with grep -w
-qE -- '(-g|--ghost)' ,which seems to work fine. 

[tord@itse6843]~% if echo "--ghost --timeout=60" |  grep -w -qE --
'(-g|--ghost)' ;then echo "Found --ghost"; fi
Found --ghost
[tord@itse6843]~%

The same grep-command is also used to test for the verbose and debug
options, and should probably be replaced too.

When I replaced the grep-command the --ghost option worked fine :) A
new package from Fedora with this change would greatly improve the
user friendlyness on my users many workstations. 


Version-Release number of selected component (if applicable):
autofs-4.1.3-28

How reproducible:
Always

Steps to Reproduce:
1. Set up a NIS-map which the workstations are supposed to automount
2. On a workstation, in the file /etc/sysconfig/autofs insert --ghost
into the variable DAEMONOPTIONS like this: DAEMONOPTIONS="--ghost
--timeout=60"
3. Reboot the workstation
4. Run the command: ps -ef | grep auto
    

Actual Results:  You will find that the automount process for the map
does not contain --ghost. You wil see something like: 
/usr/sbin/automount --timeout=60 /home yp auto.home

Expected Results:  The automount process should contain --ghost like
this: /usr/sbin/automount --timeout=60 --ghost /home yp auto.home

Additional info:

It seems like /etc/init.d/autofs is written to do different thing
depending on if the system it is running on is "Redhat-ish" og Debian.

Maybe the grep-command is ok on Debian, even though it does not work
on Fedora Core 3.
Comment 1 Jeff Moyer 2005-02-01 09:08:28 EST
Created attachment 110497 [details]
Patch to explicitly set LC_ALL to C so grep statements will work.

Try this patch.  It should fix your problem.
Comment 2 Jeff Moyer 2005-02-01 09:09:17 EST
Let me know if this addresses your issues.
Comment 3 Tord Kolsrud 2005-02-01 11:36:21 EST
Yes, it did. To add 
        local LC_ALL=C
        export LC_ALL
to the start of the getmounts function in /etc/init.d/autofs
did solve the problem. 

Thanks for the very fast and great support. I am impressed.

By the way, do you think there will soon come a new version of the rpm, so that
all my clients will get an automatick update by running yum, or should I just
start to patch the clients myself? 

I am will probably tomorrow send in a suggestion to the automount-mini-howto
about the ghost option, as I think the information would be usefull to others.
It would be nice if an updated FC3 had a fix.
Comment 4 Jeff Moyer 2005-02-01 11:44:54 EST
Yes, this will make it into FC 3 this week.
Comment 5 Jeff Moyer 2005-03-01 17:53:03 EST

*** This bug has been marked as a duplicate of 143206 ***

Note You need to log in before you can comment on or make changes to this bug.