LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Some fixes for slackware 13.0 (https://www.linuxquestions.org/questions/slackware-14/some-fixes-for-slackware-13-0-a-802476/)

hello.freeman 04-16-2010 06:24 PM

Some fixes for slackware 13.0
 
======================================================================
Code:

FILE : /etc/profile

### problem: The value of "INPUTRC" always be '/etc/inputrc'.
#---------------------no fix-----------------------

if [ ! -r "$HOME/.inputrc" ]; then
  export INPUTRC=/etc/inputrc
fi
##-------------------no fix-----------------------##


I think the code should be changed as follow :
#-----------------------fixed----------------------

if [ ! -r "$HOME/.inputrc" ]; then
  export INPUTRC=/etc/inputrc
else
  export INPUTRC="$HOME/.inputrc"
fi
##----------------------fixed--------------------##

========================================================================

Code:

FILE : /etc/rc.d/rc.inet1

### problem: It should detect the same ip address on the lan before setting ip address for interface.
#---------------------no fix-----------------------
          # Set up the network card:
          echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig ${1} ${IPADDR[$i]} broadcast ${BROADCAST[$i]} netmask ${NETMASK[$i]}" | $LOGGER
          /sbin/ifconfig ${1} ${IPADDR[$i]} broadcast ${BROADCAST[$i]} netmask ${NETMASK[$i]}
        else
          if [ "$DEBUG_ETH_UP" = "yes" ]; then
            echo "/etc/rc.d/rc.inet1:  ${1} interface is not configured in /etc/rc.d/rc.inet1.conf" | $LOGGER
          fi
        fi
##-------------------no fix-----------------------##



I think the code should be changed as follow :
#-----------------------fixed----------------------
          # Set up the network card:
          /sbin/ip addr flush dev ${1}
          /sbin/ifconfig ${1} up
          /sbin/arping -D -w 2 -c 2 -I ${1} ${IPADDR[$i]} 1> /dev/null
          if [ $? -eq 0 ] ; then        # No ARP REPLY packets are received
                  echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig ${1} ${IPADDR[$i]} broadcast ${BROADCAST[$i]} netmask ${NETMASK[$i]}" | $LOGGER
                  /sbin/ifconfig ${1} ${IPADDR[$i]} broadcast ${BROADCAST[$i]} netmask ${NETMASK[$i]}
          else
                  if [ "$DEBUG_ETH_UP" = "yes" ]; then
                          echo "/etc/rc.d/rc.inet1:  The IP ${IPADDR[$i]} on ${1} interface has already used by other hosts" | $LOGGER
                  fi
          fi
        else
          if [ "$DEBUG_ETH_UP" = "yes" ]; then
            echo "/etc/rc.d/rc.inet1:  ${1} interface is not configured in /etc/rc.d/rc.inet1.conf" | $LOGGER
          fi
        fi
##----------------------fixed--------------------##


========================================================================

Alien Bob 04-16-2010 06:38 PM

Quote:

Originally Posted by hello.freeman (Post 3938059)
======================================================================
Code:

FILE : /etc/profile

### problem: The value of "INPUTRC" always be '/etc/inputrc'.
#---------------------no fix-----------------------

if [ ! -r "$HOME/.inputrc" ]; then
  export INPUTRC=/etc/inputrc
fi
##-------------------no fix-----------------------##


I think the code should be changed as follow :
#-----------------------fixed----------------------

if [ ! -r "$HOME/.inputrc" ]; then
  export INPUTRC=/etc/inputrc
else
  export INPUTRC="$HOME/.inputrc"
fi
##----------------------fixed--------------------##


Copied from the manpage:

Code:

Readline  is customized by putting commands in an initialization
file (the inputrc file).  The name of this file is taken  from the
value of the INPUTRC environment variable. If that variable is  unset,
the  default  is  ~/.inputrc.

So, the code in /etc/profile is correct.

Quote:

Code:

FILE : /etc/rc.d/rc.inet1

### problem: It should detect the same ip address on the lan before setting ip address for interface.
#---------------------no fix-----------------------
          # Set up the network card:
          echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig ${1} ${IPADDR[$i]} broadcast ${BROADCAST[$i]} netmask ${NETMASK[$i]}" | $LOGGER
          /sbin/ifconfig ${1} ${IPADDR[$i]} broadcast ${BROADCAST[$i]} netmask ${NETMASK[$i]}
        else
          if [ "$DEBUG_ETH_UP" = "yes" ]; then
            echo "/etc/rc.d/rc.inet1:  ${1} interface is not configured in /etc/rc.d/rc.inet1.conf" | $LOGGER
          fi
        fi
##-------------------no fix-----------------------##



I think the code should be changed as follow :
#-----------------------fixed----------------------
          # Set up the network card:
          /sbin/ip addr flush dev ${1}
          /sbin/ifconfig ${1} up
          /sbin/arping -D -w 2 -c 2 -I ${1} ${IPADDR[$i]} 1> /dev/null
          if [ $? -eq 0 ] ; then        # No ARP REPLY packets are received
                  echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig ${1} ${IPADDR[$i]} broadcast ${BROADCAST[$i]} netmask ${NETMASK[$i]}" | $LOGGER
                  /sbin/ifconfig ${1} ${IPADDR[$i]} broadcast ${BROADCAST[$i]} netmask ${NETMASK[$i]}
          else
                  if [ "$DEBUG_ETH_UP" = "yes" ]; then
                          echo "/etc/rc.d/rc.inet1:  The IP ${IPADDR[$i]} on ${1} interface has already used by other hosts" | $LOGGER
                  fi
          fi
        else
          if [ "$DEBUG_ETH_UP" = "yes" ]; then
            echo "/etc/rc.d/rc.inet1:  ${1} interface is not configured in /etc/rc.d/rc.inet1.conf" | $LOGGER
          fi
        fi
##----------------------fixed--------------------##


Nice touch, but if you are using static IP addresses you either hand them out yourself, or a LAN administrator hands them out. In both cases, you will have to do your administration properly. The Slackware init script should not compensate for sloppy IP assignment policies.
If you use DHCP, the problem you describe does not even exist.

This should not keep you from using your patch! The fun of Slackware is that you can make these modifications (almost) without penalty.

Eric

hello.freeman 04-16-2010 07:11 PM

Quote:

Originally Posted by Alien Bob (Post 3938066)
Copied from the manpage:

Code:

Readline  is customized by putting commands in an initialization
file (the inputrc file).  The name of this file is taken  from the
value of the INPUTRC environment variable. If that variable is  unset,
the  default  is  ~/.inputrc.

So, the code in /etc/profile is correct.

Eric

I know that.
BUT in the slackware 13.0(bash version 3.1.17(2)-release),
If ~/.inputrc is readable, INPUTRC also is '/etc/inputrc', NOT '~/.inputrc'.

I think this should be bash's bug, isn't it ?

Alien Bob 04-16-2010 07:20 PM

Hm both man pages of bash in Slackware 13.0 (/bash-3.1.017) and Slackware-current (bash-4.1.002) state:
Code:

Readline is customized by putting commands in  an  initialization  file
(the  inputrc  file).  The name of this file is taken from the value of
the INPUTRC variable.  If  that  variable  is  unset,  the  default  is
~/.inputrc.

If you determined that the actual behaviour is different from what the man page tells me, then that would be a bash bug indeed.

How did you determine this?

Eric

hello.freeman 04-16-2010 07:41 PM

Quote:

Originally Posted by Alien Bob (Post 3938090)
Hm both man pages of bash in Slackware 13.0 (/bash-3.1.017) and Slackware-current (bash-4.1.002) state:
Code:

Readline is customized by putting commands in  an  initialization  file
(the  inputrc  file).  The name of this file is taken from the value of
the INPUTRC variable.  If  that  variable  is  unset,  the  default  is
~/.inputrc.

If you determined that the actual behaviour is different from what the man page tells me, then that would be a bash bug indeed.

How did you determine this?

Eric

I am very sorry. I forgot to login the account again.
I ran the TerminalEmulator again after I modified '/etc/profile'.
This is a very funny mistake.

hello.freeman 04-16-2010 07:42 PM

thanks very much for your help


All times are GMT -5. The time now is 06:09 AM.