function hello2()
  current_path = pwd();
  dir  = fileparts( mfilename('fullpath') );
  cd(dir);
  % here was a call to mkoctfile but this is not related to the bug
  disp(["This is hello2 in ", pwd()]);
  cd(current_path);
end
% when the final cd(current_path) is put here, i.e. outside of hello2(),
% then it works with octave 4.0.0