delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/05/13/20:33:24

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 051303870852
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1589416340;
bh=R2m38HdfxTwu4J7zl99JnMuAgz8Mnt96OSb4IwoOCPE=;
h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=SPYw/jUiUPi1Fu6g6QIKoKktWXPwzFSplXZtTCjpKfwf5aQLsw0HRFVK5GihD7xgj
UUGm4780e3G076cE49lux3tnjtor4HqxdZqtFxZi1r2Mc/tTJA7/zJWy1nc0iCRQCC
i2T4UdQkJXDz61yOMToU0fQG3fYnMg9ixFT7DeGk=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C1A693851C2E
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to;
bh=GskpVNsSXnWAm1iVQF0uxT9IQqQ3fKtIG77F55A6Pgc=;
b=eLfARf4xmgk/kroCVdH6ugdlUsFOlIoBUX90Pte4o6T3DzhNK286wBmdZdqfZaqRpg
Bl+NXs1HfMsVufWICl/RhOL0TF+VCKghe/RU5o0O/aET8Yp4D+b4eV09yc86Xhj0GaqH
H4viU2n9nU9U6LriDHrNp7BWsTM0RcM8SrfgC5GXXb+SPu3LTKY7JBcBCNzlDqHEfFne
HZWPOeYrP99K49pwPHC6r0MQw3pXi1FhzC29m1JruRNVvhHOy84X94Y1jYoZcL0mT/bp
fQjafGjeqTfgcMbjy7cB1SQxo5iKAvQjuW4pBXwQlzpE+8AhOqu/NEmpPVzVBJfUs8+t
kiOw==
X-Gm-Message-State: AOAM5330ai6ihlmxcqVOuk2zoJFtHGoe1MQb5WOfP1qhu6w/dqFLtWVr
wUd1liuWljmP0xc2s790dh+xN1Sd0DQmPb1Qp44hXGyyHEI=
X-Google-Smtp-Source: ABdhPJy9iIptFXrruhoQJiiB3RXHv443KSWjBmrjRqmB0spPfvZEzLZPkc5vGOlKD28RIkk/915Hvc/fFxH1aiABzvU=
X-Received: by 2002:aa7:c606:: with SMTP id h6mr1907801edq.265.1589416319133;
Wed, 13 May 2020 17:31:59 -0700 (PDT)
MIME-Version: 1.0
References: <CAKObCaoqPMb6ebbivTcKpWvF_ADhb1HNFgkkD3mpW6nARD4hWQ AT mail DOT gmail DOT com>
In-Reply-To: <CAKObCaoqPMb6ebbivTcKpWvF_ADhb1HNFgkkD3mpW6nARD4hWQ@mail.gmail.com>
Date: Wed, 13 May 2020 20:31:31 -0400
Message-ID: <CAKObCarg0JG5afmja7juRTF_=fGsjON8_L1MMPWOn-6iLBv65g@mail.gmail.com>
Subject: Re: patch command incorrectly capitalizes filenames that live on
external USB flash drives
To: cygwin <cygwin AT cygwin DOT com>, Marco Atzeri <marco DOT atzeri AT gmail DOT com>,
Thomas Wolff <towo AT towo DOT net>,
Brian Inglis <Brian DOT Inglis AT systematicsw DOT ab DOT ca>
X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT,
FREEMAIL_FROM, GIT_PATCH_0, KAM_EXEURI, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,
SPF_PASS, TXREP, USB_DRIVES autolearn=ham autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <http://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Jason Gross via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Jason Gross <jasongross9 AT gmail DOT com>
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>

Sorry for the late reply; I can see replies to my messages at
https://cygwin.com/pipermail/cygwin/2020-April/244660.html, but
somehow I'm not receiving them in Gmail.  I've tried (re?)subscribing
to the cygwin mailing list, hopefully this fixes the problem.

Thomas Wolff wrote:
> You are throwing a puzzle into the mailing list and if you are lucky,
> someone may like to solve it.
> But perhaps: can you try to minimize your test case, please.
> Something like: touch Makefile; ls (if that's it).

I think there's some sort of misconception here.  touch and cat create
correctly capitalized files, and sed -i doesn't change capitalization,
even on my FAT32 drive.  patch is the only command I've found so far
which capitalizes filenames when modifying files.  I can try to dig
into the source code of patch and figure out a minimal C program that
breaks casing on files, but, come on, the fact that patch seems to
capitalize the file name of every file it modifies, and no other
utility does this, that seems like a pretty minimal test-case to me.
And anyway, the cygwin patch sources (version 2.7.4) are impossible to
compile, because safe.c can't find sys/resource.h and passing
-I/usr/include via CFLAGS hits an internal bug in patch's configure
script (search.h: present but cannot be compiled; sys/timeb.h: present
but cannot be compiled; fcntl.h: present but cannot be compiled).  (I've emailed
bug-patch AT gnu DOT org as requested by the configure script, but so far
https://lists.gnu.org/archive/html/bug-patch/ isn't showing anything
newer than January.)

Brian Inglis wrote:
> 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.

This does not explain why `ls` displays "Makefile" as "Makefile"
before I run `patch`, but displays the filename as "MAKEFILE" after I
run `patch`.  Nor does it explain why this happens to patch-modified
files, but not to files modified via sed -i.

Marco Atzeri wrote:
> use a flash driver with NTFS and check the difference

Indeed, I can confirm that this issue occurs when it's FAT or FAT32,
and does not occur under NTFS nor exFAT.

> I doubt it is a patch issue

Do you have another utility that you suggest I try that you think will
display the same problem as patch?  So far, `| tee -a`, `sed -i`,
`touch`, `>`, and `>>` all do not display this issue, while `patch`
does.


-Jason




On Tue, Apr 28, 2020 at 3:27 PM Jason Gross <jasongross9 AT gmail DOT com> wrote:
>
> 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:
> ```
> powershell -Command "(New-Object
> Net.WebClient).DownloadFile('http://www.cygwin.com/setup-x86_64.exe',
> 'setup-x86_64.exe')"
> SET CYGMIRROR=http://mirror.easyname.at/cygwin
> SET CYGROOT=H:\cygwin64
> SET CYGCACHE=%CYGROOT%\var\cache\setup
> setup-x86_64.exe -qnNdO -R %CYGROOT% -l %CYGCACHE% -s %CYGMIRROR% -P
> rsync -P patch -P diffutils -P make -P unzip -P m4 -P findutils -P
> time -P wget -P curl -P git -P
> mingw64-x86_64-binutils,mingw64-x86_64-gcc-core,mingw64-x86_64-gcc-g++,mingw64-x86_64-pkg-config,mingw64-x86_64-windows_default_manifest
> -P mingw64-x86_64-headers,mingw64-x86_64-runtime,mingw64-x86_64-pthreads,mingw64-x86_64-zlib
> -P python3
> ```
>
> Running `patch -v` says `GNU patch 2.7.4`.  Note that this happens
> regardless of whether I install cygwin itself on my external flash
> drive or on my internal HD.
>
> This came up when trying to run `opam install findlib` (which fails
> when the home directory is on an external USB drive).
>
> -Jason
--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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