Bug 102337 - ifup-ppp mishandles full pathname of CONFIG file
Summary: ifup-ppp mishandles full pathname of CONFIG file
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts
Version: 9
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-08-13 23:03 UTC by John Reiser
Modified: 2014-03-17 02:38 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-09-30 19:21:34 UTC
Embargoed:


Attachments (Terms of Use)

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.


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