Menu

#4253 [DEV] the substitution bug in post.xcat

2.8.5
pending
yangsong
postscripts
5
2014-08-21
2014-08-21
yangsong
No

There is a bug in post.xcat while adding "run_ps" to the postscrpt names in mypostscript.
The code slice is:
"
TMP=sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript
TMP=sed "/postbootscripts-start-here/,/postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript
TMP=sed "/postscripts-start-here/,/postscripts-end-here/ d" /xcatpost/mypostscript
TMP=sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /xcatpost/mypostscript
"

for example, "/postscripts-start-here/" will match the "/postbootscripts-start-here/","# defaults-postscripts-start-here" and "# osimage-postscripts-start-here"...

Discussion

  • yangsong

    yangsong - 2014-08-21
    • status: open --> pending
     
  • yangsong

    yangsong - 2014-08-21

    fixed in 2.8.5:
    commit daace5a88140347e9bd7395061c4ab011c8b4690
    Author: immarvin yangsbj@cn.ibm.com
    Date: Thu Aug 21 00:07:58 2014 -0700

    fix defect #4253 [DEV] the substitution bug in post.xcat
    

    diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat
    index 10d4069..44fdf29 100755
    --- a/xCAT-server/share/xcat/install/scripts/post.xcat
    +++ b/xCAT-server/share/xcat/install/scripts/post.xcat
    @@ -94,7 +94,7 @@ cd /xcatpost
    export PATH=$PATH:/xcatpost

    # use the run_ps subroutine to run the postscripts
    -TMP=sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript
    +TMP=sed "/^#\s*postscripts-start-here/,/^#\s*postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript
    echo "
    # global value to store the running status of the postbootscripts,the value is non-zero if one postbootscript failed
    return_value=0
    @@ -125,12 +125,12 @@ run_ps () {

    " > /xcatpost/mypostscript
    echo "$TMP" >> /xcatpost/mypostscript
    -TMP=sed "/postbootscripts-start-here/,/postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript
    +TMP=sed "/^#\s*postbootscripts-start-here/,/^#\s*postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript
    echo "$TMP" > /xcatpost/mypostscript

    #save the postboot scripts to /xcatpost/mypostscript.post
    -TMP=sed "/postscripts-start-here/,/postscripts-end-here/ d" /xcatpost/mypostscript
    +TMP=sed "/^#\s*postscripts-start-here/,/^#\s*postscripts-end-here/ d" /xcatpost/mypostscript
    echo "$TMP" > /xcatpost/mypostscript.post
    chmod 755 /xcatpost/mypostscript.post

    @@ -173,7 +173,7 @@ EOF
    chmod 755 /opt/xcat/xcatdsklspost

    #only run the prebooot scripts here
    -TMP=sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /xcatpost/mypostscript
    +TMP=sed "/^#\s*postbootscripts-start-here/,/^#\s*postbootscripts-end-here/ d" /xcatpost/mypostscript
    echo "$TMP" > /xcatpost/mypostscript

    export NODE=#TABLE:nodelist:THISNODE:node#

    fixed in 2.9:
    commit 79ad455b31d196c3d308ac8d76331a84bafa8188
    Author: immarvin yangsbj@cn.ibm.com
    Date: Thu Aug 21 00:07:58 2014 -0700

    fix defect #4253 [DEV] the substitution bug in post.xcat
    
     
MongoDB Logo MongoDB