Mime type woes in beagle
- From: Michael Levy <mlevy wardium homeip net>
- To: Dashboard <dashboard-hackers gnome org>
- Subject: Mime type woes in beagle
- Date: Sat, 12 Jun 2004 23:44:10 +0200
Hi all,
As you may know, I've been working on an implementation of
zip/gzip/bzip/tar file handling in beagle. The idea is to determine the
mime-type of the content (for zip and tar the idea is to get the mime
type of all the content). I was hoping to use the methods declared in
Util/gnome.cs. Unfortunately, I get some strange behaviour. I've written
a small test to demonstrate. The code is attached and can be compiled
with: mcs test.cs `pkg-config --libs gtk-sharp`
The program takes the names of the files provided on the command line
and determines their mime-types. If you provide a non-existing
file-name, the program starts 'looping' (for lack of a better term).
Calling strace shows that thee following occurs :
futex(0x411e73d4, FUTEX_WAIT, 136, {0, 99589000}) = -1 ETIMEDOUT \
(Connection timed out)
gettimeofday({1087075481, 121257}, NULL) = 0
gettimeofday({1087075481, 121387}, NULL) = 0
futex(0x411e73d4, FUTEX_WAIT, 137, {0, 99613000}) = -1 ETIMEDOUT \
(Connection timed out)
gettimeofday({1087075481, 231267}, NULL) = 0
gettimeofday({1087075481, 231400}, NULL) = 0
endlessly.
I guess my questions are:
- Am I missing something here?
- Is this expected behaviour?
- Shouldn't we be getting the default mime-type?
- If so, how do you suggest that we determine mime types (as the
gnome_vfs_* functions may not work out for us because we want to get
mime-types of files that aren't actually on the file system when they
are in 'archive' files).
I just noticed that it also starts to loop if you try :
mono test.exe /etc/passwd
with the same symptoms....This is getting stranger by the minute.
My system is a RedHat 9.0.
$ mcs --version
Mono C# compiler version 0.95.0.0
$ mono --version
Mono JIT compiler version 0.95, (C) 2002-2004 Novell, Inc and
$ rpm -qa | grep gnome-vfs2
gnome-vfs2-extras-0.99.11-1.ximian.6.2
gnome-vfs2-devel-2.5.3-0.ximian.6.2
gnome-vfs2-2.5.3-0.ximian.6.2
Any help would be greatly appreciated.
Mike
using System;
using System.Runtime.InteropServices;
public class Test {
[DllImport ("libgnomevfs-2")] extern static bool gnome_vfs_init ();
[DllImport ("libgnomevfs-2")] extern static string gnome_vfs_mime_type_from_name_or_default (string filename, string defaultv);
static int Main (String [] args)
{
gnome_vfs_init ();
foreach (String name in args) {
String mime = gnome_vfs_mime_type_from_name_or_default(name, "Don't know");
Console.WriteLine ("{0}\t{1}", name, mime);
}
return 0;
}
}
// Compile with :
// mcs test.cs `pkg-config --libs gtk-sharp`
//
// Run with (should work):
// mono test.exe test.cs
//
// Or to see "looping"
// mono test.exe noSuchFile
//
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]