IBM / ibmichroot

A set of scripts to facilitate the use of chroot-based containers for IBM i
MIT License
21 stars 9 forks source link

Commands with colons #20

Closed abmusse closed 9 years ago

abmusse commented 9 years ago

Original report by Aaron Bartell (Bitbucket: aaronbartell, GitHub: aaronbartell).


Ran into an issue today where a 5250 command within the :system section of a xxxx.lst file had a colon (:) in it. The wildcard in the case statement caused the command to not be processed because it thought it was a "action".

Below is a snippet from chroot_setup.sh with the offending case pattern pointed out (*:*).

function chroot_setup {  
  # copy needed PASE binaries
  action=""
  while read -r name <&3; do
    case "$name" in
      "")
        # echo "empty"
      ;;
      *#*)
        # echo "comment"
      ;;
      *:*)   <----------------------
        # echo "action"
        action=$name
      ;;
      *)

I propose we only search for the colon in the first space of a line by changing to the following:

function chroot_setup {  
  # copy needed PASE binaries
  action=""
  while read -r name <&3; do
    case "$name" in
      "")
        # echo "empty"
      ;;
      *#*)
        # echo "comment"
      ;;
      :*)    <-------------------------------------
        # echo "action"
        action=$name
      ;;
      *)

I tested this on a complex chroot creation and it is working as expected.

Do you see any issues with making this change?

abmusse commented 9 years ago

Original comment by Aaron Bartell (Bitbucket: aaronbartell, GitHub: aaronbartell).


Fixed with this commit.

abmusse commented 9 years ago

Original comment by Tony Cairns (Bitbucket: rangercairns, GitHub: rangercairns).


No issue comes to mind, please push change.