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 752650 - validate:launcher: catch errors and continue
validate:launcher: catch errors and continue
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-devtools
git master
Other All
: Normal normal
: 1.5.90
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-07-21 01:39 UTC by Vineeth
Modified: 2015-08-16 13:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
catch errors and continue (1.82 KB, patch)
2015-07-21 01:41 UTC, Vineeth
none Details | Review
catch errors and continue (1.63 KB, patch)
2015-07-21 10:39 UTC, Vineeth
none Details | Review
catch errors and continue (1.63 KB, patch)
2015-07-21 10:41 UTC, Vineeth
none Details | Review
call escape to remove bad character range (1.20 KB, patch)
2015-07-21 23:46 UTC, Vineeth
committed Details | Review

Description Vineeth 2015-07-21 01:39:20 UTC
when the file name consists of invalid characters, it exits with exception Instead of exiting, print the error and continue executing the next scenario
Comment 1 Vineeth 2015-07-21 01:41:52 UTC
Created attachment 307790 [details] [review]
catch errors and continue
Comment 2 Thibault Saunier 2015-07-21 10:05:46 UTC
Review of attachment 307790 [details] [review]:

::: validate/launcher/baseclasses.py
@@ +35,3 @@
 from loggable import Loggable
 import xml.etree.cElementTree as ET
+import sre_compile

That would be

  from sre_compile import error

@@ +1376,3 @@
+                if re.findall("%s\..*\.%s$" % (mfile_bname, self.FILE_EXTENSION), f):
+                    scenarios.append(os.path.join(os.path.dirname(mfile), f))
+            except error, v:

What kind of error do you get?
Comment 3 Vineeth 2015-07-21 10:39:10 UTC
Created attachment 307819 [details] [review]
catch errors and continue

There was a file which was named in the format [A-B].mp3, which was throwing an error "bad character range".
Comment 4 Vineeth 2015-07-21 10:41:23 UTC
Created attachment 307820 [details] [review]
catch errors and continue

forgot to obsolete the previous patch..

for file name in the format [A-B].mp3, got the exception "bad character range", because of which it just exits without doing anything
Comment 5 Thibault Saunier 2015-07-21 11:12:57 UTC
(In reply to Vineeth from comment #4)
> Created attachment 307820 [details] [review] [review]
> catch errors and continue
> 
> forgot to obsolete the previous patch..
> 
> for file name in the format [A-B].mp3, got the exception "bad character
> range", because of which it just exits without doing anything

Then it sounds like the wrong solution, we should probably run probably escape those char to run the regex on or something
Comment 6 Vineeth 2015-07-21 12:55:25 UTC
did some experimentation with different file names.
It does not directly throw error for [a-b].mp3 format..

it is weird actually, the first digit should be greater than the second digit. but again it is not straight forward.

[2-2].mp3 ok
[2-1].mp3 not ok
[20-1].mp3 ok
[21-1].mp3 ok
[22-1].mp3 not ok


so this might actually be some problem with how re.findall is implemented.
Not sure what character to escape here.

And even if we remove some characters and pass, the check in the above patch might be useful, because right now, it just stops executing after an error.
Comment 7 Thibault Saunier 2015-07-21 13:12:55 UTC
should be something like:

  re.findall("%s\..*\.%s$" % (re.escape(mfile_bname), self.FILE_EXTENSION), f):
Comment 8 Vineeth 2015-07-21 23:46:25 UTC
Created attachment 307876 [details] [review]
call escape to remove bad character range
Comment 9 Thibault Saunier 2015-07-23 10:20:20 UTC
Review of attachment 307876 [details] [review]:

Yop
Comment 10 Nicolas Dufresne (ndufresne) 2015-08-05 21:11:52 UTC
Comment on attachment 307876 [details] [review]
call escape to remove bad character range

commit 94c684d4010032947a29a1d0901f1f5014afe500
Author: Vineeth TM <vineeth.tm@samsung.com>
Date:   Wed Jul 22 08:45:26 2015 +0900

    validate:launcher: escape the characters to remove bad range in regex
    
    When media file name consists of some special characters of the format
    [b-a].mp3, then it fails with 'bad character range' error and exits.
    call re.escape to escape the characters before using it in findall
    
    https://bugzilla.gnome.org/show_bug.cgi?id=752650