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

calls to "system" prematurely ends chroot_setup.sh #14

Closed abmusse closed 9 years ago

abmusse commented 9 years ago

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


To recreate issue:

:system
DSPSYSVAL QSRLNBR
DSPSYSVAL QMODEL

Only the first command, DSPSYSVAL QSRLNBR, will run. I am wondering if it has something to do with system and it altering stdin/stdout? I've tried all manner of system options without success.

Side note: I am not even sure if system outside a script is working correctly. For example, I believe the -q option should silence all output but it still returns results.

$ system -q 'DSPSYSVAL QMODEL'
                                                   System Values                                                        Page     1
5770SS1 V7R2M0  140418                                                                            LITMIS1   07/31/15  23:23:24 UTC
                Current                         Shipped
 Name           value                           value                           Description
 QMODEL          E4A                            ' '                             System model number
     Note:  > means current value is different from the shipped value
                                         * * * * *   E N D  O F  L I S T I N G   * * * * *
abmusse commented 9 years ago

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


Fixed in this commit.

abmusse commented 9 years ago

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


Ok, i just pushed a fix (see below). Trick use a different file descriptor '3' to avoid collision with system. Hopefully this works, let me know.

#!shell

function chroot_setup {
  # copy needed PASE binaries
  action=""
  while read name <&3; do

... do stuff ...

  done 3<$1
}