5 Replies Latest reply on May 4, 2012 8:02 AM by Sean Daley

    strange behaviour of NSH

      we're testing the upgrade from 8.0.7 to and we found a script that was working before, but now it give erroneous results
      see this commands executed in an NSH window version


      [/cygdrive/c/Documents and Settings/CO00117]% version
      BladeLogic Network Shell (Release) [Oct 14 2010 22:43:55]
      Copyright (C) 1996-2009 BladeLogic Inc.
      [/cygdrive/c/Documents and Settings/CO00117]% PROPS="a = b"
      [/cygdrive/c/Documents and Settings/CO00117]% noglob echo $PROPS | strings -n 1 | sed "s/ = /=/g"


      now the same commands in NSH version


      BL02WP1C% version
      BladeLogic Network Shell (Release) [Jan 12 2012 19:17:19]
      Copyright (C) 1996-2012 BladeLogic Inc.
      BL02WP1C% PROPS="a = b"
      BL02WP1C% noglob echo $PROPS | strings -n 1 | sed "s/ = /=/g"


      as you can see the last command returns an empty string instead of "a=b" as in the previous NSH version and every other UNIX implementation.

        • 1. strange behaviour of NSH

          It looks like the strings command is probably crashing.  Here's what I see:


          machine% PROPS="a = b"

          machine% noglob echo $PROPS | strings -n 1

          a = b

          machine% echo $?



          Notice 'strings -n 1' is returning an exit code of 11 which is typically a crash.


          The strings command was updated between 8.0 and 8.2 so I'd recommend opening a support ticket on this.

          • 2. strange behaviour of NSH

            i've already opened a ticket, i was just curious if someone already stumbled on it.

            i'm planning a migration to 8.2 on an environment that uses lots of scripting, so i don't really know what to expect.


            my behaviour is a little different than your:


            BL02WP1C% PROPS="a = b"

            BL02WP1C% noglob echo $PROPS | strings -n 1

            a = b

            BL02WP1C% echo $?



            notice that the return code is different and anyway "strings" does its work by printing "a = b"


            even more strange is this permutation of the original command


            BL02WP1C% noglob echo $PROPS | sed "s/ = /=/g" | strings -n 1


            BL02WP1C% echo $?



            where everything works (just the command sequence is not what i really need).

            it seems that "strings" does not crash at all.

            • 3. strange behaviour of NSH

              Strings is still crashing.  The difference between yours and mine though is that it crashes with exit code 11 on Linux and crashes with exit code 6 on Windows.  I just tried in a windows environment and got the same results as you.  Strings can only return an exit code of either 0 or 1 so getting any other value means that it crashed.


              Your getting some output though because strings did do a little bit of processing before crashing.  The output never really goes anywhere though because it's not standard output.  Try the following:


              noglob echo $PROPS | strings -n 1 > out1 2>out2


              If you check out both files though you'll see that they're empty.  This is why no output is getting passed on to the sed command.


              In your test of "noglob echo $PROPS | sed "s/ = /=/g" | strings -n 1".  This just appears to work because the

              echo output successfully goes to sed which successfully processes it which then passes it on to strings. 

              Strings then crashes.  If you were to add one more | like:

              noglob echo $PROPS | sed "s/ = /=/g" | strings -n 1 | cat


              You'd see that you're still getting no output.

              1 of 1 people found this helpful
              • 4. strange behaviour of NSH
                Antonio Caputo

                It seems to be a problem on 8.2 (and 8.1 as well). Look at this test:


                1. I copied a strings.exe binary coming from BL 8.0 SP7 into a BL 8.2 <BLADELOGIC>\NSH\bin folder

                2. Executed the command in a 8.2 NSH prompt:



                you can see it worked fine, so can we assume that something is changed in the Cygwin used in 8.2?

                • 5. strange behaviour of NSH

                  The following enhancement was done in 8.1 service pack 2.



                  Internationalization support for NSH commands

                  The majority of NSH commands now support multibyte characters for

                  internationalization (I18N). This support enables you to input text in a variety of

                  languages within your NSH commands



                  The strings command was one of the commands updated as part of this enhancement.  And the crash most

                  likely comes fromthis updated strings command.  8.2 contains everything from 8.1 service pack 2 which is why it's

                  broken as well.