Skip to content

rr tries to write to home dir even if _RR_TRACE_DIR is set #2302

Description

I tried running rr record in a setup where access to $HOME is read-only. I would expect that this works if I set _RR_TRACE_DIR to an writeable directory. But rr still tries to create a directory in $HOME.

Is this intended behavior?

Setting XDG_DATA_HOME instead of _RR_TRACE_DIR as a workaround works as expected.

Activity

  1. rocallahan commented on Jan 7, 2019

    @rocallahan
    Collaborator
    string trace_save_dir() {
      const char* output_dir = getenv("_RR_TRACE_DIR");
      return output_dir ? output_dir : default_rr_trace_dir();
    }
    

    doesn't look like we should create the default dir if it's not needed. Can you debug this?

  2. rocallahan commented on Jan 7, 2019

    @rocallahan
    Collaborator

    Oops

  3. rocallahan commented on Jan 7, 2019

    @rocallahan
    Collaborator

    That stack trace doesn't help much mainly because everything has been inlined into ensure_dir... If you run rr record under gdb you should get a better stack trace. Or if you run a debug build of rr.

  4. rocallahan commented on Jan 7, 2019

    @rocallahan
    Collaborator

    Offtopic: Building current master leads to the following error:

        You have called ADD_LIBRARY for library rrpreload without any source files. This typically indicates a problem with your CMakeLists.txt file
        CMake Error at CMakeLists.txt:312 (target_sources):
        Unknown CMake command "target_sources"
    

    What version of CMake are you using? target_sources was added 4 years ago in CMake 3.1 ... https://cmake.org/pipermail/cmake/2014-December/059418.html

    I think this is actually already fixed on master:

        // save trace dir set in _RR_TRACE_DIR or in the default trace dir
        ensure_dir(trace_save_dir(), "trace directory", S_IRWXU);
    
    string trace_save_dir() {
      const char* output_dir = getenv("_RR_TRACE_DIR");
      return output_dir ? output_dir : default_rr_trace_dir();
    }
    

    Guess I should do a release soon!

  5. rocallahan commented on Jan 7, 2019

    @rocallahan
    Collaborator

    That's a very good point. Done! (Of course I had not been keeping track of the minimum required version...)

  6. rocallahan commented on Jan 8, 2019

    @rocallahan
    Collaborator

    I'm going to close this because it's fixed on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions