Revert "Make clean-tutorial.sh executable from any directory"#757
Revert "Make clean-tutorial.sh executable from any directory"#757
Conversation
This reverts commit 0c91000.
|
Hii @MakisH i went into why cleaning could go wrong after #716, and i think i see a concrete shell issue on top of whatever OpenFOAM What I think went wrong I’m not 100% sure that’s the only story behind What i did instead
What I checked locally
i am happy to open a PR with this (either alongside or after #757) — whatever fits your release plan best. If my read of the failure mode is off, i am totally open to adjusting after a repro you prefer. (whenever contributions again starts). |
|
hi @MakisH @PranjalManhgaye I have gone through the issue thought i might be able to help ,i saw the cleaning code paths and found that ESI OpenFOAM's cleanAuxiliary() does rm -rf ./*.xml this would delete precice-config.xml if cleanCase ever runs at the tutorial root level. The Foundation version doesn't have this line i think it's specific to the ESI/OpenCFD version. Normally cleanCase runs inside case subdirectories where there are no .xml files, so it's safe. Something after #716 must be causing it to run at the tutorial root instead, though I wasn't able to reproduce it. For the fix, I thought of two things :
#!/usr/bin/env sh
set -e -u
cd "$(dirname "$0")"
. ../tools/clean-tutorial-base.sh
clean_openfoam() {
(
set -e -u
cd "$1"
+ if [ -f "precice-config.xml" ]; then
+ echo "Error: clean_openfoam called at tutorial root level, skipping" >&2
+ exit 1
+ fi
echo "- Cleaning up OpenFOAM case in $(pwd)"
if [ -n "${WM_PROJECT:-}" ] || error "No OpenFOAM environment is active."; thenwhat do you guys think ? |
|
thanks @AdityaGupta716, yeah ig your point about esi/opencfd cleanCase deleting *.xml is valid, and that guard in clean_openfoam is a really good safety net. i had been thinking about the same issue from the path-resolution side, and ig both views fit together. |
|
@PranjalManhgaye Yea, lets wait for now and let @MakisH decide ,if he think its good, u can go ahead and open a pr. |
Reverts #716
Since #716, running
./clean-tutorial.shseems to be triggering the OpenFOAMcleanCase, which deletes*.xml, deleting theprecice-config.xml.Not sure if there is an easy fix, but I am opening this as a reminder for the next release.