Bug 146754 - Logical error in if-statements in /etc/init.d/autofs. Options ignored.
Summary: Logical error in if-statements in /etc/init.d/autofs. Options ignored.
Keywords:
Status: CLOSED DUPLICATE of bug 143206
Alias: None
Product: Fedora
Classification: Fedora
Component: autofs
Version: 3
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jeff Moyer
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-02-01 10:53 UTC by Tord Kolsrud
Modified: 2007-11-30 22:10 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2005-03-01 22:53:03 UTC
Type: ---
Embargoed:


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

Description Tord Kolsrud 2005-02-01 10:53:50 UTC
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 14:08:28 UTC
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 14:09:17 UTC
Let me know if this addresses your issues.

Comment 3 Tord Kolsrud 2005-02-01 16:36:21 UTC
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 16:44:54 UTC
Yes, this will make it into FC 3 this week.

Comment 5 Jeff Moyer 2005-03-01 22:53:03 UTC

*** 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.