73 reputation
7
bio website plus.google.com/…
location Raleigh, NC
age
visits member for 3 years, 1 month
seen Jan 16 at 20:37

Aug
26
awarded  Benefactor
Aug
23
comment How to determine POSIX advisory file locks are working in simfs in the VM I'm using?
Well, don't have an answer yet, but @DennisKaarsemaker answered the original question with ways to test flock and fcntl locks at command-line. Thanks again, Dennis!
Aug
23
accepted How to determine POSIX advisory file locks are working in simfs in the VM I'm using?
Aug
23
comment How to determine POSIX advisory file locks are working in simfs in the VM I'm using?
Ok, found the internal fork source for Ruby 2.0.0p247 at github.com/ruby/ruby/blob/v2_0_0_247/process.c#L3307 and SQLite 3.7.9 code here - In SQLite, src/os_unix.c (among others) has a number of uses of fcntl and tool/getlock.c states "This only works on unix when the posix advisory locking method is used (which is the default on unix) and when the PENDING_BYTE is in its usual place."
Aug
21
comment How to determine POSIX advisory file locks are working in simfs in the VM I'm using?
btw- this is Ruby 2 p247's test of fcntl lock in linux. The link I put in the comments at top was just the first thing I found in google. Will continue to look later.
Aug
21
comment How to determine POSIX advisory file locks are working in simfs in the VM I'm using?
I'm thinking now it is because of the statement I mentioned above in the comments from here, "POSIX fcntl locks are not inherited across the fork(2) system call." What I don't know yet is why Ruby's fork command in OS X does not cause problems with fcntl locks but it does in Linux. In the rdoc it says "Creates a subprocess", but need to look at the Ruby source/do some more reading. Using Tracepoint in Ruby 2, I only see [7, Kernel, :fork, :c_call] and then the c_return.
Aug
21
awarded  Commentator
Aug
21
comment How to determine POSIX advisory file locks are working in simfs in the VM I'm using?
So whether good or bad, your latest test is passing/not failing. It results in: "Traceback (most recent call last): File "<string>", line 9, in <module> IOError: [Errno 11] Resource temporarily unavailable" in both OS X where it works and in the Linux VM where I thought it'd be failing.
Aug
21
comment How to determine POSIX advisory file locks are working in simfs in the VM I'm using?
py_out = `python -c "import fcntl, os, time\n\nfd = open('/tmp/test.lock', 'w')\nif os.fork():\n fcntl.lockf(fd, fcntl.LOCK_EX)\n os.wait()\nelse:\n time.sleep(0.1)\n fcntl.lockf(fd, fcntl.LOCK_EX|fcntl.LOCK_NB)\n"` :)
Aug
21
comment How to determine POSIX advisory file locks are working in simfs in the VM I'm using?
Thanks for the py code! Will convert to single command-line and try it out.
Aug
21
comment How to determine POSIX advisory file locks are working in simfs in the VM I'm using?
The Ruby fork doc also suggests that Ruby's fork doesn't work in Windows and BSD, so instead I should be using pid = spawn(...), but that just takes a system/shell command vs. block of Ruby code and would be more difficult to setup.
Aug
21
comment How to determine POSIX advisory file locks are working in simfs in the VM I'm using?
Read here that, "POSIX fcntl locks are not inherited across the fork(2) system call." Perhaps OS X's behavior with Ruby's fork command does not match that of Linux? Ruby allows access to fcntl(2)/posix advisory locking via IO::fcntl, so I could use that in a test, similar to Matz's TestFcntlLock.
Aug
20
comment How to determine POSIX advisory file locks are working in simfs in the VM I'm using?
+1 for the info! I don't have access to the console- I can only shell out commands, so did this in the Ruby test: system 'flock test.lock sleep 5 & sleep 1; if ! flock -n test.lock true ; then echo "flock works"; else echo "flock fails"; fi', but that is saying that flock works. From what I'm reading, I think I need to test fcntl, and I think I can only do that with smbtorture's ping pong test, but not sure how and not sure if that is only for Samba? I might still be on the wrong track, though.
Aug
20
revised How to determine POSIX advisory file locks are working in simfs in the VM I'm using?
added 140 characters in body
Aug
20
revised How to determine POSIX advisory file locks are working in simfs in the VM I'm using?
deleted 152 characters in body
Aug
20
revised How to determine POSIX advisory file locks are working in simfs in the VM I'm using?
added 17 characters in body
Aug
20
comment How to determine POSIX advisory file locks are working in simfs in the VM I'm using?
I've made the question less about corruption and more about testing POSIX advisory file locking in a filesystem from command-line, since people seem to be getting hung up on how you test that a file was corrupted.
Aug
20
revised How to determine POSIX advisory file locks are working in simfs in the VM I'm using?
added 17 characters in body
Aug
20
awarded  Promoter
Aug
20
revised How to determine POSIX advisory file locks are working in simfs in the VM I'm using?
added 394 characters in body