[tahoe-dev] [tahoe-lafs] #534: "tahoe cp" command encoding issue

tahoe-lafs trac at allmydata.org
Tue Feb 17 10:02:10 PST 2009

#534: "tahoe cp" command encoding issue
     Reporter:  francois           |       Owner:             
         Type:  defect             |      Status:  reopened   
     Priority:  minor              |   Milestone:  undecided  
    Component:  code-frontend-cli  |     Version:  1.2.0      
   Resolution:                     |    Keywords:  cp encoding
Launchpad_bug:                     |  
Changes (by zooko):

 * cc: tahoe-dev@… (added)



 Thanks for the patch!  I'm glad that it adds a test of mkdir as well.

 Two things:  1.  We prefer functions which are stricter about their
 inputs, so could you change to_unicode() so that it raises an exception if
 the argument is not a str?  Like this:

 from util.assertutil import precondition

 def to_unicode(s):
     precondition(isinstance(s, str), s)

 2.  Could you please add some doc to CLI.txt explaining that it currently
 works only for utf-8 strings on argv or from the filesystem, and that it
 tries to detect if your filesystem is providing utf-8 and raise an
 exception if not.  Oh, and also there is a third thing:

 3.  What happens if I run a command-line like "tahoe cp A B" and
 sys.getdefaultencoding() returns something other than utf-8?  Do I see a
 Python backtrace on stdout?  Please make it so that this causes an
 explanatory "USAGE"-style string.

 Oh, and

 4.  Isn't sys.getdefaultencoding() just telling how the Python interpreter
 is configured, not the underlying operating system?  Oh, actually look:
 there is a "sys.getfilesystemencoding()":


 So I guess 4 is to use sys.getfilesystemencoding() instead of
 sys.getdefaultencoding() when trying to determine what encoding we get
 back from os.listdir(), and 5 is to document in CLI.txt the distinction
 between filesystem encoding and command-line-arguments encoding.

 Phewf.  Too bad this isn't easier.

 Thanks a lot for your help, François!



Ticket URL: <http://allmydata.org/trac/tahoe/ticket/534#comment:39>
tahoe-lafs <http://allmydata.org>
secure decentralized file storage grid

More information about the tahoe-dev mailing list