Re: g_file_read fails when running on a remote machine via ssh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10 February 2011 01:13, Jim George <jimgeorge@xxxxxxxxx> wrote:
> On Tue, Feb 8, 2011 at 11:11 PM, Tristan Van Berkom <tvb@xxxxxxxxx> wrote:
>> On Wed, Feb 9, 2011 at 4:19 AM, Jim George <jimgeorge@xxxxxxxxx> wrote:
>>> Hi all,
>>> In a larger GTK application that needs to do HTTP gets, I replaced use
>>> of cURL and some helper functions called "glibcurl" with GIO calls. I
>>> now face a strange problem that when the program runs locally,
>>> everything is fine, but when run over an SSH tunnel with X forwarding,
>>> the call to g_file_read fails, with a GError->message of "Operation
>>> not supported".
>>>
>>> To investigate this further, I wrote a small test program pasted below:
>>>
>>> #include <glib.h>
>>> #include <gio/gio.h>
>>> #include <stdio.h>
>>> #include <string.h>
>>>
>>> int main(int argc, char *argv[])
>>> {
>>>        char url[256] = "http://www.google.com";;
>>>        GFile *file;
>>>        GFileInputStream *istream;
>>>        GError *err = NULL;
>>>
>>>        if (argc > 1) {
>>>                strncpy(url, argv[1], 256);
>>>        }
>>>
>>>        printf("Opening %s\n", url);
>>>        file = g_file_new_for_uri(url);
>>>        istream = g_file_read(file, NULL, &err);
>>>
>>>        if (err != NULL) {
>>>                g_error("Could not open %s for reading: %s\n", url, err->message);
>>>                g_error_free(err);
>>>                return 1;
>>>        }
>>>
>>>        g_input_stream_close(G_INPUT_STREAM(istream), NULL, &err);
>>>        g_object_unref(file);
>>>
>>>        return 0;
>>> }
>>>
>>> I compiled this using: gcc -g -O0 `pkg-config --cflags --libs gio-2.0
>>> gtk+-2.0` -o test test.c
>>>
>>> Running ./test locally gives me the "Opening http://www.google.com";
>>> message, and a normal exit.
>>> When I run the program on a different machine, to which I have opened
>>> an ssh connection, I get this:
>>>
>>> Opening http://www.google.com
>>>
>>> ** ERROR **: Could not open http://www.google.com for reading:
>>> Operation not supported
>>>
>>> aborting...
>>> Aborted (core dumped)
>>>
>>> This matches the behavior on my main gtk program. As a test, the
>>> behavior of the test program is identical when trying to access a text
>>> file on one of our local web servers.
>>>
>>> I couldn't find much documentation on gfile and gio by way of a
>>> tutorial, so I'm pretty much feeling my way around right now. What am
>>> I doing wrong?
>>
>> I'm the wrong person to answer you directly about GIO, but I did
>> hear that the tls support is only very recently added to GIO.
>>
>> Check that you are indeed using the unstable and unreleased new
>> glib package that includes this support.
>>
>> Cheers,
>>         -Tristan
>>
>
> Hi Tristan,
> Sorry, I forgot to mention, first system (where I did the build and
> initial test that succeeded) is running Fedora 14, with gtk2 package
> version of 2.22.0, the second one from where I did the "ssh" runs
> Fedora 13, with gtk2 package version 2.20.1.
>
> I believe these versions do support http via GIO, what stumps me is
> why things should behave differently when I'm running my program
> remotely (over a pts), as opposed to running it locally (from tty).
> The connection to the webserver is still plain http, and should not be
> using TLS in both cases.
>
> Sequence of operations: log in locally on my F13 box, use ssh to
> connect to the F14 box and run the test program included in the
> previous email. In this case, I get an error message ("Operation not
> supported"). If I log in locally at the F14 box and run the same
> program, it works fine.

I know it is a bit obvious but are you sure you are running the ssh
command as the same user as when logged in.  ie you login to a shell
as you and then run the command, not just have the sshd run it for
you?

Cheers
Lex

>
> Thanks,
> -Jim
> _______________________________________________
> gtk-list mailing list
> gtk-list@xxxxxxxxx
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list



[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux