Crash during merge of file in root directory

Issue #23 new
sqweek created an issue

Hi guys,

I'm seeing a crash along these lines (SHA1 abbreviated for clarity):

host1$ ori newfs test
host1$ orifs --repo=test /tmp/test1
host1$ cd /tmp/test1
host1$ echo hello > ./ori
host1$ ori snapshot

host2$ ori replicate host1:.ori/test.ori
host2$ orifs --repo=test.ori /tmp/test2
host2$ cat /tmp/test2/ori
hello

host1$ echo hello world > /tmp/test1/ori
host1$ ori snapshot
Committed 0508cf62...

host2$ cd /tmp/test2
host2$ ori pull
Pulled up to 0508cf62...
host2$ ori merge 0508cf62...
merge failed with an unknown error!
host2$ ls
ls: cannot open directory '.': Transport endpoint is not connected

This is with 0.8.1, and reproducible every time I attempt the merge. I rebuilt with debug symbols and got a core dump, and looks like the problem is with the getDir(OriFile_Dirname(e.filepath)) call(s) in OriPriv::merge().

In this case e.filepath is "/ori", for which OriFile_Dirname returns the empty string. Then OriPriv::getDir("") falls through to throw SystemException(ENOENT).

Comments (4)

  1. sqweek reporter

    Code inspection reveals that other callers of OriFile_Dirname replace an empty string with a slash before passing it to OriPriv::getDir. Here's a patch to fix OriPriv::merge to do the same.

  2. Ali Mashtizadeh

    0.8.1 has a number of bugs fixed in the current tree, but I haven't cut a release yet. This looks like something we fixed but I'll take another look.

  3. sqweek reporter

    This one didn't seem to be fixed - patch still applies on HEAD and I don't see any changes to OriFile_Dirname that would prevent it returning the empty string.

  4. Log in to comment