Web lists-archives.com

RE: sed seems to force UC filename on Mixed 8.3 filenames on FAT32




Sorry folks but I am going to top post for the sake of clarity.  The original msg is below for reference.

Corinna, I ran the following and I attached the trace file:
	E:\junk>ls > Zot.txt
	E:\junk>ls
	Zot.txt
	E:\junk>strace -o d2u.trace dos2unix -n Zot.txt Zot.txt
	dos2unix: converting file Zot.txt to file Zot.txt in Unix format...
	E:\junk>ls
	ZOT.TXT  d2u.trace

I did further experiments.

You are correct regarding overwriting but not in a generic case (e.g. ls > Foo.txt twice preserves case) but in the specific case of "dos2unix". 
If the destination file exists, case will be lost.

    E:\junk>ls				---- empty folder

    E:\junk>ls > Zot.txt

    E:\junk>dos2unix -n Zot.txt Foo.txt		---- works first time
    dos2unix: converting file Zot.txt to file Foo.txt in Unix format...

    E:\junk>ls
    Foo.txt  Zot.txt

    E:\junk>dos2unix -n Zot.txt Foo.txt		---- but not second time
    dos2unix: converting file Zot.txt to file Foo.txt in Unix format...

    E:\junk>ls
    FOO.TXT  Zot.txt

I re-ran the preceding capturing trace files which I have also attached, as in:
  E:\junk>ls
  d2u.trace

  E:\junk>ls > Zot.txt

  E:\junk>ls
  Zot.txt  d2u.trace

  E:\junk>strace -o d2u_firsttime.trace dos2unix -n Zot.txt Foo.txt
  dos2unix: converting file Zot.txt to file Foo.txt in Unix format...

  E:\junk>ls
  Foo.txt  Zot.txt  d2u.trace  d2u_firsttime.trace

  E:\junk>strace -o d2u_secondtime.trace dos2unix -n Zot.txt Foo.txt
  dos2unix: converting file Zot.txt to file Foo.txt in Unix format...

  E:\junk>ls
  FOO.TXT  Zot.txt  d2u.trace  d2u_firsttime.trace  d2u_secondtime.trace


Michel

> -----Original Message-----
> From: cygwin-owner@xxxxxxxxxx [mailto:cygwin-owner@xxxxxxxxxx] On
> Behalf Of Corinna Vinschen
> Sent: March 5, 2018 12:14 PM
> To: cygwin@xxxxxxxxxx
> Subject: Re: sed seems to force UC filename on Mixed 8.3 filenames on
> FAT32
> 
> On Mar  5 12:05, Michel LaBarre wrote:
> > > From: cygwin-owner@xxxxxxxxxx [mailto:cygwin-owner@xxxxxxxxxx]
> On
> > > Behalf Of Corinna Vinschen
> > > On Mar  5 11:42, Michel LaBarre wrote:
> > > > I have the same build 16299.248 and I get the same behaviour.
> > > > Perhaps consider: http://www.zoneutils.com/regtricks/filesystem.htm
> > > > for parameters to experiment with.  You can use fsutil to control some
> of
> > > these to avoid direct registry modifications.
> > > > I expect it is more subtle otherwise the pervasive nature of the flags
> would
> > > mean that any file creation would result in UC names, not just dos2unix.
> > > > i.e. ls > Foo.txt should produce FOO.TXT
> > >
> > > Maybne something with overwriting existung files?  What if you call
> > > `ls > Foo.txt' twice in a row?
> > >
> >
> > Nope - that works ok.  (BTW - you were fast on the reply!)
> >
> > I did try:
> > 	E:\>dos2unix -n Zot.txt Foo.txt
> > 	dos2unix: converting file Zot.txt to file Foo.txt in Unix format...
> > 	E:\>ls
> > 	 Foo.txt    Zot.txt
> >
> > I thought using -n might suffice as a quick workaround for Fergus so I tried:
> >
> > 	E:\>dos2unix -n Zot.txt Zot.txt
> > 	dos2unix: converting file Zot.txt to file Zot.txt in Unix format...
> > 	E:\>ls
> > 	 Foo.txt  ZOT.TXT
> 
> But `mv ZOT.TXT Zot.txt' works?
> 
> Can you strace this like this after renaming the file back to Zot.txt
> 
>   $ strace -o d2u.trace dos2unix -n Zot.txt Zot.txt
> 
> and send the d2u.trace file to this list?
> 
> 
> Thanks,
> Corinna
> 
> --
> Corinna Vinschen                  Please, send mails regarding Cygwin to
> Cygwin Maintainer                 cygwin AT cygwin DOT com
> Red Hat

Attachment: d2u.trace
Description: Binary data

Attachment: d2u_secondtime.trace
Description: Binary data

Attachment: d2u_firsttime.trace
Description: Binary data

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple