Make rint_location_in_file resilient to Cd (close 3630)

Cd can make the relative path of the opened file wrong,
and hence not available anymore when we reopen it to compute
the line number.