After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 670431 - shut up libsoup runtime warning
shut up libsoup runtime warning
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: General
3.3.x
Other Linux
: Normal normal
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-02-20 09:15 UTC by Diego Escalante Urrelo (not reading bugmail)
Modified: 2012-02-24 19:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ephy-profile-utils: update for SoupURI API change (1.01 KB, patch)
2012-02-20 09:16 UTC, Diego Escalante Urrelo (not reading bugmail)
reviewed Details | Review

Description Diego Escalante Urrelo (not reading bugmail) 2012-02-20 09:15:56 UTC
libsoup-WARNING **: (soup-uri.c:1017):soup_uri_set_path: runtime check failed: (path != NULL)


Thread 1 (Thread 0xb3d3f890 (LWP 3715))

  • #0 g_logv
    at gmessages.c line 765
  • #1 g_log
    at gmessages.c line 792
  • #2 g_warn_message
    at gmessages.c line 825
  • #3 soup_uri_set_path
    at soup-uri.c line 1017
  • #4 normalize_and_prepare_uri
    at ephy-profile-utils.c line 102
  • #5 _ephy_profile_utils_query_form_auth_data
    at ephy-profile-utils.c line 171
  • #6 pre_fill_form
    at ephy-web-view.c line 910
  • #7 _ephy_web_view_hook_into_forms
    at ephy-web-view.c line 958
  • #8 load_status_cb
    at ephy-web-view.c line 1918

Comment 1 Diego Escalante Urrelo (not reading bugmail) 2012-02-20 09:16:16 UTC
Created attachment 208029 [details] [review]
ephy-profile-utils: update for SoupURI API change

soup_uri_set_path does not like NULL as an argument anymore. It still
works but will print a runtime warning. Use an empty string instead: "".
Comment 2 Dan Winship 2012-02-20 14:45:15 UTC
Comment on attachment 208029 [details] [review]
ephy-profile-utils: update for SoupURI API change

yes, that's correct
Comment 3 Sergio Villar 2012-02-23 17:36:46 UTC
Actually I think the right patch would be:

-  soup_uri_set_path (uri, NULL);
+  soup_uri_set_path (uri, "/");

as this is how all my old passwords were stored by epy in previous versions. Even with Diego's patch, current code would not be able to use user stored passwords, something that looks like a huge regression to me.
Comment 4 Xan Lopez 2012-02-24 11:16:40 UTC
(In reply to comment #3)
> Actually I think the right patch would be:
> 
> -  soup_uri_set_path (uri, NULL);
> +  soup_uri_set_path (uri, "/");
> 
> as this is how all my old passwords were stored by epy in previous versions.

You mean libsoup used to add "/" when NULL was passed before?
Comment 5 Sergio Villar 2012-02-24 11:45:37 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > Actually I think the right patch would be:
> > 
> > -  soup_uri_set_path (uri, NULL);
> > +  soup_uri_set_path (uri, "/");
> > 
> > as this is how all my old passwords were stored by epy in previous versions.
> 
> You mean libsoup used to add "/" when NULL was passed before?

No, what I mean is that all HTTP(S) uris created with soup_uri_new will have a path equal to "/" if none provided.

I don't know the epy details but it looks like all my previous credentials where stored in the keyring using "/" as the path for the uri, no mather if the path was "/whatever/path" or none at all. So I guess epy was the one changing the actual URI path to "/" but as I said I haven't skimmed through the history.
Comment 6 Diego Escalante Urrelo (not reading bugmail) 2012-02-24 19:06:30 UTC
This is what happens:

soup_uri_to_string appends a '/' as path if there is no path but there are query or fragment parts.
Which means that any SoupURI with ->path NULL will get a '/' path when it needs to.

Also, libsoup's 6a8814e232f4c1e8f1bc4bf31f6899c1968dfe5e added a check for non NULL path.
(the g_return_if_fail was added in a previous commit 675979d4aa6a72d8415294f989aeb20a6eae2ab6, which ended up needing this fixup)

So, it should be ok to set_path to "", do not set it at all, or use "/". Even NULL is ok, but it prints a warning.

 soup_uri_set_path (SoupURI *uri, const char *path)
 {
        g_return_if_fail (uri != NULL);
-       g_return_if_fail (path != NULL);
+
+       /* We allow a NULL path for compatibility, but warn about it. */
+       if (!path) {
+               g_warn_if_fail (path != NULL);
+               path = "";
+       }
 
        g_free (uri->path);
        uri->path = g_strdup (path);

char *
soup_uri_to_string (SoupURI *uri, gboolean just_path_and_query)
{
        GString *str;
        char *return_result;

        g_return_val_if_fail (uri != NULL, NULL);
        g_warn_if_fail (SOUP_URI_IS_VALID (uri));

        str = g_string_sized_new (20);

        if (uri->scheme && !just_path_and_query)
                g_string_append_printf (str, "%s:", uri->scheme);
        if (uri->host && !just_path_and_query) {
                g_string_append (str, "//");
                if (uri->user) {
                        append_uri_encoded (str, uri->user, ":;@?/");
                        g_string_append_c (str, '@');
                }
                if (strchr (uri->host, ':')) {
                        g_string_append_c (str, '[');
                        g_string_append (str, uri->host);
                        g_string_append_c (str, ']');
                } else
                        append_uri_encoded (str, uri->host, ":/");
                if (uri->port && uri->port != soup_scheme_default_port (uri->scheme))
                        g_string_append_printf (str, ":%u", uri->port);
                if (!uri->path && (uri->query || uri->fragment))
                        g_string_append_c (str, '/');
        }

        if (uri->path && *uri->path)
                g_string_append (str, uri->path);

        if (uri->query) {
                g_string_append_c (str, '?');
                g_string_append (str, uri->query);
        }
        if (uri->fragment && !just_path_and_query) {
                g_string_append_c (str, '#');
                g_string_append (str, uri->fragment);
        }

        return_result = str->str;
        g_string_free (str, FALSE);

        return return_result;
}
Comment 7 Dan Winship 2012-02-24 19:10:17 UTC
setting it to "" is ok to shut up the warning, but since it results in different output from soup_uri_to_string(), it breaks saved passwords, as Sergio noted. So yeah, you want "/"
Comment 8 Sergio Villar 2012-02-24 19:12:41 UTC
Sorry I forgot to close this. Xan asked me to commit the set_path("/") version some hours ago.

Fixed in 62df9fbfc122699b421e541828d1b6dfd259269f