<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: flock before execve?</title>
	<atom:link href="http://dpk.net/2009/03/13/flock-before-execve/feed/" rel="self" type="application/rss+xml" />
	<link>http://dpk.net/2009/03/13/flock-before-execve/</link>
	<description>oh you want the time travel spinning head?</description>
	<lastBuildDate>Fri, 10 Feb 2012 21:18:10 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: bad interpreter: Text file busy - Admins Goodies</title>
		<link>http://dpk.net/2009/03/13/flock-before-execve/comment-page-1/#comment-107712</link>
		<dc:creator>bad interpreter: Text file busy - Admins Goodies</dc:creator>
		<pubDate>Wed, 24 Aug 2011 12:15:30 +0000</pubDate>
		<guid isPermaLink="false">http://dpk.net/?p=488#comment-107712</guid>
		<description>[...] appear to be having this issue, which is because at some point nvi started opening files O_RDWR instead of [...]</description>
		<content:encoded><![CDATA[<p>[...] appear to be having this issue, which is because at some point nvi started opening files O_RDWR instead of [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jason</title>
		<link>http://dpk.net/2009/03/13/flock-before-execve/comment-page-1/#comment-38535</link>
		<dc:creator>jason</dc:creator>
		<pubDate>Thu, 29 Oct 2009 19:19:42 +0000</pubDate>
		<guid isPermaLink="false">http://dpk.net/?p=488#comment-38535</guid>
		<description>I&#039;m getting the &quot;text file busy&quot; when trying to mv or rm a .htm file:
server:/Scanned/OAO # rm ApplicationArchive.htm 
rm: remove regular file `ApplicationArchive.htm&#039;? y
rm: cannot remove `ApplicationArchive.htm&#039;: Text file busy

why would this happen to a pure text file and not an executable.</description>
		<content:encoded><![CDATA[<p>I&#8217;m getting the &#8220;text file busy&#8221; when trying to mv or rm a .htm file:<br />
server:/Scanned/OAO # rm ApplicationArchive.htm<br />
rm: remove regular file `ApplicationArchive.htm&#8217;? y<br />
rm: cannot remove `ApplicationArchive.htm&#8217;: Text file busy</p>
<p>why would this happen to a pure text file and not an executable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dpk</title>
		<link>http://dpk.net/2009/03/13/flock-before-execve/comment-page-1/#comment-29015</link>
		<dc:creator>dpk</dc:creator>
		<pubDate>Sat, 14 Mar 2009 14:32:06 +0000</pubDate>
		<guid isPermaLink="false">http://dpk.net/?p=488#comment-29015</guid>
		<description>Could be. I&#039;ve checked sysctl -a for lock, exec, etc. &quot;bash shellscript -foo&quot; works fine. FWIW, the same thing happens with csh, further pointing at the kernel.

Edited: I think I&#039;ve figured out what is going on (assuming the code I am looking at is the code that is in use). In fs/exec.c, do_exec() calls open_exec(), which calls deny_write_access(). That checks to see how many processes have the file open for writing, and if it is more than 0, it returns Text file busy.

It&#039;s really old behavior, but I haven&#039;t seen it until now because previous versions of nvi would open the input file with O_RDONLY, and the new version opens it O_RDWR (confirmed with strace).

You can duplicate the issue by running &quot;cat &gt;&gt; shellscript&quot; from the command line and them attempting to run the script in another window. The behavior seems to make more sense now (now that I know it&#039;s not flock, that is) from a security standpoint.</description>
		<content:encoded><![CDATA[<p>Could be. I&#8217;ve checked sysctl -a for lock, exec, etc. &#8220;bash shellscript -foo&#8221; works fine. FWIW, the same thing happens with csh, further pointing at the kernel.</p>
<p>Edited: I think I&#8217;ve figured out what is going on (assuming the code I am looking at is the code that is in use). In fs/exec.c, do_exec() calls open_exec(), which calls deny_write_access(). That checks to see how many processes have the file open for writing, and if it is more than 0, it returns Text file busy.</p>
<p>It&#8217;s really old behavior, but I haven&#8217;t seen it until now because previous versions of nvi would open the input file with O_RDONLY, and the new version opens it O_RDWR (confirmed with strace).</p>
<p>You can duplicate the issue by running &#8220;cat >> shellscript&#8221; from the command line and them attempting to run the script in another window. The behavior seems to make more sense now (now that I know it&#8217;s not flock, that is) from a security standpoint.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rone</title>
		<link>http://dpk.net/2009/03/13/flock-before-execve/comment-page-1/#comment-29009</link>
		<dc:creator>rone</dc:creator>
		<pubDate>Sat, 14 Mar 2009 07:00:32 +0000</pubDate>
		<guid isPermaLink="false">http://dpk.net/?p=488#comment-29009</guid>
		<description>Hmm, sure it&#039;s not some security setting?  Try &#039;bash shellscript -foo&#039; and see if that works.  I ran into this on some outsourced servers at work.</description>
		<content:encoded><![CDATA[<p>Hmm, sure it&#8217;s not some security setting?  Try &#8216;bash shellscript -foo&#8217; and see if that works.  I ran into this on some outsourced servers at work.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

