<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Martin Pool escreveu:
<blockquote
 cite="mide01316480707311440p3c4aabaekadcf137051b26c77@mail.gmail.com"
 type="cite">
  <pre wrap="">On 7/31/07, Fabio Machado de Oliveira <a class="moz-txt-link-rfc2396E" href="mailto:absfabio@terra.com.br">&lt;absfabio@terra.com.br&gt;</a> wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">I put a try/except for bzr to ignore files that have filenames
containing characters invalid to the filesystem encoding, instead of
generating a bug report.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Hi Fabio,

Thanks, that sounds like a really useful fix, I'm very happy to see
it.  I do think in general that we want to be skipping over
untouchable files rather than failing.  There are probably some other
places that need an analogous fix.

I have two bits of feedback on this patch:

You should be using trace.warn rather than printing directly to stderr.

Also, we really need a test for this to make sure that it doesn't
regress in future.  To test this we need to be able to create a file
with an invalid name.  In some encodings (like iso-8859-1) there are
no invalid filenames since any combination of bytes can be
interpreted.  In ascii and utf-8 we can do it - I suspect '\xff\xff'
will be invalid everywhere.  The best thing is probably to check
whether that string can be decoded in osutils._fs_enc.  If it *can*
be, skip the test.  Otherwise, create a file and try to version the
directory.

Now this probably should be a workingtree_implementation test, so that
it will be checked on all formats.  However, it will probably fail on
some old formats, and it's probably not worth fixing them.  So I'd
probably just check the format and if it's one of the old ones, skip
the test.

This is one of those unfortunate cases where testing something
automatically seems much harder than just manually verifying it once.
But especially for environment-specific things like encoding it is
important that we have one to keep up the level of quality we want.

  </pre>
</blockquote>
I dont know how to write a new test to bazaar. I was able to create an
invalid file this way:<br>
<br>
In VIM, i setted the fileencoding to windows 1252 ( :set
fileencoding=windows-1252 ), and wrote an script like "echo test &gt;
&oacute;&oacute;&oacute;.txt". The script created an &oacute;&oacute;&oacute;.txt file with an windows-1252
encoding that made bzr status to fail. os.listdir returned this name
for it: '\xf3\xe9\xed.txt'<br>
<br>
The bzr.dev changed and the problem changed its place, so I changed
that patch to working_tree.extras()
</body>
</html>