darcs

Issue 53 darcs does not detect silly Windows filename errors

Title darcs does not detect silly Windows filename errors
Priority bug Status resolved
Milestone 2.1.x Resolved in
Superseder Nosy List JamesBurgess, cakoose, darcs-devel, dmitry.kurochkin, eivuokko, jaredj, jch, kirby, kowey, markstos, simonpj, steve, thorkilnaur, tommy, wglozer
Assigned To
Topics Windows

Created on 2005-12-10.21:15:33 by system, last changed 2010-06-15.21:48:07 by admin.

Files
File name Uploaded Type Edit Remove
CheckWindowsFileName.hs cakoose, 2006-08-03.01:05:41 text/x-haskell
CheckWindowsFileName2.hs cakoose, 2008-08-26.06:46:47 text/x-haskell
Messages
msg195 (view) Author: markstos Date: 2005-12-10.21:15:33
darcs on windows fails when doing a get and it encounters a file in the 
repo that can't be created on windows (such as one containing a ":" or a 
"/" or a "*", etc, etc) and the only solution appears to be to remove the 
file from the source repo and delete all history. It would be nice it darcs 
would simply print a warning on windows.
msg199 (view) Author: droundy Date: 2005-12-11.13:10:12
On Sat, Dec 10, 2005 at 09:15:35PM +0000, Steve Dekorte wrote:
> darcs on windows fails when doing a get and it encounters a file in the 
> repo that can't be created on windows (such as one containing a ":" or a 
> "/" or a "*", etc, etc) and the only solution appears to be to remove the 
> file from the source repo and delete all history. It would be nice it darcs 
> would simply print a warning on windows.

Are you suggesting that darcs should simply ignore that file and all
patches pertaining to it? And if it's a directory that we should ignore the
directory and all patches pertaining to it or any files within that
directory? That sounds a bit extreme, and would be problematic (because of
the existing darcs implementation) if the file gets renamed.

It won't be so bad when we've got a file-backed pristine cache (I'm
thinking halfs, for those who are aware of it), since then our pristine
cache at least would be correct, and the worst we'd have to deal with would
be that the working directory is messed up.  But when our pristine cache
isn't capable of representing the current state of the repository, we're
just asking for repository corruption.
-- 
David Roundy
http://www.darcs.net
msg201 (view) Author: cakoose Date: 2005-12-11.22:39:11
Darcs already warns when a two file names only differ in case (which, I believe,
is to ensure portability on Windows).  Maybe it should also warn when a file
name contains characters that Windows wont accept?
msg202 (view) Author: steve Date: 2005-12-12.03:11:08
On 11-Dec-05, at AM 05:10, David Roundy wrote:
> Are you suggesting that darcs should simply ignore that file and all
> patches pertaining to it? And if it's a directory that we should 
> ignore the
> directory and all patches pertaining to it or any files within that
> directory? That sounds a bit extreme, and would be problematic 
> (because of
> the existing darcs implementation) if the file gets renamed.
>
> It won't be so bad when we've got a file-backed pristine cache (I'm
> thinking halfs, for those who are aware of it), since then our pristine
> cache at least would be correct, and the worst we'd have to deal with 
> would
> be that the working directory is messed up.  But when our pristine 
> cache
> isn't capable of representing the current state of the repository, 
> we're
> just asking for repository corruption.

Any solution that doesn't require me to start a fresh repo on my side 
would be acceptable (that was what I had to do to get it working).

-- Steve
msg203 (view) Author: tommy Date: 2005-12-12.12:05:58
One idea is to do like the --case-ok check, have a general
--unsafe-names-ok override and let darcs be rather restrictive
about what filenames it allows.
msg204 (view) Author: tommy Date: 2005-12-12.12:12:23
Sorry for not reading out my mails befor commenting.
My last suggestion was already proposed by cacoose.
msg205 (view) Author: droundy Date: 2005-12-12.13:11:45
On Sun, Dec 11, 2005 at 10:39:11PM +0000, Kannan Goundan wrote:
> Darcs already warns when a two file names only differ in case (which, I
> believe, is to ensure portability on Windows).  Maybe it should also warn
> when a file name contains characters that Windows wont accept?

