Skip to content

BayesWave segfaults when given --inj with relative path and --outputDir that isn't PWD

When you call BayesWave with arguments like --inj ./myfile.xml --outputDir output/ (as is currently done by lalinference_pipe), the code will end in segmentation fault because it chdir's to the outputDir before reading the inj file [ref]:

  // Move to the directory specified by the user, or stay in ./
  chdir(data->outputDirectory);
  fprintf(stdout,"\nOutputting all data to: %s \n\n", data->outputDirectory);

<!-- snip -->

  // CBC injection
  if(LALInferenceGetProcParamVal(runState->commandLine, "--inj"))
  {
    fprintf(stdout, " ==== LALInferenceInjectInspiralSignal(): started. ====\n");
    LALInferenceInjectInspiralSignal(runState->data,runState->commandLine);
    fprintf(stdout, " ==== LALInferenceInjectInspiralSignal(): finished. ====\n\n");
  }

cc @john-veitch, @vivien (for lalinference visibility)

Edited by Duncan Macleod