Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 74809 - baselayout-1.11.8 macchanger failure
Summary: baselayout-1.11.8 macchanger failure
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 66472
  Show dependency tree
 
Reported: 2004-12-17 21:25 UTC by Duncan
Modified: 2005-01-31 00:00 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Duncan 2004-12-17 21:25:32 UTC
This one's different than the last one (73549, which is indeed
fixed).  This time, it's due to
removing the local scope limit
on $opts, in /lib/rcscripts/net.modules.d/macchanger, function macchanger-pre-start
(line 49 in baselayout-1.11.8, function
starts on 48) between 1.11.7-r2 and 1.11.8.

$opt inherits a
value of "start stop restart" from somewhere
up the call tree.  In 1.11.7-r2 and I suppose previous,
the
var was declared local, so the inherited value wasn't seen by
the function.  The case statement /appends/
to $opts the
options that should be applied to the /sbin/macchanger
command line.  Later in the function the
binary is called
as "/sbin/macchanger ${opts} ${iface}".  The problem is
that it doesn't understand
the "start stop restart"
prepended to the $opts as inherited from further up.

Three solutions
possible:

1) Simply reinstate $opts as a local var.
   (This is what I've done locally, for
now.)

2) Rename the var so there's no namespace conflict

3) Believed best choice.  Change the $opt
appends within the case
   to direct assignments instead of appends, AND set $opts as a
   local scope var. 
The macchanger script isn't set up for
   recursion anyway, so there's no reason to append, when direct
  
assignment should make clearer what's happening.  However, $opt
   might be reused in the global scope, and this
will change the
   value, so declaring it local will prevent possible issues if it
   is changed
globally.

Of course, good scripting practice (as with non-scripted
programming) might be to have
everything declared local,
that isn't passed.  Don't take the chance of screwing up
a global variable, and
don't use any variable not directly
passed and documented (or at minimum document it when you
DO use a global
variable).  Perhaps a namespace collision
avoidance variable naming policy would be helpful, as well.
However,
both of these are longer term general policy issues.

Reproducible: Always
Steps to Reproduce:
Configure and attempt to use the macchanger net module,
under baselayout-1.11.8.
Actual Results:  
Network wouldn't come up, due to failure to apply the 
configured macchanger policy. 

Expected Results:  
The network should have come up with a successfully 
changed MAC address on that interface.
Comment 1 Roy Marples (RETIRED) gentoo-dev 2004-12-18 05:21:09 UTC
Fixed in CVS - will be in baselayout-1.11.9

The macchanger module will work differently in baselayout-1.12.0, so I'm just localasing the var for now so we make the minimum changes to get 1.11 stable
Comment 2 Duncan 2005-01-12 11:22:30 UTC
Might be in baselayout-1.11.9, but didn't make it into 1.11.8-r1. =:^(

Lookin' forward to see what 1.12 brings, tho. =:^)
Comment 3 Roy Marples (RETIRED) gentoo-dev 2005-01-31 00:00:50 UTC
Fixed by baselayout-1.11.9