libimobiledevice / libplist

A library to handle Apple Property List format in binary or XML
https://libimobiledevice.org
GNU Lesser General Public License v2.1
528 stars 304 forks source link

[Bug] plistutil cannot read from stdin - ERROR: Could not parse plist data (-3) #254

Open mast3rz3ro opened 5 months ago

mast3rz3ro commented 5 months ago

Hi there,

The read from stdin seems to be broken when libplist are compiled with MINGW64 ! compiling with MSYS2 seems to solve this issue but I would like to get this working with MINGW64 and MINGW32 if possible. because it's will allow to build it without depending on msys-2.0.dll.

Please note that the MSYS2 comes with many different interfaces, e.g MSYS2 and MINGW64 each one has different environments.

The output i got when running the version compiled by MINGW64:

$ cat temp.plist | plistutil.exe -i -
$ ERROR: Could not parse plist data, expected XML or binary plist

$ cat temp.plist | plistutil.exe -p -
$ ERROR: Could not parse plist data (-3)

$ ldd /mingw64/bin/plistutil.exe
        ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x76f30000)
        kernel32.dll => /c/Windows/system32/kernel32.dll (0x76d10000)
        KERNELBASE.dll => /c/Windows/system32/KERNELBASE.dll (0x7fefcc60000)
        libplist-2.0.dll => /mingw64/bin/libplist-2.0.dll (0x7feef210000)
        msvcrt.dll => /c/Windows/system32/msvcrt.dll (0x7fefd2e0000)

$ ./plistutil.exe -v
plistutil 2.3.0-28-g3daee60

The output when compiled with MSYS2:

It's even runs in microsoft's cmd:
> type temp.plist | plistutil.exe -p -

$ ldd /usr/bin/plistutil.exe
        ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x76f30000)
        kernel32.dll => /c/Windows/system32/kernel32.dll (0x76d10000)
        KERNELBASE.dll => /c/Windows/system32/KERNELBASE.dll (0x7fefcc60000)
        msys-plist-2.0-4.dll => /usr/bin/msys-plist-2.0-4.dll (0x4b98e0000)
        msys-2.0.dll => /usr/bin/msys-2.0.dll (0x180040000)

$ ./tools/plistutil.exe -v
plistutil 2.3.0-28-g3daee60

Thank you for everything !