Menu

#810 GetParameters returns an incorrect result in some situation.

2.0 Series
closed-fixed
Scripting (211)
5
2008-10-10
2008-08-22
No

It seems that GetParameters function, which is shipped with NSIS 2.39 via FileFunc.nsh, will return an incorrect result in some special situation.

BASIC INFORMATION:
1. NSIS Version: 2.39 Release
2. Error Message: No, but i got an incorrect result.
4. Screenshot: No

REPRODUCE OF THIS BUG:
1. Get a copy of NSIS 2.39
2. Try to compile the ``example.nsi'' attachment
3. Place a output executable in a path which contains non-ascii (eg. Chinese, Japanese, Korean) characters
4. Double click on output executable, an you will get a character instead of *EMPTY*

Note: here is an example of path that contains Chinese character:
C:\桌面
(you might see strange character due to the limit of fonts or something else)

ANALYZE OF THE BUG:

On the 1427th line of FileFunc.nsh the code uses ``StrCmp $0 '' end -3'' to check whether the string comes to the end (reach '\0'). But it seems this code does not work correctly when $0 is an non-ascii character. And then later, the code jumps to line 1442 and push incorrect result to the stack.

SOLUTION:

Change the GetParameters function code to the version which i have rewritten. i have rewritten the code so that GetParameters will be capable of handling Chinese characters (and it should work with Japanese and Korean but i haven't tested it).

RELATED BUG:
https://sourceforge.net/tracker/index.php?func=detail&aid=2017066&group_id=151265&atid=780537

Regards,
__h.s.

Discussion

  • hobbyscripter

    hobbyscripter - 2008-08-22

    Logged In: YES
    user_id=1563331
    Originator: YES

    File Added: example.nsi

     
  • hobbyscripter

    hobbyscripter - 2008-08-22

    Example to reproduce the problem

     
  • hobbyscripter

    hobbyscripter - 2008-08-22

    Logged In: YES
    user_id=1563331
    Originator: YES

    File Added: FileFunc-patched.nsh

     
  • Nobody/Anonymous

    Logged In: NO

    OTHER RELATED BUG:

    BUG#1856414
    Bug#1852141

     
  • hobbyscripter

    hobbyscripter - 2008-09-07

    Logged In: YES
    user_id=1563331
    Originator: YES

    File Added: FileFunc-patched-v2.nsh

     
  • hobbyscripter

    hobbyscripter - 2008-09-07

    FileFunc.nsh which is patched (version 2)

     
  • hobbyscripter

    hobbyscripter - 2008-09-07

    Logged In: YES
    user_id=1563331
    Originator: YES

    File Added: FileFunc-patched-v2.nsh

     
  • hobbyscripter

    hobbyscripter - 2008-09-07

    New GetParameters function (version 2)

     
  • hobbyscripter

    hobbyscripter - 2008-09-07

    Logged In: YES
    user_id=1563331
    Originator: YES

    File Added: GetParameters-rewritten-v2.nsh

     
  • Amir Szekely

    Amir Szekely - 2008-10-10
    • assigned_to: nobody --> kichik
    • status: open --> closed-fixed
     
  • Amir Szekely

    Amir Szekely - 2008-10-10

    Thanks, fixed. I had to do some modifications to your code so it works like the old in some cases. I've built a stronger test suite for this purpose in FileFuncTest.nsi.

     

Log in to post a comment.