Writing to ~/.journal hangs process on Mac OS X when FileVault is enabled #41

Closed
simonmichael opened this Issue Apr 8, 2013 · 4 comments

Projects

None yet

1 participant

@simonmichael
Owner

Original author: ja...@overton.ca (March 01, 2011 13:35:07)

Hello,

I experienced a strange and rather severe problem trying out hledger today. I think I have the problem isolated to a bad interaction between Apple's FileVault and hledger trying to write to the ~/.journal file.

Software versions: Mac OS X 10.6.6, hledger 0.13.98

Steps to reproduce:

  1. Activate FileVault for a user account under Mac OS X.
  2. As that user, run hledger without specifying an input file.

Expected: hledger should create the ~/.journal file and run as normal.

Actual: hledger hangs, and cannot be stopped using ^C, Activity Monitor, or kill. I had to hard reset my MacBook each time I tried this.

My Theory:
I believe that the problem arises because FileVault creates a journaled disk image and mounts it at the user's home directory. The journalling file for the FileVault volume is thus mounted at ~/.journal. The file can't be seen with "ls" or read with "tail" (for instance). But writing to the ~/.journal with "echo" or "cat" causes the shell to hang unrecoverably. Each time I tried this hledger or the shell would take 100% CPU, and I couldn't kill the process short of a hard reset.

Unfortunately, Google hasn't been much help substantiating my theory. There's some information for "journal_info_block", which is an associated file. And this page for Carbon Copy Cloner says that the root .journal file should never be manipulated by third-party tools: http://www.bombich.com/software/docs/CCC/en.lproj/explore/default-excludes.html

I'm not sure what the right fix would be. This page discusses detecting whether a user has FileVault enabled: http://discussions.apple.com/thread.jspa;jsessionid=D178B53CD1ADA7666A4B6685ED64AEBB.node0?messageID=10934701&#10934701

Best regards,

James Overton

Original issue: http://code.google.com/p/hledger/issues/detail?id=41

@simonmichael
Owner

From simon@joyful.com on March 01, 2011 18:16:43
Ouch! Nice report. From "The journalling file for the FileVault volume is thus mounted at ~/.journal", it sounds like our default file path conflicts and will never work with FileVault, therefore the best thing to do is to choose a new default file path for hledger. Does that sound right ?

If so, what should it be ? I'm thinking ~/default.journal .

@simonmichael
Owner

From simon@joyful.com on March 01, 2011 18:19:32
PS perhaps you could verify that this works for your user with encrypted home dir:

$ LEDGER=~/default.journal hledger print

@simonmichael
Owner

From ja...@overton.ca on March 01, 2011 18:40:08
Yes, that command works as expected:

$ LEDGER=~/default.journal hledger print
No journal file "/Users/james/default.journal", creating it.
Edit this file or use "hledger add" or "hledger web" to add transactions.

Using "/default.journal" would be fine. Maybe "/.hledger.journal" would be better. Anything except "~/.journal" will work. For my own purposes I changed journaldefaultfilename to ".ledger" in hledger-lib/Hledger/Read.hs and recompiled.

@simonmichael
Owner

From simon@joyful.com on April 17, 2011 20:37:16
I have changed the default file path to ~/.hledger.journal (and ~/.hledger.timelog) in darcs.

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