I would also have expected an error from ftruncate64 call. <br><br>For some reason I was forced to compile my uClibc with large file
support. I&#39;m not sure what that reason was since I&#39;ve been tinkering
with the gumstix buildroot for about a year now.<br>
Changing <br>
#define _FILE_OFFSET_BITS 64<br>
to<br>
#define _FILE_OFFSET_BITS 32<br>
in config.h seems to fix my problem. This forces dropbear to use the ftruncate call instead of ftruncate64 call.<br>
<br>Thanks for guiding me through the problem<br>

Jacques<br>

<br><br><br><div class="gmail_quote">On Feb 9, 2008 12:30 AM, Rob Landley &lt;<a href="mailto:rob@landley.net">rob@landley.net</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Friday 08 February 2008 08:44:36 Jacques Verryn wrote:<br>&gt; On Feb 5, 2008 11:49 PM, Rob Landley &lt;<a href="mailto:rob@landley.net">rob@landley.net</a>&gt; wrote:<br>&gt; &gt; On Tuesday 05 February 2008 10:13:13 Jacques Verryn wrote:<br>
&gt; &gt; &gt; The crux of the problem is if I scp a file from my desktop linux pc to<br>&gt; &gt; the<br>&gt; &gt; &gt; gumstix, the resulting file on the gumstix has zero file length.<br>&gt; &gt; &gt; The common denominator in the above posts and in my case, is uclibc.<br>
&gt; &gt; &gt; I upgraded from dropbear 0.48.1 to 0.50 due the the scp hang error that<br></div>...<br><div class="Ih2E3d">&gt; [pid &nbsp;6696] ftruncate64(3, 51539607552) = 0<br>&gt; [pid &nbsp;6696] close(3) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 0<br>
&gt; [pid &nbsp;6696] read(0, &quot;\0&quot;, 1) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 1<br>&gt; [pid &nbsp;6696] write(1, &quot;\0&quot;, 1 &lt;unfinished ...&gt;<br>&gt; &lt;/---trace snip ----&gt;<br>&gt;<br>&gt; The size parameter of the ftruncate64 call is WAY wrong!<br>
<br></div>That&#39;s certainly a bug, but how would it produce a 0 length file? &nbsp;(Especially<br>since the truncate call isn&#39;t returning an error...)&nbsp;</blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><div class="Ih2E3d"><br>&gt; &lt;code&gt;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; if (count != 0 &amp;&amp; wrerr == NO &amp;&amp;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; atomicio(vwrite, ofd, bp-&gt;buf, count) != count) {<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wrerr = YES;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wrerrno = errno;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&gt;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; if (wrerr == NO &amp;&amp; ftruncate(ofd, size) != 0) {<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;run_err(&quot;%s: truncate: %s&quot;, np, strerror(errno));<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;wrerr = DISPLAYED;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &lt;/code&gt;<br>&gt; This code has not change in a while. I also verified the &#39;size&#39; has the<br>&gt; correct value just before the ftruncate.<br><br></div>Why is uClibc calling ftruncate64() for this on gumstix? &nbsp;Is that a 64 bit<br>
processor, or does it have large file support? &nbsp;This sounds like a uClibc<br>issue. &nbsp;What version of uClibc are you using?&nbsp;</blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>In any case, uClibc should be casting size to uint64_t inside the call to<br>ftruncate. &nbsp;Sounds like a mismatch between the prototype and the actual<br>syscall...<br><div><div></div><div class="Wj3C7c"><br>Rob<br>--<br>
&quot;One of my most productive days was throwing away 1000 lines of code.&quot;<br> &nbsp;- Ken Thompson.<br><br><br></div></div></blockquote></div><br><br>