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 788452 - SoupCache: fix setting default value for cache dir
SoupCache: fix setting default value for cache dir
Status: RESOLVED FIXED
Product: libsoup
Classification: Core
Component: Misc
unspecified
Other All
: Normal normal
: ---
Assigned To: libsoup-maint@gnome.bugs
libsoup-maint@gnome.bugs
Depends on:
Blocks:
 
 
Reported: 2017-10-02 23:04 UTC by Cosimo Cecchi
Modified: 2017-10-04 18:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
SoupCache: fix setting default value for cache dir (2.45 KB, patch)
2017-10-02 23:04 UTC, Cosimo Cecchi
none Details | Review
SoupCache: fix setting default value for cache dir (3.02 KB, patch)
2017-10-03 20:54 UTC, Cosimo Cecchi
committed Details | Review

Description Cosimo Cecchi 2017-10-02 23:04:43 UTC
See attached patch.
Comment 1 Cosimo Cecchi 2017-10-02 23:04:46 UTC
Created attachment 360804 [details] [review]
SoupCache: fix setting default value for cache dir

The documentation mentions that a value of NULL can be used to let
SoupCache use its default, but code currently tries to call
g_file_test() on NULL in that case, which will cause a critical warning
to be generated.

Refactor how the cache dir default value is initialized to avoid that
issue.
Comment 2 Will Thompson 2017-10-03 08:49:40 UTC
Review of attachment 360804 [details] [review]:

FWIW this looks fine to me – neater and fixes the bug.
Comment 3 Dan Winship 2017-10-03 15:57:12 UTC
Comment on attachment 360804 [details] [review]
SoupCache: fix setting default value for cache dir

Hm... I never noticed that "feature" of the code. But the cache isn't safe for multiple processes to access at once, so no one should ever be using this.

I guess having a critical is bad, but can you at least also update the docs to say that people shouldn't use this feature? And maybe spew a g_warning if they do?
Comment 4 Cosimo Cecchi 2017-10-03 17:21:08 UTC
Dan, thanks for the review. Would it not make more sense to deprecate the SoupCache type/methods then? I would be happy to open a separate issue to track that, but I'm afraid that actually implementing the deprecation is more work than I wanted to do for this, which is really just a bugfix...
Comment 5 Dan Winship 2017-10-03 18:13:16 UTC
Deprecating the whole type just because of a bad default value is a little extreme. I guess we could deprecate that property and replace it with a nearly-identical one, but, whatever. Just document it for now.
Comment 6 Cosimo Cecchi 2017-10-03 20:49:41 UTC
Oh, I misunderstood what you meant by "no one should ever be using this" :-)
Unfortunately, the warning would not help either with my use case; some code ends up calling in the default constructor inside tests, which turn warnings into aborts.

I will definitely update the patch to change the docs too though.
Comment 7 Cosimo Cecchi 2017-10-03 20:54:36 UTC
Created attachment 360877 [details] [review]
SoupCache: fix setting default value for cache dir

--

Updated patch.
Comment 8 Cosimo Cecchi 2017-10-04 18:37:18 UTC
Thanks, pushed to master.

Attachment 360877 [details] pushed as 2f2681f - SoupCache: fix setting default value for cache dir