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 752808 - validate:launcher: unquote the path to support valgrind log file path
validate:launcher: unquote the path to support valgrind log file path
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-devtools
git master
Other Linux
: Normal normal
: 1.7.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-07-24 07:00 UTC by Vineeth
Modified: 2015-10-02 15:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
unquote path to support valgrind log file (1.95 KB, patch)
2015-07-24 07:03 UTC, Vineeth
none Details | Review
unquote path to support valgrind log file (1.99 KB, patch)
2015-08-03 23:47 UTC, Vineeth
none Details | Review
fix uri/file paths by doing urllib.unquote and adding double quotes. (3.78 KB, patch)
2015-08-07 06:40 UTC, Vineeth
none Details | Review
fix class name for media-check (2.42 KB, patch)
2015-08-07 12:42 UTC, Vineeth
committed Details | Review

Description Vineeth 2015-07-24 07:00:55 UTC
Valgrind is not supporting quoted file paths. So we should unquote the file path
and pass it in double quotes. Since making only valgrind logs as unquoted, there will be mismatch with other log file names. So unquoting for all log files to maintain consistency
Comment 1 Vineeth 2015-07-24 07:03:46 UTC
Created attachment 308054 [details] [review]
unquote path to support valgrind log file
Comment 2 Guillaume Desmottes 2015-07-24 14:32:57 UTC
How did you end up with a quoted file?
Comment 3 Vineeth 2015-07-27 00:12:59 UTC
path2url function is quoting the file name, by using urllib.pathname2url(path)

which converts spaces to %20, and similarly for other special characters.
but valgrind does not support these characters.
Comment 4 Vineeth 2015-08-03 23:47:58 UTC
Created attachment 308708 [details] [review]
unquote path to support valgrind log file

rebasing the patch
Comment 5 Tim-Philipp Müller 2015-08-04 08:15:21 UTC
Comment on attachment 308708 [details] [review]
unquote path to support valgrind log file

Regarding the commit message: There is no such thing as a 'quoted file path' really. This concept only exists for URIs. So the problem is not that valgrind doesn't support it somehow, but that the wrong thing is being passed to it and/or the shell. On *nix systems, file paths are just a bunch of bytes.
Comment 6 Thibault Saunier 2015-08-04 12:49:47 UTC
You should check why you had quoted paths
Comment 7 Vineeth 2015-08-07 06:40:59 UTC
Created attachment 308876 [details] [review]
fix uri/file paths by doing urllib.unquote and adding double quotes.

urllib.pathname2url(path) used in path2url is replacing the special characters in the url with %xx escape.

for example a file name of 1 2.mp3 is converted as 1%202.mp3

These escape characters are not being recognized by valgrind log file path and g_file_set_contents which is used to create media-info
Instead of unquoting the path wherever it is being used, 
unquoting it in path2url and adding double quotes '"' around the path to make sure the file path/uri is recognizable.
Comment 8 Thibault Saunier 2015-08-07 08:24:25 UTC
Review of attachment 308876 [details] [review]:

::: validate/launcher/utils.py
@@ -142,2 +142,2 @@
 def path2url(path):
-    return urlparse.urljoin('file:', urllib.pathname2url(path))
+    return urlparse.urljoin('file:', urllib.unquote(urllib.pathname2url(path)))

It is not correct to unquote the 'path' part of the url. The URL should be quoted.

@@ -149,3 @@
         if path[0] == '/':
             return path[1:]  # We need to remove the first '/' on windows
-    path = urllib.unquote(path)

Here it is correct to unquote
Comment 9 Vineeth 2015-08-07 08:36:57 UTC
If this way is not correct, then probably the previous patch was the correct way??

This is where quoting happens
And valgrind doesn't accept quoted files. So i had attached previous patch unquoting the same seperately..
Comment 10 Thibault Saunier 2015-08-07 08:43:48 UTC
Where is path2url called for the valgrind supp files? And why is it done?
Comment 11 Vineeth 2015-08-07 08:47:05 UTC
It is not for valgrind suppression files
It is for valgrind log files..
It uses the normal url and appends .valgrind files
In baseclasses.py, vgslogsfile is the location where the path is being set..
Comment 12 Thibault Saunier 2015-08-07 10:29:11 UTC
It does:

     vglogsfile = self.logfile + '.valgrind'

And there I do not see logfile being ever a uri
Comment 13 Vineeth 2015-08-07 12:33:34 UTC
probably i should have observed before...

but this problem is only with media_check scenario..
for a file named 2 2.mp3
this is the classnames created

validate.file.media_check.2%202_mp3
validate.file.playback.change_state_intensive.2 2_mp3
validate.file.playback.fast_forward.2 2_mp3


This is because in 
GstValidateMediaCheckTestsGenerator

classname is being created with uri("os.path.basename(uri)") instead of the path..

if i replace that with "os.path.basename(url2path(uri))" then it creates properly as 
validate.file.media_check.2 2_mp3



But we should add double quotes for the log file.. All other changes are not needed...
Comment 14 Vineeth 2015-08-07 12:42:33 UTC
Created attachment 308893 [details] [review]
fix class name for media-check

creating classname for media check after converting url to path.
Adding double quotes for valgrind logs to support special characters like space.

please review :)
Comment 15 Thibault Saunier 2015-08-07 19:01:11 UTC
Review of attachment 308893 [details] [review]:

Looks good.
Comment 16 Vineeth 2015-10-01 06:40:22 UTC
ping :)
Comment 17 Thibault Saunier 2015-10-02 15:45:40 UTC
commit e7b65fe5df4c24dca33445ab9105bf5b5c5865a5
Author: Vineeth T M <vineeth.tm@samsung.com>
Date:   Fri Aug 7 21:38:20 2015 +0900

    validate: launcher: Fix media_check class name and add double quotes for valgrind logs
    
    When creating the class names for media check, uri is being used,
    instead of the path. Hence converting the uri using uri2path and creating
    class name.
    Add double quotes for valgrind logs, to support special characters like space
    
    https://bugzilla.gnome.org/show_bug.cgi?id=752808