reframe-hpc / reframe

A powerful Python framework for writing and running portable regression tests and benchmarks for HPC systems.
https://reframe-hpc.readthedocs.org
BSD 3-Clause "New" or "Revised" License
214 stars 101 forks source link

Calculation of version hash suffix can be confused if headless reframe is run from within an irrelevant Git repo #3120

Closed vkarak closed 3 months ago

vkarak commented 6 months ago

It's easy to reproduce:

  1. Install a dev ReFrame version with pip: pip3 install git+https://github.com/reframe-hpc/reframe.git@develop
  2. Go to a random locally cloned git repo and run reframe -V

You will see the hash of the local repo's HEAD being attached to reframe's version.

We should check that the reframe.INSTALL_PREFIX is indeed a Git repo before calling git rev-parse to get the hash:

https://github.com/reframe-hpc/reframe/blob/8395b49dc86c2a57a21ee6a3285950fde089c69b/reframe/utility/osext.py#L709-L714

vkarak commented 4 months ago

Strange, I can't reproduce it. Back to triage.

I was trying with a stable version; you need a development version.

vkarak commented 3 months ago

Although we do change to the installation prefix, the problem arises if this prefix is inside another (unrelated) Git working tree at any level deep as git rev-parse will still find the working tree.