Bug 102337

Summary: ifup-ppp mishandles full pathname of CONFIG file
Product: [Retired] Red Hat Linux Reporter: John Reiser <jreiser>
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED WONTFIX QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 9CC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-09-30 19:21:34 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:

Description John Reiser 2003-08-13 23:03:00 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225

Description of problem:
Trying to invoke ifup-ppp with the full pathname of the CONFIG file usually
fails because of a logic error in /etc/sysconfig/network-scripts/ifup-ppp.
-----line 13
  # just in case a full path to the configuration file is passed in
  CONFIG=$(basename $1)
  [ -f "${CONFIG}" ] || CONFIG=ifcfg-${1}
  source_config
-----
The full pathname is removed by 'basename' on line 14, which forces the
'source_config' on line 16 to fail unless the working directory matches.  (Also
"ifcfg-${1}" makes no sense if $1 is a full pathname.)
This makes it nearly impossible to specify the full pathname of a CONFIG file.

Instead, the logic should be something like
-----
  # just in case a full path to the configuration file is passed in
  CONFIG="$1"
  [ -f "${CONFIG}" ] || CONFIG=ifcfg-$(basename "${CONFIG}")
  source_config
-----
which tests the full pathname first before applying basename if needed.


Version-Release number of selected component (if applicable):
initscripts-7.14-1

How reproducible:
Always

Steps to Reproduce:
1. sh -x /etc/sysconfig/network-scripts/ifup-ppp  _full_path_to_CONFIG_file
2.
3.
    

Actual Results:  + '[' /etc/sysconfig/networking/profiles/default/ifcfg-Olympus
= daemon ']'
++ basename /etc/sysconfig/networking/profiles/default/ifcfg-Olympus
+ CONFIG=ifcfg-Olympus
+ '[' -f ifcfg-Olympus ']'
+ CONFIG=ifcfg-/etc/sysconfig/networking/profiles/default/ifcfg-Olympus
+ source_config
++ basename ifcfg-/etc/sysconfig/networking/profiles/default/ifcfg-Olympus
++ sed 's/^ifcfg-//g'
+ DEVNAME=Olympus
+ basename ifcfg-/etc/sysconfig/networking/profiles/default/ifcfg-Olympus
+ grep -q '[^g]-'
+ . ifcfg-/etc/sysconfig/networking/profiles/default/ifcfg-Olympus
/etc/sysconfig/network-scripts/ifup-ppp: line 35:
ifcfg-/etc/sysconfig/networking/profiles/default/ifcfg-Olympus: No such file or
directory


Expected Results:  Use the full pathname for CONFIG.

Additional info:

Comment 1 Bill Nottingham 2003-09-15 05:35:00 UTC
AFAIK, it's never actually defined or stated anywhere that using files outside
of /etc/sysconfig/network-scripts directly should work.

Comment 2 Bill Nottingham 2005-09-30 19:21:34 UTC
Closing bugs on older, no longer supported, releases. Apologies for any lack of
response.

ifup, in its usage, does specify to pass a device name, not a file name. As
such, closing.