From owner-freebsd-bugs@FreeBSD.ORG Sun Nov 26 18:40:15 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9C13316A40F for ; Sun, 26 Nov 2006 18:40:15 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7820143D46 for ; Sun, 26 Nov 2006 18:39:19 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id kAQIeE24075282 for ; Sun, 26 Nov 2006 18:40:14 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id kAQIeEG8075281; Sun, 26 Nov 2006 18:40:14 GMT (envelope-from gnats) Date: Sun, 26 Nov 2006 18:40:14 GMT Message-Id: <200611261840.kAQIeEG8075281@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Maxim Konovalov Cc: Subject: Re: kern/86655 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Maxim Konovalov List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Nov 2006 18:40:15 -0000 The following reply was made to PR kern/86655; it has been noted by GNATS. From: Maxim Konovalov To: Micah Cc: bug-followup@freebsd.org, mato Subject: Re: kern/86655 Date: Sun, 26 Nov 2006 21:36:57 +0300 (MSK) On Sun, 26 Nov 2006, 10:25-0800, Micah wrote: > Maxim Konovalov wrote: > > Hi Micah, > > > > I failed to see how your patch changes dos2unixchr() code path. It > > seems it does the same things for any combinations of LCASE_* flags. > > Perhaps I'm just blind. Could you explain your patch further? > > > > -- > > Maxim Konovalov > > Oh, it's been a while, let me examine it... > > In dos2unixfn, lower comes from direntry.deLowerCase. deLowerCase is > byte 0x0c in the FAT dir entry that has two flags. One flag (bit 3) > determines the "case" of the 8 character filename, the other flag > (bit 4) determines the "case" of the 3 character extension. > Wikipedia has a good summary of this: > http://en.wikipedia.org/wiki/File_Allocation_Table#Directory_table > > Now for the code path: dos2unixchr will convert to lower case if > LCASE_BASE or LCASE_EXT or both are set. But dos2unixfn uses > dos2unixchr separately for the basename and the extension. So if > either LCASE_BASE or LCASE_EXT is set, dos2unixfn will convert both > the basename and extension to lowercase because it is blindly > passing in the state of both flags to dos2unixchr. The bit masks I > used ensure that only the state of LCASE_BASE gets passed to > dos2unixchr when the basename is converted, and only the state of > LCASE_EXT is passed in when the extension is converted. > > Here's an example run: > > In the original: > dosfn=TEST.TXT > lower=LCASE_EXT (meaning the filename should be TEST.txt) > unixfn="" > When dos2unixfn executes the first call to dos2unixchr, dos2unixchr will see > that LCASE_EXT is set and convert the basename to lowercase: > unixfn="test" > When dos2unixfn executes the second call to dos2unixchr, dos2unixchr will see > that LCASE_EXT is set and convert the extension to lowercase: > unixfn="test.txt" != "TEST.txt" > > In the patch: > dosfn=TEST.TXT > lower=LCASE_EXT (meaning the filename should be TEST.txt) > unixfn="" > When dos2unixfn executes the first call to dos2unixchr, dos2unixfn will mask > out all bits of lower but LCASE_BASE, dos2unixchr will see that no bits are > set and leave the basename as uppercase: > unixfn="TEST" > When dos2unixfn executes the second call to dos2unixchr, dos2unixfn will mask > out all bits of lower but LCASE_EXT, dos2unixchr will see that LCASE_EXT is > set and convert the extension to lowercase: > unixfn="TEST.txt" == "TEST.txt" > > Does that help, or did I miss something completely when I wrote the > patch? Yes, everything is clear now. Thanks, Micah! -- Maxim Konovalov