<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Alt om ingenting og litt i mellom &#187; SSH</title>
	<atom:link href="http://hovenko.no/blog/tag/ssh/feed/" rel="self" type="application/rss+xml" />
	<link>https://hovenko.no/blog</link>
	<description>En blogg av Knut-Olav</description>
	<lastBuildDate>Mon, 10 Mar 2025 19:25:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Could not dupe: Bad file descriptor</title>
		<link>https://hovenko.no/blog/2009/09/08/could-not-dupe-bad-file-descriptor/</link>
		<comments>https://hovenko.no/blog/2009/09/08/could-not-dupe-bad-file-descriptor/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 17:39:22 +0000</pubDate>
		<dc:creator>Knut-Olav</dc:creator>
				<category><![CDATA[English-posts]]></category>
		<category><![CDATA[Programmering]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://hovenko.no/blog/?p=348</guid>
		<description><![CDATA[Ok, so I have been debugging a Perl application that I wrote about six months ago. Basically it creates some meta data and copies files to other user accounts using SSH. For file transfer it uses File::RsyncP and for remote control it uses Net::SSH::Perl. Some times I get the error message Could not dupe: Bad [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, so I have been debugging a Perl application that I wrote about six months ago. Basically it creates some meta data and copies files to other user accounts using SSH.</p>
<p>For file transfer it uses <a href="http://search.cpan.org/dist/File-RsyncP/">File::RsyncP</a> and for remote control it uses <a href="http://search.cpan.org/dist/Net-SSH-Perl/">Net::SSH::Perl</a>. Some times I get the error message <strong>Could not dupe: Bad file descriptor</strong>. Not a very informative error message, but I had an idea that it might have something to do with the file transfer. After I restart the application, running as a FastCGI web application, everything works, for a short while, then it breaks again.</p>
<p>I found out that it stops working right after I end my SSH connection, after debugging and restarting the application. After some research I found out it had something to do with the loss of STDIN. My best guess is that SSH needs STDIN to be able to read the password entered by the user, but I use keys for authentication, so I won&#8217;t need STDIN at all for interacting with SSH.</p>
<p>I tried different tactics to keep STDIN open. Running it using nohup did not help. Then I tried starting up the web application using <a href="http://www.gnu.org/software/screen/">screen</a>, and now it still runs several hours after logging out from the server.</p>
<p>I don&#8217;t like this workaround very much. So if anyone has a better solution to this problem, I would love to hear about it.</p>
<p>A possible solution might be to redirect STDIN to a temporary file. Anyone had success doing this with Net::SSH::Perl or File::RsyncP?</p>
]]></content:encoded>
			<wfw:commentRss>https://hovenko.no/blog/2009/09/08/could-not-dupe-bad-file-descriptor/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
