View Issue Details

IDProjectCategoryView StatusLast Update
0002900GNUnetfile-sharing servicepublic2013-12-24 20:54
Reporterbratao Assigned ToLRN  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformW32OSWindowsOS Version8
Product VersionGit master 
Target Version0.10.0Fixed in Version0.10.0 
Summary0002900: gnunet-helper-fs-publish is not working with unicode names
Descriptiongnunet-helper-fs-publish is getting confused with unicode names .
I have a file called 01-Doid+Ășo.mp3 that do not work.

But this file work nice in extract.exe

I sent a (wrong) fix. But the right way should check why STAT is not working.
TagsNo tags attached.
Attached Files
gnunet-helper-fs-publish.c.patch (1,978 bytes)   
Index: src/fs/gnunet-helper-fs-publish.c
===================================================================
--- src/fs/gnunet-helper-fs-publish.c	(revision 27505)
+++ src/fs/gnunet-helper-fs-publish.c	(working copy)
@@ -287,15 +287,19 @@
   struct stat sbuf;
   uint64_t fsize = 0;
 
-  if ((0 != STAT (filename, &sbuf)) ||
+  char *utfFilename;
+  utfFilename =   GNUNET_STRINGS_to_utf8 (filename, strlen (filename), locale_charset ());
+
+
+  if ((0 != STAT (utfFilename, &sbuf)) ||
       ((!S_ISDIR (sbuf.st_mode)) && (GNUNET_OK != GNUNET_DISK_file_size (
-      filename, &fsize, GNUNET_NO, GNUNET_YES))))
+      utfFilename, &fsize, GNUNET_NO, GNUNET_YES))))
   {
     /* If the file doesn't exist (or is not stat-able for any other reason)
        skip it (but report it), but do continue. */
     if (GNUNET_OK !=
 	write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_SKIP_FILE,
-		       filename, strlen (filename) + 1))
+               filename, strlen (filename) + 1))
       return GNUNET_SYSERR;
     /* recoverable error, store 'NULL' in *dst */
     *dst = NULL;
@@ -307,7 +311,7 @@
       write_message (S_ISDIR (sbuf.st_mode) 
 		     ? GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_DIRECTORY
 		     : GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_FILE,
-		     filename, strlen (filename) + 1))
+             filename, strlen (filename) + 1))
     return GNUNET_SYSERR;
   item = GNUNET_malloc (sizeof (struct ScanTreeNode));
   item->filename = GNUNET_strdup (filename);
@@ -319,7 +323,7 @@
 
     rc.parent = item;
     rc.stop = GNUNET_NO;
-    GNUNET_DISK_directory_scan (filename, 
+    GNUNET_DISK_directory_scan (filename,
 				&scan_callback, 
 				&rc);    
     if ( (GNUNET_YES == rc.stop) ||
@@ -453,9 +457,7 @@
    * binary mode.
    */
   _setmode (1, _O_BINARY);
-  /* Get utf-8-encoded arguments */
-  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
-    return 5;
+
 #else
   ignore_sigpipe ();
 #endif
gnunet-helper-fs-publish.c.v2.patch (935 bytes)   
Index: src/fs/gnunet-helper-fs-publish.c
===================================================================
--- src/fs/gnunet-helper-fs-publish.c	(revision 27505)
+++ src/fs/gnunet-helper-fs-publish.c	(working copy)
@@ -348,6 +348,7 @@
   struct GNUNET_CONTAINER_MetaData *meta;
   ssize_t size;
   size_t slen;
+  char *localStr;
 
   if (GNUNET_YES == item->is_directory)
   {
@@ -364,7 +365,11 @@
   
   /* this is the expensive operation, *afterwards* we'll check for aborts */
   meta = GNUNET_CONTAINER_meta_data_create ();
-  EXTRACTOR_extract (plugins, item->filename, NULL, 0, &add_to_md, meta);
+
+  localStr = GNUNET_STRINGS_from_utf8 (item->filename, strlen (item->filename), locale_charset ());
+  EXTRACTOR_extract (plugins, localStr, NULL, 0, &add_to_md, meta);
+  GNUNET_free (localStr);
+
   slen = strlen (item->filename) + 1;
   size = GNUNET_CONTAINER_meta_data_get_serialized_size (meta);
   if (-1 == size)

Activities

bratao

2013-06-21 16:36

reporter   ~0007165

Well, The problem is not in STAT. The problem is that EXTRACTOR_datasource_create_from_file_ cant handle utf8 filenames.

bratao

2013-06-22 00:02

reporter   ~0007166

In the SVN the Plibfy pathes of LRN fixes this problem.

Issue History

Date Modified Username Field Change
2013-06-21 04:55 bratao New Issue
2013-06-21 04:55 bratao File Added: gnunet-helper-fs-publish.c.patch
2013-06-21 16:36 bratao Note Added: 0007165
2013-06-21 16:36 bratao File Added: gnunet-helper-fs-publish.c.v2.patch
2013-06-22 00:02 bratao Note Added: 0007166
2013-06-22 00:02 bratao Status new => resolved
2013-06-22 00:02 bratao Resolution open => fixed
2013-06-22 00:02 bratao Assigned To => bratao
2013-06-25 12:11 Christian Grothoff Assigned To bratao =>
2013-06-25 12:11 Christian Grothoff Fixed in Version => 0.10.0
2013-06-25 12:11 Christian Grothoff Target Version => 0.10.0
2013-07-08 20:33 Christian Grothoff Assigned To => LRN
2013-12-24 20:54 Christian Grothoff Status resolved => closed