flock in 2.20.1 can no longer lock the file it will execute

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



i've been using a trick with flock to add locking to all of my shell scripts.  
basically, i take a lock on the shell script itself:
	flock -eon ./test.sh ./test.sh

with <=util-linux-2.20, this has worked fine.  but starting with 2.20.1, i now 
get -ETXTBSY (on ext4, but i doubt that matters):
	$ echo '#!/bin/sh' > test.sh
	$ chmod a+rx test.sh 
	$ ./flock -eon ./test.sh ./test.sh 
	./flock: ./test.sh: Text file busy

the only commit made to flock.c between 2.20 and 2.20.1 is this:
	commit 75aaee08f06b92d119ed827c53d1af5474eb16ff
	flock: make flock(1) work on NFSv4

and indeed, reverting that made my life happy again.  reading the small patch 
shows the obvious flaw: you can't open a file for O_RDWR and attempt to execute 
it at the same time.
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux