Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 Message-ID: <406093E5.3050907@scytek.de> Date: Tue, 23 Mar 2004 14:45:41 -0500 From: Volker Quetschke User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: lstat on FAT - Was: Problem with find on FAT drives References: <406056A3 DOT 9010507 AT scytek DOT de> In-Reply-To: <406056A3.9010507@scytek.de> Content-Type: multipart/mixed; boundary="------------090803090700040704030001" X-Scanned-By: MIMEDefang 2.39 X-IsSubscribed: yes --------------090803090700040704030001 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit > Hi! > > I just found a strange problem when using find on a FAT drive. > I got: "find: .\tmp changed during execution of find" OK, I analyzed the problem a bit and found that lstat can give different inode numbers on fat, see the attached testcase. To test this you have to have a directory called tmp in your current working directory. On a FAT drive you get: $ /tmp/lstat_test.exe Checking pathname: .\tmp cur_stat_buf.st_ino: -1375632239 stat_buf.st_ino: 802199907 Error Inode numbers are different! Bug or feature? Volker -- PGP/GPG key (ID: 0x9F8A785D) available from wwwkeys.de.pgp.net key-fingerprint 550D F17E B082 A3E9 F913 9E53 3D35 C9BA 9F8A 785D --------------090803090700040704030001 Content-Type: text/plain; name="lstat_test.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="lstat_test.c" #include #include #include int main (int argc, char **argv) { char pathname[]=".\\tmp"; long a,b; struct stat stat_buf, cur_stat_buf; /* get &stat_buf */ lstat (pathname, &stat_buf); if (chdir (pathname) < 0) { printf("Errno: %d Path: %s\n", errno, pathname); return; } /* get &cur_stat_buf. Should be the same as stat_buf. */ if (lstat (".", &cur_stat_buf) != 0) printf("Errno: %d Path: %s\n", errno, pathname); /* Use a and b intsead of the variables, otherwise you get strange results with printf. */ a = cur_stat_buf.st_ino; b = stat_buf.st_ino; printf("Checking pathname: %s\ncur_stat_buf.st_ino: %d\nstat_buf.st_ino: %d\n",pathname, a, b ); if (cur_stat_buf.st_dev != stat_buf.st_dev || cur_stat_buf.st_ino != stat_buf.st_ino) printf("Error Inode numbers are different!\n"); } --------------090803090700040704030001 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ --------------090803090700040704030001--