[petsc-dev] non portable code in next, why? realpath and system
    Barry Smith 
    bsmith at mcs.anl.gov
       
    Sun Sep  8 17:24:35 CDT 2013
    
    
  
PetscFunctionBegin;
  /* dynamically allocate so valgrind and PETSc can check for overflow */
  ierr = PetscMalloc(len,&buf);CHKERRQ(ierr);
  ierr = PetscGetFullPath(path,buf,len);CHKERRQ(ierr);
  ierr = PetscSNPrintf(cmd,sizeof cmd,"test $(realpath %s | head -c %d) = %s",path,(int)len-1,buf);CHKERRQ(ierr);
  if (system(cmd)) {
    ierr = PetscPrintf(PETSC_COMM_SELF,"$(realpath %s | head -c %d) != %s\n",path,(int)len-1,buf);CHKERRQ(ierr);
  }
  if (used) {ierr = PetscStrlen(buf,used);CHKERRQ(ierr);}
  ierr = PetscFree(buf);CHKERRQ(ierr);
  PetscFunctionReturn(0);
1)  realpath doesn't exist on Apple make alltests gives ugly shit below
2) why is this using "system()" instead of PetscPOpen()? 
3) next appears to be a vast waste land of broken code, WTF?
******* Testing: testexamples_C *******
0a1,30
> sh: realpath: command not found
> sh: line 0: test: =: unary operator expected
> $(realpath ~/file-name | head -c 1023) != /Users/barrysmith/file-name
> sh: realpath: command not found
> sh: line 0: test: =: unary operator expected
> $(realpath ~/file-name | head -c 25) != /Users/barrysmith/file-na
> sh: realpath: command not found
> sh: line 0: test: =: unary operator expected
> $(realpath ~barrysmith/file-name | head -c 1023) != /Users/barrysmith/file-name
> sh: realpath: command not found
> sh: line 0: test: =: unary operator expected
> $(realpath ~barrysmith/file-name | head -c 25) != /Users/barrysmith/file-na
> sh: realpath: command not found
> sh: line 0: test: =: unary operator expected
> $(realpath /dev/null | head -c 1023) != /dev/null
> sh: realpath: command not found
> sh: line 0: test: =: unary operator expected
> $(realpath /dev/null | head -c 7) != /dev/nu
> sh: realpath: command not found
> sh: line 0: test: =: unary operator expected
> $(realpath ./this-dir | head -c 1023) != /Users/barrysmith/Src/petsc/src/sys/examples/tests/this-dir
> sh: realpath: command not found
> sh: line 0: test: =: unary operator expected
> $(realpath ./this-dir | head -c 57) != /Users/barrysmith/Src/petsc/src/sys/examples/tests/this-d
> sh: realpath: command not found
> sh: line 0: test: =: unary operator expected
> $(realpath also-this-dir | head -c 1023) != /Users/barrysmith/Src/petsc/src/sys/examples/tests/also-this-dir
> sh: realpath: command not found
> sh: line 0: test: =: unary operator expected
> $(realpath also-this-dir | head -c 62) != /Users/barrysmith/Src/petsc/src/sys/examples/tests/also-this-d
/Users/barrysmith/Src/petsc/src/sys/examples/tests
Possible problem with with ex13_1, diffs above 
    
    
More information about the petsc-dev
mailing list