Sounds like a good idea to me.
-- 
David Roundy
http://www.darcs.net
msg700 (view) Author: jch Date: 2006-06-07.21:50:19
> Maybe it should also warn when a file name contains characters that Windows
wont accept?

I vote against.  No objection to it being a non-default behaviour, though.
msg839 (view) Author: kowey Date: 2006-08-02.20:41:08
Another possibility might be to automatically rename such files and emit a
warning everytime there is a patch that affects it.  For example, Windows file
names can't start with aux, so we could automatically rename them _aux (when
under Windows).  If we do this inside of darcs's internal representation, this
would mean we'd be able to apply the offending patch, and future patches,
correctly to that file.
msg840 (view) Author: JamesBurgess Date: 2006-08-02.23:16:00
you need to not make files called "con" and "prn" as well
msg842 (view) Author: cakoose Date: 2006-08-03.01:05:41
The full list of what needs to be checked for is available from MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/naming_a_file.asp

I've attached some Haskell code that checks a given file name against those rules.
Attachments
msg5694 (view) Author: kowey Date: 2008-08-25.21:31:10
Folks, I think we should take this issue more seriously.

On http://bugs.darcs.net/issue1030, we've just discovered another repository
where darcs check goes wrong on Windows.  The culprit is a file named "Aux.hi",
apparently, "Aux" being one of those filenames like "COM" that Windows treats as
being special (and won't let you create).

Note also that darcs just reports that the filename already exists, which is
somewhat odd.

Any solutions?

It seems like what darcs could really use is a way of creating and keeping track
of alternative names for files it cannot create (this could help with the
case-sensitivity problem too).

I marked this as release critical for 2.0.3, which may not be very realistic. 
Maybe we could just warn about these bad filenames?  See cakoose's patch.
msg5695 (view) Author: kowey Date: 2008-08-25.21:39:21
Another idea here: could darcs check/repair treat these evil filenames as
corruption and automagically rename them with something that is highly unlikely
to occur in any repository?  Something like darcs-repair-crazy-windows-aux.hi
and darcs-repair-crazy-windows-com1 

Just a thought, likely a silly one.
msg5696 (view) Author: cakoose Date: 2008-08-26.06:46:47
Small update to my uploaded code.  Fixed a bug (was checking ">= 31" instead of
"> 31) and improved the error messages a little.

FWIW, I really like the idea of a warning (enabled by users setting the
"windows-compatible" option on their repo).
Attachments
msg5697 (view) Author: kowey Date: 2008-08-26.07:16:06
Kannan,

On Tue, Aug 26, 2008 at 06:46:50 -0000, Kannan Goundan wrote:
> Small update to my uploaded code.  Fixed a bug (was checking ">= 31" instead of
> "> 31) and improved the error messages a little.

Could you submit this as a patch to the darcs darcs repository.  I'm not
asking you to actually integrate into the darcs code (although it would
be great if you did!), but just to dump it into src/
msg5698 (view) Author: kowey Date: 2008-08-26.07:25:30
I forgot to say: Thanks, Kannan! :-)

Also, I recommend that these behaviours be implemented for darcs 2.0.3:
- check for silly filenames on darcs record
- warn about silly filenames in darcs check (but don't do anything about)

I suppose the same warning can be used for record and check, something like
"Warning: the filename foo/bar/com42 may cause darcs to fail on Windows because
com is a reserved device name."

I'm not sure what to call the windows equivalent to --case-ok.  --windows-ok
sounds like the opposite of what we mean.  Also, I vote that checking for these
in darcs record be the default behaviour because like it or not, people actually
do use Windows and people on Windows do interact with people that don't.
History
Date User Action Args
2005-12-10 21:15:33systemcreate
2005-12-11 13:10:12droundysetstatus: unread -> unknown
nosy: droundy, tommy, system
messages: + msg199
2005-12-11 22:39:11cakoosesetnosy: + cakoose
messages: + msg201
2005-12-12 03:11:08stevesetnosy: + steve
messages: + msg202
2005-12-12 12:05:58tommysetnosy: droundy, tommy, cakoose, steve, system
messages: + msg203
2005-12-12 12:12:23tommysetnosy: droundy, tommy, cakoose, steve, system
messages: + msg204
2005-12-12 13:11:46droundysetnosy: droundy, tommy, cakoose, steve, system
messages: + msg205
2006-06-07 21:50:20jchsetpriority: bug -> wishlist
topic: + Windows
messages: + msg700
nosy: + wglozer, eivuokko, jch
2006-08-02 20:41:12koweysetnosy: + kowey
messages: + msg839
2006-08-02 23:16:04JamesBurgesssetnosy: + JamesBurgess
messages: + msg840
2006-08-03 01:05:45cakoosesetfiles: + CheckWindowsFileName.hs
nosy: droundy, jch, tommy, kowey, wglozer, eivuokko, cakoose, steve, system, JamesBurgess
messages: + msg842
2008-02-07 05:07:31markstossetstatus: unknown -> deferred
nosy: + beschmi
title: windows file name errors -> wish: windows file name errors
2008-05-13 14:31:57koweysetstatus: deferred -> has-patch
nosy: + dagit
2008-08-18 15:06:23koweysetstatus: has-patch -> needs-reproduction
nosy: droundy, jch, tommy, beschmi, kowey, wglozer, eivuokko, cakoose, steve, dagit, system, JamesBurgess
2008-08-25 21:26:47koweylinkissue1030 superseder
2008-08-25 21:31:15koweysetstatus: needs-reproduction -> unknown
priority: wishlist -> bug
title: wish: windows file name errors -> darcs does not detect silly Windows filename errors
nosy: + simonpj, jaredj
messages: + msg5694
topic: + Target-2.1
2008-08-25 21:39:23koweysetnosy: droundy, jch, tommy, beschmi, kowey, wglozer, eivuokko, cakoose, steve, dagit, system, simonpj, JamesBurgess, jaredj
messages: + msg5695
2008-08-26 06:46:49cakoosesetfiles: + CheckWindowsFileName2.hs
nosy: droundy, jch, tommy, beschmi, kowey, wglozer, eivuokko, cakoose, steve, dagit, system, simonpj, JamesBurgess, jaredj
messages: + msg5696
2008-08-26 07:16:08koweysetnosy: droundy, jch, tommy, beschmi, kowey, wglozer, eivuokko, cakoose, steve, dagit, system, simonpj, JamesBurgess, jaredj
messages: + msg5697
2008-08-26 07:25:33koweysetnosy: droundy, jch, tommy, beschmi, kowey, wglozer, eivuokko, cakoose, steve, dagit, system, simonpj, JamesBurgess, jaredj
messages: + msg5698
2008-10-07 14:47:39droundysetstatus: unknown -> resolved-in-unstable
nosy: + dmitry.kurochkin, simon, thorkilnaur
2009-04-22 03:27:37twbsetstatus: resolved-in-unstable -> resolved
nosy: droundy, jch, tommy, beschmi, kowey, wglozer, eivuokko, cakoose, steve, dagit, system, simonpj, JamesBurgess, simon, thorkilnaur, jaredj, dmitry.kurochkin
2009-08-06 17:41:39adminsetnosy: + markstos, jast, Serware, darcs-devel, zooko, mornfall, - droundy, jch, wglozer, eivuokko, cakoose, steve, system, simonpj, JamesBurgess, jaredj
2009-08-06 20:47:10adminsetnosy: - beschmi
2009-08-10 22:08:37adminsetnosy: + cakoose, wglozer, eivuokko, steve, system, jch, simonpj, JamesBurgess, jaredj, - markstos, darcs-devel, zooko, jast, Serware, mornfall
2009-08-11 00:02:33adminsetnosy: - dagit
2009-08-25 17:30:30adminsetnosy: + darcs-devel, - simon
2009-08-27 14:17:53adminsetnosy: jch, tommy, kowey, wglozer, darcs-devel, eivuokko, cakoose, steve, system, simonpj, JamesBurgess, thorkilnaur, jaredj, dmitry.kurochkin
2009-10-24 09:09:50adminsetnosy: + markstos, - system
2010-06-15 21:48:06adminsetmilestone: 2.1.x
2010-06-15 21:48:07adminsettopic: - Target-2.1
nosy: + kirby