Bug 418638

Summary: spectacle: filename_test is unreliable
Product: [Applications] Spectacle Reporter: Andreas Sturmlechner <asturm>
Component: GeneralAssignee: Boudhayan Gupta <me>
Status: RESOLVED FIXED    
Severity: normal CC: kde
Priority: NOR    
Version: 19.12.3   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: build.log

Description Andreas Sturmlechner 2020-03-08 19:23:39 UTC
One in maybe 10 times, the test will fail to pass on some systems:

Start testing: Mar 08 20:13 CET
----------------------------------------------------------
1/1 Testing: filename_test
1/1 Test: filename_test
Command: "/var/tmp/portage/kde-apps/spectacle-19.12.3/work/spectacle-19.12.3_build/bin/filename_test"
Directory: /var/tmp/portage/kde-apps/spectacle-19.12.3/work/spectacle-19.12.3_build/tests
"filename_test" start time: Mar 08 20:13 CET
Output:
----------------------------------------------------------
********* Start testing of FilenameTest *********
Config: Using QtTest library 5.14.1, Qt 5.14.1 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 9.2.0)
PASS   : FilenameTest::initTestCase()
PASS   : FilenameTest::testStrings()
PASS   : FilenameTest::testDateTokens()
PASS   : FilenameTest::testWindowTitle()
QWARN  : FilenameTest::testNumbering() QString::contains: invalid QRegularExpression object
FAIL!  : FilenameTest::testNumbering() Compared values are not the same
   Loc: [/var/tmp/portage/kde-apps/spectacle-19.12.3/work/spectacle-19.12.3/tests/FilenameTest.cpp(82)]
PASS   : FilenameTest::testCombined()
PASS   : FilenameTest::cleanupTestCase()
Totals: 6 passed, 1 failed, 0 skipped, 0 blacklisted, 14ms
********* Finished testing of FilenameTest *********
<end of output>
Test time =   0.04 sec
----------------------------------------------------------
Test Failed.
"filename_test" end time: Mar 08 20:13 CET
"filename_test" time elapsed: 00:00:00
----------------------------------------------------------

End testing: Mar 08 20:13 CET


Operating System: Gentoo Linux 
KDE Plasma Version: 5.18.2
KDE Frameworks Version: 5.68.0
Qt Version: 5.14.1
Kernel Version: 5.3.11-gentoo
OS Type: 64-bit
Processors: 3 × AMD Athlon(tm) II X3 445 Processor
Memory: 3,8 GiB of RAM


Downstream report: https://bugs.gentoo.org/711664
Comment 1 Andreas Sturmlechner 2020-03-08 19:24:03 UTC
Created attachment 126676 [details]
build.log
Comment 2 David Redondo 2020-03-09 08:55:34 UTC
Yes I can reproduce will look into it
Comment 3 David Redondo 2020-03-09 10:06:20 UTC
Git commit 017cf99c7a5bdf30c4510af1533b04c73d760cc6 by David Redondo.
Committed on 09/03/2020 at 10:05.
Pushed by davidre into branch 'master'.

Escape filename before operating on it with regular expressions

If the filename contains characters that have special meaning they can cause
wrong behavior. This also caused the related test to fail in 1 of 10 times.

M  +3    -2    src/ExportManager.cpp

https://commits.kde.org/spectacle/017cf99c7a5bdf30c4510af1533b04c73d760cc6