patch command incorrectly capitalizes filenames that live on external USB flash drives

Brian Inglis Brian.Inglis@SystematicSw.ab.ca
Wed Apr 29 23:48:25 GMT 2020


On 2020-04-28 22:52, Marco Atzeri via Cygwin wrote:
> Am 28.04.2020 um 21:27 schrieb Jason Gross via Cygwin:
>> Consider the following script in foo.sh:
>> ```
>> #!/usr/bin/env bash
>>
>> set -ex
>>
>> cd "$1"
>> rm -rf foo
>> mkdir foo
>> cd foo
>> cat > Makefile <<EOF
>> a
>> b
>> c
>> d
>> e
>> EOF
>> cat > diff <<EOF
>> diff --git a/Makefile b/Makefile
>> index 9405325..86d2f8c 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -1,5 +1,5 @@
>>   a
>>   b
>> -c
>> +ccc
>>   d
>>   e
>> EOF
>> patch -p1 -i ./diff
>> ls
>> ```
>>
>> If I run `./foo.sh /cygdrive/c/`, I get, as expected,
>> ```
>> + cd /cygdrive/c/
>> + rm -rf foo
>> + mkdir foo
>> + cd foo
>> + cat
>> + cat
>> + patch -p1 -i ./diff
>> patching file Makefile
>> + ls
>> diff  Makefile
>> ```
>>
>> If I instead run `./foo.sh /cygdrive/h/`, I get
>> ```
>> + cd /cygdrive/h/
>> + rm -rf foo
>> + mkdir foo
>> + cd foo
>> + cat
>> + cat
>> + patch -p1 -i ./diff
>> patching file Makefile
>> + ls
>> diff  MAKEFILE
>> ```
>>
>> My C drive is an internal SSD (NTFS), my H drive is an external flash
>> drive (FAT32).  I installed cygwin with the commands:
> 
> use a flash driver with NTFS and check the difference
> 
> I doubt it is a patch issue

That might be expected with FAT32, which is normally the default format for
flash drives, for maximum compatibility with microcontrollers, which may not
create VFAT Long File Names when file names are <= 8.3, so they appear as upper
case.

	$ cmd /c help format shows Windows format now supports:

	/FS:filesystem	Specifies the type of the file system (FAT, FAT32,
			exFAT, NTFS, UDF, ReFS).

You might want to try an ExFAT formatted flash drive to see if it works as
expected, and is compatible with your other systems.

Following MS opening up exFAT specs, exFAT is supported on most major OSes but
may require packages normally called exfat-utils and exfat-fuse or fuse-exfat to
be installed: exFAT was designed for flash drives.

[P.S. UDF is the new ISO DVD standard and Re(silient)FS was intended to replace
NTFS for Windows Server, but is deprecated, and creation is being dropped from
Windows 10 Home, so that option value may not work.]

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.


More information about the Cygwin mailing list