Boost logo

Boost-Build :

From: Mark Evans (evans_mark_at_[hidden])
Date: 2006-01-31 22:57:56


I downloaded yesterday the code below that fails on cygwin. The first #ifndef is at line 675 (which does not line up with what you said was at line 688). The true path of the first #ifdef OS_CYGWIN makes an unreasonable assumption about the value of the user's PATH variable. My path variable starts with "/usr/bin:" as set by me in my .bashrc file. It could have started with ".:/usr/bin:". I don't understand the author's expectation here.
  
  ----------------------------------------
  #ifndef NDEBUG
  void var_expand_unit_test()
  {
      LOL lol[1];
      LIST* l, *l2;
      LIST *expected = list_new( list_new( L0, newstr( "axb" ) ), newstr( "ayb" ) );
      LIST *e2;
      char axyb[] = "a$(xy)b";
      char azb[] = "a$($(z))b";
      char path[] = "$(p:W)";
      
      # ifdef OS_CYGWIN
      char cygpath[256];
      {
          const char * P = getenv("PATH");
          const char * slash = 0;
          slash = strchr(P+1,'/');
          assert(slash != 0);
          strncpy(cygpath,P,slash-P+1);
          cygpath[slash-P+1] = '\0';
          assert(strlen(cygpath) < 246);
          strcat(cygpath,"c/foo/bar");
      }
      # else
      char cygpath[] = "/cygdrive/c/foo/bar";
      # endif
          
      lol_init(lol);
      var_set("xy", list_new( list_new( L0, newstr( "x" ) ), newstr( "y" ) ), VAR_SET );
      var_set("z", list_new( L0, newstr( "xy" ) ), VAR_SET );
      var_set("p", list_new( L0, newstr( cygpath ) ), VAR_SET );
  
      l = var_expand( 0, axyb, axyb + sizeof(axyb) - 1, lol, 0 );
      for ( l2 = l, e2 = expected; l2 && e2; l2 = list_next(l2), e2 = list_next(e2) )
          assert( !strcmp( e2->string, l2->string ) );
      assert(l2 == 0 && e2 == 0);
      list_free(l);
      
      l = var_expand( 0, azb, azb + sizeof(azb) - 1, lol, 0 );
      for ( l2 = l, e2 = expected; l2 && e2; l2 = list_next(l2), e2 = list_next(e2) )
          assert( !strcmp( e2->string, l2->string ) );
      assert(l2 == 0 && e2 == 0);
      list_free(l);
  
      l = var_expand( 0, path, path + sizeof(path) - 1, lol, 0 );
      assert(l != 0);
      assert(list_next(l) == 0);
      # ifdef OS_CYGWIN
      assert( !strcmp( l->string, "c:\\foo\\bar" ) );
      # else
      assert( !strcmp( l->string, cygpath ) );
      # endif
      list_free(l);
  
      list_free(expected);
      
      lol_free(lol);
  }
  #endif
  ----------------------------------

  OS_CYGWIN is defined in jam.h -
  
John Maddock <john_at_[hidden]> wrote: >> The value of the string l->string at the point of failure, at:
>>
>> assertion "!strcmp( l->string, "c:\\foo\\bar" )" failed: file
>> "expand.c", line 723
>>
>> is "C:\\cygwin\\usr\\c\\foo\\bar". Back to the drawing board. :-)

I don't understand that, it's certainly building OK for me at present.

Can you check that:

In expand.c line 688:

after the call to cygwin_conv_to_posix_path the variable "cygpath" should
contain "/cygdrive/c/foo/bar"

and then in expand.c line 665:

the variable out->value should be "/cygdrive/c/foo/bar", and after the call
to cygwin_conv_to_win32_path "result" should contain "c:\\foo\\bar".

John.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build



Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk