Package: nsis
Version: 3.03-2
Severity: low

--- Please enter the report below this line. ---

Nsis fails to create an installer file when presented a licese-data file that 
is ISO-8859 encoded. In the previous version, this worked.

If the file is encoded as ASCII or UTF-8, this error does not occur.


Exact error message from NSISOutput.log:

!insertmacro: MUI_PAGE_LICENSE
LicenseData: wchar_t conversion failed!
Error in macro MUI_PAGE_LICENSE on macroline 21
Error in script "/home/zing/tmp/incoming/cmake_nsis_wchar_t/build-mingw/
_CPack_Packages/win64/NSIS/project.nsi" on line 547 -- aborting creation 
process


Steps to reproduce:
0. Save attached files "CMakeLists.txt", "INSTALL-MESSAGE.txt" and 
"mingw64.toolchain" into a new directory

1. Run cmake and cpack to create an NSIS installer:
cmake -DCMAKE_TOOLCHAIN_FILE=mingw64.toolschain .
cpack

2. NSIS aborts with the error message given above




--- System information. ---
Architecture: 
Kernel:       Linux 4.15.0-2-amd64

Debian Release: buster/sid
  500 unstable        ftp.at.debian.org 

--- Package information. ---
Depends            (Version) | Installed
============================-+-=============
nsis-common      (>= 3.03-2) | 3.03-2
libc6              (>= 2.14) | 
libgcc1           (>= 1:3.0) | 
libstdc++6          (>= 5.2) | 
zlib1g          (>= 1:1.1.4) | 


Package's Recommends field is empty.

Suggests             (Version) | Installed
==============================-+-============
mingw-w64                      | 5.0.3-1
nsis-doc           (>= 3.03-2) | 
nsis-pluginapi     (>= 3.03-2) | 
wine                           | 3.0-1




cmake_minimum_required (VERSION 3.0.0)
project (NSISBug)

install(FILES "${CMAKE_SOURCE_DIR}/INSTALL-MESSAGE.txt" DESTINATION doc)

## installer support using cpack (this section should come last):
set(CPACK_PACKAGE_NAME "NSISBug")
#set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.txt")
#set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "NSISBug - demonstrate a bug with nsis 3.03-2")
#set(CPACK_PACKAGE_INSTALL_DIRECTORY "NSISBug")
## maybe find a more useful vendor name?
#set(CPACK_PACKAGE_VENDOR "NSISBug.sf.net")
#set(CPACK_PACKAGE_VERSION "1.6.0")
#set(CPACK_PACKAGE_VERSION_MAJOR "1")
#set(CPACK_PACKAGE_VERSION_MINOR "6")
#set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/INSTALL-MESSAGE.txt")

# allow user to add bin dir to path:
#set(CPACK_NSIS_MODIFY_PATH "ON")
include(CPack)
Copyright � 
## Cross compilation instructions:
#
# cmake -DCMAKE_TOOLCHAIN_FILE=../mingw64.toolchain -DCMAKE_BUILD_TYPE=Release -G Ninja ..
# ninja
# cpack -G NSIS64



# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Windows)

# which compilers to use for C and C++
SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)

# for ctest:
set(CMAKE_CROSSCOMPILING_EMULATOR wine64)

