delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/03/18/11:59:18

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Sun, 18 Mar 2012 16:58:29 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: ftell() fails on files in shared folders
Message-ID: <20120318155829.GA21914@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <CAJOtW+5qwWvN84mJJ=NR3TgZE5s7jz8jpLTaN=+h1hv5Ob29XQ AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <CAJOtW+5qwWvN84mJJ=NR3TgZE5s7jz8jpLTaN=+h1hv5Ob29XQ@mail.gmail.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Mar 18 18:55, Yuri Gribov wrote:
> Hi all,
> 
> I have recently ran into a problem with Cygwin accessing files located
> in shared folders. The attached program does fwrite() and then checks
> file size with ftell(). Ftell() returns correct results in any of
> following situations:
> 1) I access local file: c:/test.bin

Wrong style.  Don't use DOS paths.  Use POSIX paths instead, like,
in that case, /cygdrive/c/test.bin.

> 2) I access file via UNC-address from the same computer:
> //server-name/dir/test.out
>   gribov DOT y AT s-cw-head ~/build/upc/opt
>   $ ./a.exe
>   success
> 
> But when I try to access file via UNC-address from a different machine
> ftell() starts returning 0 instead of expected 8:
>   gribov DOT y AT s-cw-head ~/build/upc/opt
>   $ gcc io.c && run_ms_job -n 1 -network smp a.exe
>   ftell(p) == sizeof(data) failed at io.c:26
> 
> Note that the file is created and data is written correctly:
>   gribov DOT y AT s-cw-head ~/build/upc/opt
>   $ xxd ~/pgas/test.bin
>   0000000: ffff ffff ffff ffff                      ........
> so there seem to be a problem with ftell() itself.
> 
> Any help/ideas will be much appreciated. I have tried searching the
> MLs but have not found anything similiar to my problem.

Works for me.  I changed your testcase to allow entering the pathname on
the command line:

  $ ./a ./test.bin
  success
  $ ./a //this-machine/c\$/cygwin/home/corinna/test/bin
  success
  $ ./a //other-machine/c\$/cygwin/home/corinna/test/bin
  success

Either I don't understand your problem description, or you're suffering
from some BLODA problem, maybe.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019