From owner-freebsd-questions@freebsd.org Thu Mar 30 10:42:35 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4F4ED2512D for ; Thu, 30 Mar 2017 10:42:35 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from ms-10.1blu.de (ms-10.1blu.de [178.254.4.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6BECCE12 for ; Thu, 30 Mar 2017 10:42:35 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from [89.204.130.214] (helo=localhost.unixarea.de) by ms-10.1blu.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.86_2) (envelope-from ) id 1ctXXD-0007Tq-UB for freebsd-questions@freebsd.org; Thu, 30 Mar 2017 12:42:32 +0200 Received: from localhost.my.domain (c720-r314251 [127.0.0.1]) by localhost.unixarea.de (8.15.2/8.14.9) with ESMTPS id v2UAgT6x002994 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 30 Mar 2017 12:42:29 +0200 (CEST) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by localhost.my.domain (8.15.2/8.14.9/Submit) id v2UAgSKk002993 for freebsd-questions@freebsd.org; Thu, 30 Mar 2017 12:42:28 +0200 (CEST) (envelope-from guru@unixarea.de) X-Authentication-Warning: localhost.my.domain: guru set sender to guru@unixarea.de using -f Date: Thu, 30 Mar 2017 12:42:27 +0200 From: Matthias Apitz To: freebsd-questions@freebsd.org Subject: mount_smbfs(8) && problem with write(2) / fstat(2) Message-ID: <20170330104227.GA2914@c720-r314251> Reply-To: Matthias Apitz Mail-Followup-To: Matthias Apitz , freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Operating-System: FreeBSD 12.0-CURRENT r314251 (amd64) User-Agent: Mutt/1.8.0 (2017-02-23) X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 89.204.130.214 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Mar 2017 10:42:35 -0000 Hello, I run a 12-CURRENT r314251 amd64 in vbox and encounter the following problem: a written file to a filesystem which is mounted with mount_smbfs(8) from the host system (Win7) returns size=0 in fstat(2) syscall right after writing: # gzip uu gzip: output file: uu.gz wrong size (0 != 56111), deleting gzip: leaving original uu # truss gzip uu ... openat(AT_FDCWD,"uu",O_RDONLY,00) = 3 (0x3) fstat(3,{ mode=-rwxr-xr-x ,inode=696197458,size=120561,blksize=4356 }) = 0 (0x0) stat("uu.gz",0x7fffffffda80) ERR#2 'No such file or directory' openat(AT_FDCWD,"uu.gz",O_WRONLY|O_CREAT|O_EXCL,0600) = 4 (0x4) read(3,"MD5 (a2ps-4.13b_8.txz) = 7384bda"...,65536) = 65536 (0x10000) read(3," 7e53b2679549ca00fcbb255ab5ac8e4"...,65536) = 55025 (0xd6f1) read(3,0x80182d980,65536) = 0 (0x0) write(4,"\^_\M^K\b\b:\M-Q\M-\X\0\^Cuu\0"...,56103) = 56103 (0xdb27) write(4,"ZR5\f\M-q\M-V\^A\0",8) = 8 (0x8) 56103+8 = 56111 have been written fine, but the following fstat(2) gives size=0: close(3) = 0 (0x0) fstat(4,{ mode=-rwxr-xr-x ,inode=2623741163,size=0,blksize=4356 }) = 0 (0x0) gzip: write(2,"gzip: ",6) = 6 (0x6) output file: uu.gz wrong size (0 != 56111), deletingwrite(2,"output file: uu.gz wrong size (0"...,52) = 52 (0x34) write(2,"\n",1) = 1 (0x1) close(4) = 0 (0x0) gzip: write(2,"gzip: ",6) = 6 (0x6) leaving original uuwrite(2,"leaving original uu",19) = 19 (0x13) write(2,"\n",1) = 1 (0x1) unlink("uu.gz") = 0 (0x0) exit(0x1) process exit, rval = 1 One can write the file this way fine: # gzip -c uu > uu.gz # ls -l total 173 -rwxr-xr-x 1 guru wheel 120561 30 mar. 11:34 uu -rwxr-xr-x 1 guru wheel 56111 30 mar. 11:46 uu.gz What does this mean? matthias -- Matthias Apitz, ✉ guru@unixarea.de, ⌂ http://www.unixarea.de/ ☎ +49-176-38902045