# static linking to avoid runtime dependency on mingw:
# Without this, the resulting executables would be smaller,
# but require mingw-w64 to be installed.
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
set(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc -static-libstdc++")

# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH  /usr/share/mingw-w64)

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search 
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# Run command: "/usr/bin/makensis" "/home/zing/tmp/incoming/cmake_nsis_wchar_t/build-mingw/_CPack_Packages/win64/NSIS/project.nsi"
# Output:
Processing config: /etc/nsisconf.nsh
Processing script file: "/home/zing/tmp/incoming/cmake_nsis_wchar_t/build-mingw/_CPack_Packages/win64/NSIS/project.nsi" (UTF8)
!insertmacro: select_NT_profile
Function: "select_NT_profile"
StrCmp "$ADD_TO_PATH_ALL_USERS" "1" equal=0, nonequal=environment_single
DetailPrint: "Selected environment for all users"
Push: all
Return
DetailPrint: "Selected environment for current user only."
Push: current
Return
FunctionEnd
!insertmacro: end of select_NT_profile
!insertmacro: select_NT_profile
Function: "un.select_NT_profile"
StrCmp "$ADD_TO_PATH_ALL_USERS" "1" equal=0, nonequal=environment_single
DetailPrint: "Selected environment for all users"
Push: all
Return
DetailPrint: "Selected environment for current user only."
Push: current
Return
FunctionEnd
!insertmacro: end of select_NT_profile
!define: "NT_current_env"="HKCU "Environment""
!define: "NT_all_env"="HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment""
!define: "WriteEnvStr_RegKey"="HKCU "Environment""
Function: "AddToPath"
Exch($0,0)
Push: $1
Push: $2
Push: $3
IfFileExists: "$0\*.*" ?  : AddToPath_done
ReadEnvStr: PATH->$1
StrLen $2 "$1"
IntCmp $2:0 equal=CheckPathLength_ShowPathWarning, < CheckPathLength_Done, > CheckPathLength_Done
MessageBox: 48: "Warning! PATH too long installer unable to modify PATH!"
Goto: AddToPath_done
Push: $1;
Push: $0;
Call "StrStr"
Pop: $2
StrCmp "$2" "" equal=, nonequal=AddToPath_done
Push: $1;
Push: $0\;
Call "StrStr"
Pop: $2
StrCmp "$2" "" equal=, nonequal=AddToPath_done
GetFullPathName: $0->$3 (1604998776)
Push: $1;
Push: $3;
Call "StrStr"
Pop: $2
StrCmp "$2" "" equal=, nonequal=AddToPath_done
Push: $1;
Push: $3\;
Call "StrStr"
Pop: $2
StrCmp "$2" "" equal=, nonequal=AddToPath_done
Call "IsNT"
Pop: $1
StrCmp "$1" "1" equal=AddToPath_NT, nonequal=
StrCpy $1 "$WINDIR" (2) ()
FileOpen: $1\autoexec.bat as a -> $1
FileSeek: fp=$1, ofs=-1, mode=END, output=
FileReadByte: $1->$2
IntCmp $2:26 equal=0, < +2, > +2
FileSeek: fp=$1, ofs=-1, mode=END, output=
FileWrite: 
SET PATH=%PATH%;$3
->$1
FileClose: $1
Goto: AddToPath_done
StrCmp "$ADD_TO_PATH_ALL_USERS" "1" equal=ReadAllKey, nonequal=
ReadRegStr $1 HKCU\Environment\PATH
Goto: DoTrim
ReadRegStr $1 HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PATH
StrCmp "$1" "" equal=AddToPath_NTdoIt, nonequal=
Push: $1
Call "Trim"
Pop: $1
StrCpy $0 "$1;$0" () ()
StrCmp "$ADD_TO_PATH_ALL_USERS" "1" equal=WriteAllKey, nonequal=
WriteRegExpandStr: HKCU\Environment\PATH=$0
Goto: DoSend
WriteRegExpandStr: HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PATH=$0
SendMessage: (timeout=5000)(0xFFFF,0x001A,0,STR:Environment)
Pop: $3
Pop: $2
Pop: $1
Pop: $0
FunctionEnd
Function: "un.RemoveFromPath"
Exch($0,0)
Push: $1
Push: $2
Push: $3
Push: $4
Push: $5
Push: $6
IntFmt: 26->$6 (fmt:%c)
Call "un.IsNT"
Pop: $1
StrCmp "$1" "1" equal=unRemoveFromPath_NT, nonequal=
StrCpy $1 "$WINDIR" (2) ()
FileOpen: $1\autoexec.bat as r -> $1
GetTempFileName -> $4
FileOpen: $4 as w -> $2
GetFullPathName: $0->$0 (1604998776)
StrCpy $0 "SET PATH=%PATH%;$0" () ()
Goto: unRemoveFromPath_dosLoop
FileRead: $1->$3 (max:)
StrCpy $5 "$3" (1) (-1)
StrCmp "$5" "$6" equal=0, nonequal=+2
StrCpy $3 "$3" (-1) ()
StrCmp "$3" "$0
" equal=unRemoveFromPath_dosLoopRemoveLine, nonequal=
StrCmp "$3" "$0
" equal=unRemoveFromPath_dosLoopRemoveLine, nonequal=
StrCmp "$3" "$0" equal=unRemoveFromPath_dosLoopRemoveLine, nonequal=
StrCmp "$3" "" equal=unRemoveFromPath_dosLoopEnd, nonequal=
FileWrite: $3->$2
Goto: unRemoveFromPath_dosLoop
Goto: unRemoveFromPath_dosLoop
FileClose: $2
FileClose: $1
StrCpy $1 "$WINDIR" (2) ()
Delete: "$1\autoexec.bat"
CopyFiles: (silent) "$4" -> "$1\autoexec.bat", size=0KB
Delete: "$4"
Goto: unRemoveFromPath_done
StrCmp "$ADD_TO_PATH_ALL_USERS" "1" equal=unReadAllKey, nonequal=
ReadRegStr $1 HKCU\Environment\PATH
Goto: unDoTrim
ReadRegStr $1 HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PATH
StrCpy $5 "$1" (1) (-1)
StrCmp "$5" ";" equal=+2, nonequal=
StrCpy $1 "$1;" () ()
Push: $1
Push: $0;
Call "un.StrStr"
Pop: $2
StrCmp "$2" "" equal=unRemoveFromPath_done, nonequal=
StrLen $3 "$0;"
StrLen $4 "$2"
StrCpy $5 "$1" (-$4) ()
StrCpy $6 "$2" () ($3)
StrCpy $3 "$5$6" () ()
StrCpy $5 "$3" (1) (-1)
StrCmp "$5" ";" equal=0, nonequal=+2
StrCpy $3 "$3" (-1) ()
StrCmp "$ADD_TO_PATH_ALL_USERS" "1" equal=unWriteAllKey, nonequal=
WriteRegExpandStr: HKCU\Environment\PATH=$3
Goto: unDoSend
WriteRegExpandStr: HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PATH=$3
SendMessage: (timeout=5000)(0xFFFF,0x001A,0,STR:Environment)
Pop: $6
Pop: $5
Pop: $4
Pop: $3
Pop: $2
Pop: $1
Pop: $0
FunctionEnd
!insertmacro: IsNT
Function: "IsNT"
Push: $0
ReadRegStr $0 HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentVersion
StrCmp "$0" "" equal=0, nonequal=IsNT_yes
Pop: $0
Push: 0
Return
Pop: $0
Push: 1
FunctionEnd
!insertmacro: end of IsNT
!insertmacro: IsNT
Function: "un.IsNT"
Push: $0
ReadRegStr $0 HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentVersion
StrCmp "$0" "" equal=0, nonequal=IsNT_yes
Pop: $0
Push: 0
Return
Pop: $0
Push: 1
FunctionEnd
!insertmacro: end of IsNT
!insertmacro: StrStr
Function: "StrStr"
Exch($R1,0)
Exch(st(1),0)
Exch($R2,0)
Push: $R3
Push: $R4
Push: $R5
StrLen $R3 "$R1"
StrCpy $R4 "0" () ()
StrCpy $R5 "$R2" ($R3) ($R4)
StrCmp "$R5" "$R1" equal=done, nonequal=
StrCmp "$R5" "" equal=done, nonequal=
IntOp: $R4=$R4+1
Goto: loop
StrCpy $R1 "$R2" () ($R4)
Pop: $R5
Pop: $R4
Pop: $R3
Pop: $R2
Exch($R1,0)
FunctionEnd
!insertmacro: end of StrStr
!insertmacro: StrStr
Function: "un.StrStr"
Exch($R1,0)
Exch(st(1),0)
Exch($R2,0)
Push: $R3
Push: $R4
Push: $R5
StrLen $R3 "$R1"
StrCpy $R4 "0" () ()
StrCpy $R5 "$R2" ($R3) ($R4)
StrCmp "$R5" "$R1" equal=done, nonequal=
StrCmp "$R5" "" equal=done, nonequal=
IntOp: $R4=$R4+1
Goto: loop
StrCpy $R1 "$R2" () ($R4)
Pop: $R5
Pop: $R4
Pop: $R3
Pop: $R2
Exch($R1,0)
FunctionEnd
!insertmacro: end of StrStr
Function: "Trim"
Exch($R1,0)
Push: $R2
StrCpy $R2 "$R1" (1) (-1)
StrCmp "$R2" " " equal=RTrim, nonequal=
StrCmp "$R2" "
" equal=RTrim, nonequal=
StrCmp "$R2" "
" equal=RTrim, nonequal=
StrCmp "$R2" ";" equal=RTrim, nonequal=
Goto: Done
StrCpy $R1 "$R1" (-1) ()
Goto: Loop
Pop: $R2
Exch($R1,0)
FunctionEnd
Function: "ConditionalAddToRegisty"
Pop: $0
Pop: $1
StrCmp "$0" "" equal=ConditionalAddToRegisty_EmptyString, nonequal=
WriteRegStr: SHCTX\Software\Microsoft\Windows\CurrentVersion\Uninstall\NSISBug 0.1.1\$1=$0
DetailPrint: "Set install registry entry: '$1' to '$0'"
FunctionEnd
!insertmacro: MUI_PAGE_WELCOME
!insertmacro: end of MUI_PAGE_WELCOME
!insertmacro: MUI_PAGE_LICENSE
LicenseData: wchar_t conversion failed!
Error in macro MUI_PAGE_LICENSE on macroline 21
Error in script "/home/zing/tmp/incoming/cmake_nsis_wchar_t/build-mingw/_CPack_Packages/win64/NSIS/project.nsi" on line 547 -- aborting creation process

Reply via email to