Bug 172692

Summary: Defines not getting expanded
Product: Red Hat Enterprise Linux 3 Reporter: Bastien Nocera <bnocera>
Component: autofsAssignee: Jeff Moyer <jmoyer>
Status: CLOSED NOTABUG QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: bakerg3, cfeist
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-01-09 22:15:10 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:
Attachments:
Description Flags
autofs-eval-options.patch none

Description Bastien Nocera 2005-11-08 14:46:06 UTC
autofs-4.1.3-158

When using defines in the auto.master, the variables that require shell
expansion aren't getting substituted.
For example, in auto.master:
/mnt/testnfs /etc/auto.testnfs -D OSREL=RHEL-4 -D OSUPDATE=U2 -D OSVER=AS -D
OSARCH=`uname -i`

And in auto.testnfs:
current -ro,hard,intr,wsize=8192,rsize=8192
testnfs.devel.redhat.com:/vol/devarchive/redhat/released/$OSREL/$OSUPDATE/$OS
VER/$OSARCH/tree

You will get errors such as:

Nov  7 09:03:22 localhost automount[4017]: >> mount:
testnfs.devel.redhat.com:/vol/devarchive/redhat/released/RHEL-4/U2/AS/`uname/
tree failed, reason given by server: Permission denied

The patch below evaluates the additional options so that shell commands can be
expanded as necessary

Comment 1 Bastien Nocera 2005-11-08 14:46:07 UTC
Created attachment 120813 [details]
autofs-eval-options.patch

Comment 2 Jeff Moyer 2005-11-08 18:31:14 UTC
Shell expansion is not supported in autofs configuration files.  If you want
shell expansion, try using a program map.

Comment 4 Jeff Moyer 2005-11-10 18:54:49 UTC
This functionality is neither documented nor supported.  I understand the
"preserve functionality, bug for bug," mentality, but the ability to do this is
going away in the next release of our operating system, anyway.

The following variables are defined by default:

ARCH	The application architecture is derived from the output of uname -m
CPU	The output of uname -p

Why can't the customer use one of these?

Comment 5 Chris Kloiber 2005-11-10 19:20:43 UTC
Customer's original auto.* files are attached to the IT#, but basically they
have different versions of their custom application for particular arch and base
kernel version, so they are doing a claculation like:

-D OSREL=`uname -r | sed s/-[0-9.]*/-/

Which will return '2.4.21' on any RHEL-3 kernel. So basically they need more
flexibility than just ARCH and CPU.

Comment 6 Jeff Moyer 2005-11-10 19:46:35 UTC
Why was this changed to MODIFIED?  I'm moving it back to ASSIGNED, with a note
that I'm still not convinced that this is something which should be "fixed."

Comment 7 Chris Kloiber 2005-11-10 19:51:30 UTC
My supervisor told me to change the status off of NEEDINFO_REPORTER, and there
was no better status I could see as I don't feel I have the right to set it as
ASSIGNED.

Comment 9 Greg Baker 2005-11-28 17:32:04 UTC
Jeff,

Just wanted a clarification on Comment #2

"Shell expansion is not supported in autofs configuration files.  If you want
shell expansion, try using a program map."

Is the shell expansion example below supported?

$ uname -a
Linux minuet 2.4.21-37.EL #1 Wed Sep 7 13:49:00 EDT 2005 x86_64 unknown unknown
GNU/Linux

$ rpm -qa | grep autofs
autofs-4.1.3-130

$ cat /etc/sysconfig/autofs 
LOCALOPTIONS='tcp -D OS=k24_g23_64'

$ ypcat -k auto.tool | grep OS
pandora -ro,intr  escher:/vol/vol2/pandora/pandora-${OS} 

We've been doing this (set OS variable in autofs startup + using OS variable
expansion in auto.* NIS maps) for years...

$ man 5 autofs

   Variable Substitution
       Additional entries can be defined with the -Dvariable=Value  map-option
       to automount(8).

$ man 8 automount

       options
              -Dvariable=value
                     Replace variable with value in map substitutions.

Thanks,

--Greg

Comment 10 Jeff Moyer 2005-11-28 17:42:53 UTC
There is a table of supported variable substitutions in the automount man page
for Solaris:

  http://docs.sun.com/app/docs/doc/816-5166/6mbb1kpu5?a=view#automount-1m-indx-2

Those expansions are, of course, supported.  You can also use -D to define a
custom map variable, as you note above.  You cannot, however, use shell
expressions in this expression.

-D foo=bar

is supported

-D foo=`uname -r`

is not.

-Jeff

Comment 11 Jeff Moyer 2006-01-09 22:15:10 UTC
an automounter map is a configuration file.  It simply does not support shell
expansion.  Yes, it happened to work in previous versions, but it will not
continue to work in the future.

Have the customer try to use program maps to generate custom variables.