GNOME Bugzilla – Bug 752808
validate:launcher: unquote the path to support valgrind log file path
Last modified: 2015-10-02 15:45:40 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
Created attachment 308054 [details] [review] unquote path to support valgrind log file
How did you end up with a quoted file?
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.
Created attachment 308708 [details] [review] unquote path to support valgrind log file rebasing the patch
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.
You should check why you had quoted paths
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.
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
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..
Where is path2url called for the valgrind supp files? And why is it done?
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..
It does: vglogsfile = self.logfile + '.valgrind' And there I do not see logfile being ever a uri
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...
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 :)
Review of attachment 308893 [details] [review]: Looks good.
ping :)
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