X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:to:subject:references :content-type; q=dns; s=default; b=Vme4JvKv+Aa2BytQ8NV/4WTSGJu+K CDUcT50cxM+IGF1FwINNv3uPfydrJ07h3UlbD3rw5DHbGqzlwSVe62Mr2gvcRxG+ FAO0WEhcZE+nD3rBmiiRTRx+a5nHDmX02ZWvrN845ePkZNBH7mY5dHdFqI/PjNo1 IZeeZAjfqM0RNQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:to:subject:references :content-type; s=default; bh=ZHZaCUtjTIgmQ6OUIl/tFiG9NSs=; b=D5b n9mkAmX1IofSHkQeQXQpb8sB+z24kq4dWQrtZPHc/wuQ39BEsZlSWUcd9LAmlkZd 6NpRlV4IVZXXZwTF2R13DUauKpFyLMvjNjxgsfpQVBobm2mpHbEgDLEpK2MprzFF WfRWro9+70N2b0vsqJnDT31x8wFHZzqWBV/NIzoM= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=multiples, UD:archive.org, Seeking, sk:how-to- X-HELO: mail-ot0-f176.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:date:from:to:subject:references :user-agent; bh=AVWL2DXLqWR7rj5b3jdctvSXAiclFajNiwF5PrjuMuA=; b=JuU6EJCrhRk93i7SQvZ0vl7A1HZ7GRl6rRwcZEOoeFHVqfrdGmzFZkeHrEtTG8ZCe9 JVLIDoaT9tGoKomgCIN5yy71Vyynp9WUN2SHKnOfIVwL2xO/mGaUha1BjGdzaswN8Mgh 7ssK+rdiirgIW0rWDRigGCY06pSfGYssBSTSUXPqgBlMOOMxAMq0uhyH04FqrBsSBel3 RVl9B4m7lV+67azSyS71ZV/S2fkmG/x6Lyf8Rv+JH1Knt0qVlwaTBw60JDaVncQkbM5m 0M8KpELPC8uU6+xEDZRd18KrEt8KcZjJYsdvQtDOBt/cmOIyYzckIZ6WZzaI2qGQ4i+t ahcg== X-Gm-Message-State: AKGB3mIu/43oOwVGvmz3H4E8slvnqjIyApnzwt35bOmoz1vCk4ANW/1T WNsf6V9ppMXW9v02Wzg+4hO5EA== X-Google-Smtp-Source: ACJfBotFGzUd/cCskwNe74MW07H9SRebBWH9RlPGgvyfLqIn0nJkf3nSJmh+ev+TnkrNMswGi6Iqgw== X-Received: by 10.157.85.5 with SMTP id l5mr1169562oth.381.1513643246727; Mon, 18 Dec 2017 16:27:26 -0800 (PST) Message-ID: <5a385ced.195b9d0a.d434.5400@mx.google.com> Date: Mon, 18 Dec 2017 16:27:25 -0800 (PST) From: Steven Penny X-Google-Original-From: Steven Penny To: cygwin AT cygwin DOT com Subject: Re: Wrong file position after writing 65537 bytes to block device References: <20171218131035 DOT GB11285 AT calimero DOT vinschen DOT de> Content-Type: text/plain; charset=utf8; format=flowed User-Agent: Tryst/2.0.1 (github.com/svnpenn/tryst) On Mon, 18 Dec 2017 14:10:35, Corinna Vinschen wrote: > In general, the writes on disk devices is sector-oriented. Howewver, > in this case ftell should have returned 65536. The problem here is > that the newlib implmentation of ftell/ftello performs an fflush > when called on a write stream since about 2008 to adjust for appending > streams. Given your example (thanks for the testcase!) this seems > pretty wrong. Looking further it turns out that neither glibc nor BSD > actually calls fflush in this case. There's only a special case for > appending streams, but this calls lseek, not fflush. > > Looks like a patch is required. Stay tuned. is it though? he says "write 65536 + 1 bytes", but as far as i can tell, you cant do that. quoting myself: > Seeking, reading and writing must all be done in multiples of sector size, in > my case 512 bytes http://web.archive.org/web/stackoverflow.com/questions/37228874/how-to-fwrite-to-removable-volume so it would make sense that the position becomes "65536 + 512" -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple