#82 Custom EXE fails with special chars in the wrapper's path

Wrapper
closed
doh123
Bug (44)
5
2012-04-21
2012-04-10
Syao
No

== Steps to reproduce: ==

- Create a wrapper with special chars in its path (for a 100% reproducible issue, just use a [string in square brackets] wherever in the wrapper's name or in its parent folders)
- Create a Custom EXE launcher pointing to your favorite windows executable within the wrapper (i.e. /Windows/notepad.exe)
- Launch the Custom EXE

== Expected results: ==
- The custom exe launcher should launch whatever executable you set

== Actual results: ==
- Nothing happens. An unhandled exception is thrown, as shown in the Console log:

2012-04-10 3:58:29.282 am Wineskin: *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSCFString substringToIndex:]: Range or index out of bounds'
*** Call stack at first throw:
(
0 CoreFoundation 0x92835b67 __raiseError + 231
1 libobjc.A.dylib 0x98d70149 objc_exception_throw + 155
2 CoreFoundation 0x9279d369 +[NSException raise:format:arguments:] + 137
3 CoreFoundation 0x9279d2d9 +[NSException raise:format:] + 57
4 Foundation 0x9c4ed134 -[NSString substringToIndex:] + 106
5 Wineskin 0x00003657 -[Wineskin mainRun:] + 4439
6 Wineskin 0x000125b9 main + 313
7 Wineskin 0x000024b5 start + 53
8 ??? 0x00000003 0x0 + 3
)

== Issue analysis: ==
After an analysis, the cause has been traced down to the following line in CustomEXE:

CEXENAME="${CEXENAME#${CEXENAME%/*}/}

When special characters are contained in the wrapper's path, the search string on the right side of the hash sign contains special characters, which are handled as such by the shell.

The solution I suggest involves using the 'basename' utility rather than the shell's string manipulation routines. See the attached patch.

Discussion

  • Syao
    Syao
    2012-04-10

    [PATCH] Made the CustomEXE launcher more resilient to special characters in the wrapper name

     
  • doh123
    doh123
    2012-04-12

    • assigned_to: nobody --> doh123
    • status: open --> pending
     
  • doh123
    doh123
    2012-04-12

    added to git
    author doh123 <doh123@doh123.com>
    Thu, 12 Apr 2012 00:51:52 +0000 (19:51 -0500)
    committer doh123 <doh123@doh123.com>
    Thu, 12 Apr 2012 00:51:52 +0000 (19:51 -0500)
    commit 39c0525cf874d6dfcbeb6e74219040f3780cbd3c
    tree a13fa4351ba5b4d83e20f117f5a56c1eb5e86c63
    parent 9c324a2746652895884d9ab905f241f1a2177267
    Made the CustomEXE launcher more resilient to special characters in the wrapper name

    even though i use "git patch" it still sticks my name on it since I'm the only one with write access... but I didn't modify your patch any.

     
  • doh123
    doh123
    2012-04-21

    • status: pending --> closed
     
  • doh123
    doh123
    2012-04-21

    released in Wineskin 2.5.5