[darcs-users] [patch258] Bug fix: treat filenames in darcs-2 patc... (and 1 more)

Reinier Lamers bugs at darcs.net
Fri Jun 18 21:32:05 UTC 2010


Reinier Lamers <tux_rocker at reinier.de> added the comment:

Hi,

These patches are ready to go in, except the "export LC_ALL=..." issue. See 
below for more explanation.

>New patches:

The two non-test patches indeed haven't changed so I'll skip those.

>[Slightly more aggresive and extendable issue1763 test.
>Eric Kow <kowey at darcs.net>**20100615131544
> Ignore-this: 797a11b3575fe4062e1a280f432e6d40
>] hunk ./tests/issue1763-pull-fails-on-non-ascii-filenames.sh 30
>
> . lib
>
>-abort_windows
>+abort_windows # FIXME! We should figure out what's going on here

I don't like such comments, but then, we have to hint somewhere that there's 
not really a good reason why this shouldn't work on Windows. Making a ticket 
clutters the issue tracker, so we make such a comment.

The reason that it clutters the issue tracker is that it'll never get done 
anyway. We really need some Windows serfs to obey the Windows Czar :).


>hunk ./tests/issue1763-pull-fails-on-non-ascii-filenames.sh 34
>-darcs init --repo S
>+
>+function check_consistent_filename {
>+  export LC_ALL='en.UTF8'
>+  count=`darcs changes -v | grep 'hunk .*\.lisp' | sed -e 's/.*hunk //' -e
> 's/.lisp.*//' | sort | uniq | wc -l`
> +  test $count -eq 1
>+}
>

This functions checks if there is only one representation in the output of 
'darcs changes'. The idea is that if there are multiple ones, it must be an 
encoding problem (like one well-encoded and one double-encoded with UTF-8).

It has a problem, however, in that the locale "en.UTF8" is very unlikely to 
exist. "en_US.UTF8" does exist and is the default on most Linux distros, but I 
don't think that it is actually required to be present. And then there are 
also operating systems that aren't Linux distros at all. Do we have to change 
locale at all? The file names should be equal, no matter what the locale is, 
shouldn't they?

> # Set up a repo with 3 patches to a non-ASCII-named file
> cd R
>hunk ./tests/issue1763-pull-fails-on-non-ascii-filenames.sh 48
> darcs record -a -m "Add"
> echo hi >> kitöltés.lisp
> darcs record -a -m "First edit"
>+cd ..
>+
>+rm -rf S S2 S3
>+darcs get R S
>+darcs get R S2
>+darcs get R S3
>+
>+cd R
> echo hi >> kitöltés.lisp
> darcs record -a -m "Second edit"

So yeah, we make three copies of a repo with 2 patches and then make a third 
patch in the original.

>hunk ./tests/issue1763-pull-fails-on-non-ascii-filenames.sh 58
>+cd ..
>
> # From another repo, pull the first two, edit, pull the third to get a
> # conflict, pull again to get the crash

>hunk ./tests/issue1763-pull-fails-on-non-ascii-filenames.sh 62
>-cd ../S
>-echo yyn | darcs pull --interactive ../R
>+cd S
> echo hello >> kitöltés.lisp
> darcs record -a -m "My edit"
> darcs pull -a ../R
>hunk ./tests/issue1763-pull-fails-on-non-ascii-filenames.sh 67
> darcs pull -a ../R
>+check_consistent_filename
>+cd ..
>

Adding check_consistent_filename shouldn't be necessary because the earlier 
case actually crashed darcs in case something was wrong. But it doesn't hurt 
either.

>hunk ./tests/issue1763-pull-fails-on-non-ascii-filenames.sh 70
>+# duplicates
>+cd S2
>+echo hi >> kitöltés.lisp
>+darcs record -a -m "My duplicate edit"
>+darcs pull -a ../R
>+darcs pull -a ../R
>+check_consistent_filename
>+cd ..

This checks duplicate patches. This test indeed fails without the functional 
changes and succeeds with them.

Reinier

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/patch258>
__________________________________


More information about the darcs-users mailing list