[petsc-dev] non portable code in next, why? realpath and system
Jed Brown
jedbrown at mcs.anl.gov
Sun Sep 8 17:41:35 CDT 2013
Barry Smith <bsmith at mcs.anl.gov> writes:
> 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
Huh, I thought it was POSIX, but it looks like that's only the libc
function. Will fix.
> 2) why is this using "system()" instead of PetscPOpen()?
No good reason.
> 3) next appears to be a vast waste land of broken code, WTF?
Is there other stuff? I find a new round of warnings every time I build
because a lot of people are using older
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20130908/db75e972/attachment.sig>
More information about the petsc-dev
mailing list