Code Monkey home page Code Monkey logo

libplist's Introduction

libimobiledevice

A library to communicate with services on iOS devices using native protocols.

Features

libimobiledevice is a cross-platform software library that talks the protocols to interact with iOS devices.

Unlike other projects, it does not depend on using any existing proprietary libraries and does not require jailbreaking.

Some key features are:

  • Interface: Implements many high-level interfaces for device services
  • Implementation: Object oriented architecture and service abstraction layer
  • Cross-Platform: Tested on Linux, macOS, Windows and Android platforms
  • Utilities: Provides various command-line utilities for device services
  • SSL: Allows choosing between OpenSSL, GnuTLS, or MbedTLS to handle SSL communication
  • Network: Supports network connections with "WiFi sync" enabled devices
  • Python: Provides Cython based bindings for Python

The implemented interfaces of many device service protocols allow applications to:

  • Access filesystem of a device
  • Access documents of file sharing apps
  • Retrieve information about a device and modify various settings
  • Backup and restore the device in a native way compatible with iTunes
  • Manage app icons arrangement on the device
  • Install, remove, list and basically manage apps
  • Activate a device using official servers
  • Manage contacts, calendars, notes and bookmarks
  • Retrieve and remove crashreports
  • Retrieve various diagnostics information
  • Establish a debug connection for app debugging
  • Mount filesystem images
  • Forward device notifications
  • Manage device provisioning
  • Take screenshots from the device screen (requires mounted developer image)
  • Simulate changed geolocation of the device (requires mounted developer image)
  • Relay the syslog of the device
  • Expose a connection for WebKit remote debugging

... and much more.

The library is in development since August 2007 with the goal to bring support for these devices to the Linux Desktop.

Installation / Getting started

Debian / Ubuntu Linux

First install all required dependencies and build tools:

sudo apt-get install \
	build-essential \
	pkg-config \
	checkinstall \
	git \
	autoconf \
	automake \
	libtool-bin \
	libplist-dev \
	libusbmuxd-dev \
	libimobiledevice-glue-dev \
	libssl-dev \
	usbmuxd

If you want to optionally build the documentation or Python bindings use:

sudo apt-get install \
	doxygen \
	cython

Then clone the actual project repository:

git clone https://github.com/libimobiledevice/libimobiledevice.git
cd libimobiledevice

Now you can build and install it:

./autogen.sh
make
sudo make install

If you require a custom prefix or other option being passed to ./configure you can pass them directly to ./autogen.sh like this:

./autogen.sh --prefix=/opt/local --enable-debug
make
sudo make install

By default, OpenSSL will be used as TLS/SSL library. If you prefer GnuTLS, configure with --with-gnutls like this:

./autogen.sh --with-gnutls

MbedTLS is also supported and can be enabled by passing --with-mbedtls to configure. If mbedTLS is not installed in a default location, you need to set the environment variables mbedtls_INCLUDES to the path that contains the MbedTLS headers and mbedtls_LIBDIR to set the library path. Optionally, mbedtls_LIBS can be used to set the library names directly. Example:

./autogen.sh --with-mbedtls mbedtls_INCLUDES=/opt/local/include mbedtls_LIBDIR=/opt/local/lib

Usage

Documentation about using the library in your application is not available yet. The "hacker way" for now is to look at the implementation of the included utilities.

Utilities

The library bundles the following command-line utilities in the tools directory:

Utility Description
idevice_id List attached devices or print device name of given device
idevicebackup Create or restore backup for devices (legacy)
idevicebackup2 Create or restore backups for devices running iOS 4 or later
idevicebtlogger Capture Bluetooth HCI traffic from a device (requires log profile)
idevicecrashreport Retrieve crash reports from a device
idevicedate Display the current date or set it on a device
idevicedebug Interact with the debugserver service of a device
idevicedebugserverproxy Proxy a debugserver connection from a device for remote debugging
idevicediagnostics Interact with the diagnostics interface of a device
ideviceenterrecovery Make a device enter recovery mode
ideviceimagemounter Mount disk images on the device
ideviceinfo Show information about a connected device
idevicename Display or set the device name
idevicenotificationproxy Post or observe notifications on a device
idevicepair Manage host pairings with devices and usbmuxd
ideviceprovision Manage provisioning profiles on a device
idevicescreenshot Gets a screenshot from the connected device
idevicesetlocation Simulate location on device
idevicesyslog Relay syslog of a connected device
afcclient Interact with device filesystem via AFC/HouseArrest

Please consult the usage information or manual pages of each utility for a documentation of available command line options and usage examples like this:

ideviceinfo --help
man ideviceinfo

Contributing

We welcome contributions from anyone and are grateful for every pull request!

If you'd like to contribute, please fork the master branch, change, commit and send a pull request for review. Once approved it can be merged into the main code base.

If you plan to contribute larger changes or a major refactoring, please create a ticket first to discuss the idea upfront to ensure less effort for everyone.

Please make sure your contribution adheres to:

  • Try to follow the code style of the project
  • Commit messages should describe the change well without being too short
  • Try to split larger changes into individual commits of a common domain
  • Use your real name and a valid email address for your commits

We are still working on the guidelines so bear with us!

Links

License

This library and utilities are licensed under the GNU Lesser General Public License v2.1, also included in the repository in the COPYING file.

Credits

Apple, iPhone, iPad, iPod, iPod Touch, Apple TV, Apple Watch, Mac, iOS, iPadOS, tvOS, watchOS, and macOS are trademarks of Apple Inc.

This project is an independent software and has not been authorized, sponsored, or otherwise approved by Apple Inc.

README Updated on: 2023-12-30

libplist's People

Contributors

aburgh avatar aumuell avatar bryanforbes avatar cfergeau avatar corsac-s avatar daaannieeellll avatar dmaclach avatar dnicolson avatar doko42 avatar filippobiga avatar funkym avatar fxchip avatar hadess avatar hyperair avatar jaywalker avatar jonathanbeck avatar liujianfengv avatar mcolyer avatar neheb avatar nicolas17 avatar nikias avatar oznog avatar pachoo avatar rickmark avatar sladen avatar tatsh avatar tihmstar avatar trofi avatar xdeng avatar zhunki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libplist's Issues

Out-Of-Boundary Read when parses base64 data

static int base64decode_block(unsigned char *target, const char *data, size_t data_size)
{
    int w1,w2,w3,w4;
    int i;
    size_t n;

    if (!data || (data_size <= 0)) {
        return 0;
    }   

    n = 0;
    i = 0;
    while (n < data_size-3) {
        w1 = base64_table[(int)data[n]];  // what if data[n] == -1 ?  type of data is signed char..
        w2 = base64_table[(int)data[n+1]];
        w3 = base64_table[(int)data[n+2]];
        w4 = base64_table[(int)data[n+3]];

        if (w2 >= 0) {
            target[i++] = (char)((w1*4 + (w2 >> 4)) & 255);
        }   
        if (w3 >= 0) {
            target[i++] = (char)((w2*16 + (w3 >> 2)) & 255);
        }   
        if (w4 >= 0) {
            target[i++] = (char)((w3*64 + w4) & 255);
        }   
        n+=4;
    }   
    return i;
}

And if it parse

<data trn="1.0" 0//EN"
    "http.DTDs/ProWerwwk.arsion="1.0">></data>
unsigned char *base64decode(const char *buf, size_t *size)
{
    if (!buf || !size) return NULL;
    size_t len = (*size > 0) ? *size : strlen(buf);
    if (len <= 0) return NULL;
    unsigned char *outbuf = (unsigned char*)malloc((len/4)*3+3);
    const unsigned char *ptr = buf;
    int p = 0;
    size_t l = 0;

    do {
        ptr += strspn(ptr, "\r\n\t ");
        if (*ptr == '\0' || ptr >= buf+len) {
            break;
        }   
        l = strcspn(ptr, "\r\n\t "); // out of boundary .......................
        if (l > 3 && ptr+l <= buf+len) {
            p+=base64decode_block(outbuf+p, ptr, l); 
            ptr += l;
        } else {
            break;
        }   
    } while (1);

    outbuf[p] = 0;
    *size = p;
    return outbuf;
}

one possible patch

diff --git a/src/base64.c b/src/base64.c
index 7870a79..7d6f8fd 100644
--- a/src/base64.c
+++ b/src/base64.c
@@ -71,7 +71,7 @@ size_t base64encode(char *outbuf, const unsigned char *buf, size_t size)
        return m;
 }
 
-static int base64decode_block(unsigned char *target, const char *data, size_t data_size)
+static int base64decode_block(unsigned char *target, const unsigned char *data, size_t data_size)
 {
        int w1,w2,w3,w4;
        int i;
@@ -106,19 +106,19 @@ static int base64decode_block(unsigned char *target, const char *data, size_t da
 unsigned char *base64decode(const char *buf, size_t *size)
 {
        if (!buf || !size) return NULL;
-       size_t len = (*size > 0) ? *size : strlen(buf);
+       size_t len = *size;
        if (len <= 0) return NULL;
        unsigned char *outbuf = (unsigned char*)malloc((len/4)*3+3);
-       const char *ptr = buf;
+       const unsigned char *ptr = buf;
        int p = 0;
        size_t l = 0;
 
        do {
-               ptr += strspn(ptr, "\r\n\t ");
+               ptr += strspn((const char *)ptr, "\r\n\t ");
                if (*ptr == '\0' || ptr >= buf+len) {
                        break;
                }
-               l = strcspn(ptr, "\r\n\t ");
+               l = strcspn((const char *)ptr, "\r\n\t ");
                if (l > 3 && ptr+l <= buf+len) {
                        p+=base64decode_block(outbuf+p, ptr, l);
                        ptr += l;

Can't get libxml2 dependency on mac (unix)

Whenever I try to run the ./autogen.sh command I'm told I'm missing the "libxml2" package that is listed as a dependency. I've tried downloading this dependent package multiple times and from multiple sources yet it continues to not recognize that the package is there. Does anyone know how to fix this issue? I'm on a Mac (unix).

Not possible to do out of source build

Steps to reproduce:

git clone [email protected]:libimobiledevice/libplist.git
cd libplist
NOCONFIGURE=1 ./autogen.sh
mkdir build
cd build
../configure
make

Output:

make  all-recursive
make[1]: Entering directory `/home/tatsh/dev/libplist/build'
Making all in libcnary
make[2]: Entering directory `/home/tatsh/dev/libplist/build/libcnary'
  CC       node.lo
../../libcnary/node.c:27:18: fatal error: node.h: No such file or directory
compilation terminated.
make[2]: *** [node.lo] Error 1
make[2]: Leaving directory `/home/tatsh/dev/libplist/build/libcnary'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/tatsh/dev/libplist/build'
make: *** [all] Error 2

This is considered a bug most of the time. By default Gentoo with autotools wants to build out of source. The AUTOTOOLS_IN_SOURCE_BUILD variable is only there for this particular bug.

Compatibility for old gcc

From GCC 4.5 changelog https://gcc.gnu.org/gcc-4.5/changes.html

The deprecated attribute now takes an optional string argument, for example, attribute((deprecated("text string"))), that will be printed together with the deprecation warning.

I'm still using the GCC that released by Apple http://www.opensource.apple.com/source/gcc/gcc-5666.3/ which is version 4.2.1, and unfortunately this caused error message like this:

/Users/yegle/.gentoo/var/tmp/portage/app-pda/libplist-1.11/work/libplist-1.11/include/plist/plist.h:339: error: wrong number of arguments specified for 'deprecated' attribute

COPYING file includes GPL

There's a GPL COPYING file in addition to the LGPL COPYING.LESSER file in the root directory.
It looks like all the source files are LGPLed. Is the GPL inclusion a mistake, or are there pieces of code I missed that are GPLed here?

build failed on mac 10.11

xplist.c:34:10: fatal error: 'libxml/xmlIO.h' file not found

include <libxml/xmlIO.h>

I have already installed xml
I found Makfile libxml2_CFLAGS = -I/usr/include/libxml2
but on mac there is no /usr/include/

I changed this to my path, but seems no effect same error

compile/link error on MinGW32 (win7)

I'm trying to build libplist 1.11 using MinGW on Windows7, however I got linker errors:
undefined reference to `__gxx_personality_v0'

building succeeds on libplist 1.8 ( without autoconf changes ).

How to solve this?

autogen works ok:
./autogen.sh LDFLAGS="-L/c/Python27_32/libs" -prefix=/mingw

make fails:
$ make
make all-recursive
make[1]: Entering directory /c/projects/Trunk/externals/sources/libplist-1.11' Making all in libcnary make[2]: Entering directory/c/projects/Trunk/externals/sources/libplist-1.11/libcnary'
CC node.lo
CC list.lo
CC node_list.lo
CC iterator.lo
CC node_iterator.lo
CCLD libcnary.la
make[2]: Leaving directory /c/projects/Trunk/externals/sources/libplist-1.11/libcnary' Making all in src make[2]: Entering directory/c/projects/Trunk/externals/sources/libplist-1.11/src'
CC base64.lo
CC bytearray.lo
CC hashtable.lo
CC ptrarray.lo
CC xplist.lo
CC bplist.lo
bplist.c: In function 'plist_to_bin':
bplist.c:196:6: warning: comparison is always true due to limited range of data type [-Wty
pe-limits](%28%28uint64_t%29x%29 < %281ULL << 32%29 ? 4 : 8))))
^
bplist.c:1107:23: note: in expansion of macro 'get_needed_bytes'
dict_param_size = get_needed_bytes(objects->len);
^
bplist.c:196:6: warning: comparison is always true due to limited range of data type [-Wty
pe-limits](%28%28uint64_t%29x%29 < %281ULL << 32%29 ? 4 : 8))))
^
bplist.c:1182:19: note: in expansion of macro 'get_needed_bytes'
offset_size = get_needed_bytes(bplist_buff->len);
^
CC plist.lo
CCLD libplist.la
CXX Node.lo
CXX Structure.lo
CXX Array.lo
CXX Boolean.lo
CXX Data.lo
CXX Date.lo
CXX Dictionary.lo
CXX Integer.lo
CXX Key.lo
CXX Real.lo
CXX String.lo
CXX Uid.lo
CXXLD libplist++.la
libtool: link: warning: c:/MinGW/lib/libxml2.la' seems to be moved .libs/Node.o:Node.cpp:(.eh_frame+0xf7): undefined reference to__gxx_personality_v0'
.libs/Structure.o:Structure.cpp:(.eh_frame+0x143): undefined reference to __gxx_personali ty_v0' .libs/Array.o:Array.cpp:(.eh_frame+0x13): undefined reference to__gxx_personality_v0'
.libs/Boolean.o:Boolean.cpp:(.eh_frame+0xa7): undefined reference to __gxx_personality_v0 ' .libs/Data.o:Data.cpp:(.eh_frame+0xc7): undefined reference to__gxx_personality_v0'
.libs/Date.o:Date.cpp:(.eh_frame+0xc7): more undefined references to __gxx_personality_v0 ' follow c:/MinGW/lib/libstdc++.a(new_op.o):new_op.cc:(.text+0x34): undefined reference to_Unwind
_SjLj_Register'
c:/MinGW/lib/libstdc++.a(new_op.o):new_op.cc:(.text+0x87): undefined reference to _Unwind _SjLj_Unregister' c:/MinGW/lib/libstdc++.a(new_op.o):new_op.cc:(.text+0xb7): undefined reference to_Unwind
_SjLj_Resume'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: c:/MinGW/lib/libstdc
++.a(new_op.o): bad reloc address 0x0 in section .rdata$_ZTISt9bad_alloc[__ZTISt9bad_allo c]' collect2.exe: error: ld returned 1 exit status make[2]: *** [libplist++.la] Error 1 make[2]: Leaving directory/c/projects/Trunk/externals/sources/libplist-1.11/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/c/projects/Trunk/externals/sources/libplist-1.11'
make: *** [all] Error 2

conversion between bin and xml format is dependent on timezone

$ TZ=Asia/Singapore plistutil -i test/data/2.plist -o 2.plist.bin
$ TZ=UTC plistutil -i 2.plist.bin -o 2.plist.utc.xml
$ TZ=Asia/Singapore plistutil -i 2.plist.bin -o 2.plist.sgt.xml

$ diff -u 2.plist.utc.xml 2.plist.sgt.xml
....
-       <date>2009-02-12T14:23:00Z</date>
+       <date>2009-02-12T22:23:00Z</date>
....

I can't install libplist--mac os

./autogen.sh

Configuration for libplist 1.13.0:

Install prefix: .........: /usr/local
Python bindings .........: no
Now type 'make' to build libplist 1.13.0,
and then 'make install' for installation.

and
sudo make install
...
libtool: install: ranlib /usr/local/lib/libplist++.a
/opt/local/bin/gmkdir -p '/usr/local/lib/pkgconfig'
/opt/local/bin/ginstall -c -m 644 libplist.pc libplist++.pc '/usr/local/lib/pkgconfig'
Making install in include
make[2]: Nothing to be done for install-exec-am'. /opt/local/bin/gmkdir -p '/usr/local/include' /opt/local/bin/gmkdir -p '/usr/local/include/plist' /opt/local/bin/ginstall -c -m 644 plist/plist.h plist/plist++.h plist/Array.h plist/Boolean.h plist/Data.h plist/Date.h plist/Dictionary.h plist/Integer.h plist/Key.h plist/Node.h plist/Real.h plist/String.h plist/Structure.h plist/Uid.h '/usr/local/include/plist' Making install in tools /opt/local/bin/gmkdir -p '/usr/local/bin' /bin/sh ../libtool --mode=install /opt/local/bin/ginstall -c plistutil '/usr/local/bin' libtool: install: /opt/local/bin/ginstall -c .libs/plistutil /usr/local/bin/plistutil make[2]: Nothing to be done forinstall-data-am'.
Making install in test
make[2]: Nothing to be done for install-exec-am'. make[2]: Nothing to be done forinstall-data-am'.
make[2]: Nothing to be done for install-exec-am'. make[2]: Nothing to be done forinstall-data-am'.

libplist is not install in my mac os

libplist's new XML parser has numerous bugs (even a segfault!)

OK, so, before I begin, I'm going to say that it has taken me hours to come to the position that trying to just fix this is even the right thing to do. I saw that libplist recently switched to a custom XML parser. I've written an XML parser before, and let me tell you that it isn't easy. When I did it, I had spent months deep in the various XML specifications, and I cared enough to really really handle them well; and even then, it was a learning exercise that I doubt ever worked 100% correctly and which I never considered using in production. The reality is that we already have access to a world class XML parser that tries really hard to do it right: libxml2.

However, I'm now taking this as an opportunity: it turns out that Apple also wrote a custom and broken implementation of XML parsing for their plist parser, so it is currently possible to build plist files which Apple parses correctly and which libplist doesn't. I actually consider this a serious problem, and while I think it is usually foolish to try to implement a custom XML parser, that is the only sane way to get bug-for-bug compatibility with Apple's parser. However, I'd like that to be made an explicit goal: to replicate the behavior of Apple's plist parser in libplist. Given that, it thereby makes sense to spend time trying to make this custom XML parser work.

In fact, by the end of this comment, I hope you will accept the argument that one actually can't correctly implement parsing the plist file format using a true XML parser.

So, let's begin.

Here is a valid plist file containing a copyright symbol. The new version of libplist fails to parse this correctly: if you run it through plistutil to convert it to binary and then run the result through plutil to print, you get an error from both sides.

<plist version="1.0">
<dict>
    <key>copyright</key>
    <string>&#169;</string>
</dict>
</plist>
invalid utf8 sequence in string at index 0
bin.plist: Unexpected character b at line 1

Here's a totally valid plist file which the new versions of libplist fails to correctly parse but which both the old version of libplist and Apple's parser worked with: note the carefully positioned whitespace inside of the closing tag.

<plist version="1.0">
<dict>
    <key>name</key >
    <string>value</string>
</dict>
</plist>
ERROR: Failed to convert input file.

Here's another perfectly valid plist file which generates that same output from the new parser.

<plist>
<dict>
    <key></key>
    <string>value</string>
</dict>
</plist>

We can make this one worse, though: let's add a comment; now it segfaults!

<plist>
<dict>
    <key><!-- test --></key>
    <string>value</string>
</dict>
</plist>
Segmentation fault: 11

BTW: while this file used to "work", if you run this through Apple's parser, you get the following error, as Apple actually doesn't allow comments inside of key values (something I never would have expected).

xml.plist: Encountered improper CDATA opening at line 3

Essentially, they try to parse all directives with <! as CDATA in this context. Here is an XML file which the current libplist supports, but which neither Apple nor the previous versions of libplist supported.

<plist>
<dict>
    <key>test<!test></key>
    <string>value</string>
</dict>
</plist>

Apple returns the CDATA error, while the new version of libplist provides the following weird result.

{
  "test>" => "value"
}

Continuing with this theme, here's another example of an invalid XML file which libplist previously did not support, which Apple also does not support, but which the new version of libplist incorrectly supports. I'm also including the error message from Apple.

<plist>
<dict>
    <key>test&amp</key>
    <string>value</string>
</dict>
</plist>
xml.plist: Encountered unknown ampersand-escape sequence at line 3

You have to be careful with how you fix this, though, because Apple's parser doesn't actually care about the validity of entity references inside of attributes. In fact, they aren't even trying to parse attributes, they seriously just skip to the next >. This is a valid plist file, according to Apple.

<plist Q=">
<dict>
    <key>test</key>
    <string>value</string>
</dict>
</plist>

Of course, this is clearly not a valid XML file, nor is this going to be easy to simulate using an XML parser: this is the example which proves "you can't correctly implement parsing the plist file format using a true XML parser". And this is then the point where these examples start getting awkward.

Here is a simple one: Apple actually allows text past the end of the file. libplist used to allow random strings in some places (which was wrong: Apple normally disallows extra text), but never supported it after the end of the file (as that would make the XML file itself invalid). The new version of libplist is now even more strict. But Apple actually does support text at the end of the file.

<plist>
<dict>
    <key>test</key>
    <string>value</string>
</dict>
</plist>
test

Here's another great one: Apple's plist parser doesn't even try to parse DOCTYPE values correctly. Clearly, libxml2 was really careful about them, and even this new version of libplist is trying to parse embedded DTDs, but Apple doesn't support any of this stuff. They don't even bother correctly parsing out string constants! The following XML file is supported by Apple, but libplist has always balked when parsing.

<!DOCTYPE test ">
<plist>
<dict>
    <key>test</key>
    <string>value</string>
</dict>
</plist>

So, while clearly I expect you to care about the segfault, and while I also totally believe you'll fix the cases where libplist can't parse something Apple does, I'm now going to really motivate why it is important to care about these quirks. Here is an XML file which both Apple and libplist can parse, but which uses parser differentials between the quirks of their separate implementations to get them to both end up with different results (note that in this case the old version of libplist, based on libxml2, rejects this file for being invalid XML).

<plist>
<dict>
    <key>test</key>
    <string =">apple</string>
    <!--<string ">libplist</string><!---->
</dict>
</plist>

When you parse this using Apple's parser, you get the following plist.

{
  "test" => "apple"
}

When you parse this using libplist's current parser, you get this different plist.

{
  "test" => "libplist"
}

:D

(edit:) I spent some more time at this, and have managed to come up with a version of this which lets me give different values to all three parsers: the old version of libplist backed by libxml2, the new version of libplist with the custom parser, and Apple's XML parser. Here I also rely on differences in behavior when there are duplicate key values. This isn't quite as awesome, as I am leaving a garbage key behind in the Apple plist (as the better tricks that can elide entire elements are noticed by libxml2), but usually extra keys are ignored ;P.

<plist>
<dict>
    <key>test</key>
    <string>libxml2</string>
    <key>test</key>
    <string>apple</string>
    <key Q=">">test</key>
    <string>libplist</string>
</dict>
</plist>

Apple:

{
  "">test" => "libplist"
  "test" => "apple"
}

old libplist (libxml2):

{
  "test" => "libxml2"
}

new libplist (custom):

{
  "test" => "libplist"
}

fail to build use android-ndk-r13b

i use following command to build libplist for android(ndk-r13b)

./autogen.sh --host=arm-linux-androideabi

but the configure command fail since it can not find pthread_once

checking for pthread_once in -lpthread... no
configure: error: pthread with pthread_once required to build libplist

here is the complete output message:

libtoolize: putting auxiliary files in '.'.
libtoolize: linking file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: linking file 'm4/libtool.m4'
libtoolize: linking file 'm4/ltoptions.m4'
libtoolize: linking file 'm4/ltsugar.m4'
libtoolize: linking file 'm4/ltversion.m4'
libtoolize: linking file 'm4/lt~obsolete.m4'
configure.ac:23: installing './compile'
configure.ac:6: installing './missing'
cython/Makefile.am: installing './depcomp'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-androideabi-strip... arm-linux-androideabi-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for arm-linux-androideabi-gcc... arm-linux-androideabi-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-linux-androideabi-gcc accepts -g... yes
checking for arm-linux-androideabi-gcc option to accept ISO C89... none needed
checking whether arm-linux-androideabi-gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of arm-linux-androideabi-gcc... gcc3
checking for arm-linux-androideabi-g++... arm-linux-androideabi-g++
checking whether we are using the GNU C++ compiler... yes
checking whether arm-linux-androideabi-g++ accepts -g... yes
checking dependency style of arm-linux-androideabi-g++... gcc3
checking whether arm-linux-androideabi-g++ is available and compiles a program... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... arm-unknown-linux-androideabi
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by arm-linux-androideabi-gcc... /home/guorongfei/Android/standalone-toolchains/android-toolchain-arm/arm-linux-androideabi/bin/ld
checking if the linker (/home/guorongfei/Android/standalone-toolchains/android-toolchain-arm/arm-linux-androideabi/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /home/guorongfei/Android/standalone-toolchains/android-toolchain-arm/bin//arm-linux-androideabi-nm -B
checking the name lister (/home/guorongfei/Android/standalone-toolchains/android-toolchain-arm/bin//arm-linux-androideabi-nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to arm-unknown-linux-androideabi format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /home/guorongfei/Android/standalone-toolchains/android-toolchain-arm/arm-linux-androideabi/bin/ld option to reload object files... -r
checking for arm-linux-androideabi-objdump... arm-linux-androideabi-objdump
checking how to recognize dependent libraries... pass_all
checking for arm-linux-androideabi-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for arm-linux-androideabi-ar... arm-linux-androideabi-ar
checking for archiver @FILE support... @
checking for arm-linux-androideabi-strip... (cached) arm-linux-androideabi-strip
checking for arm-linux-androideabi-ranlib... arm-linux-androideabi-ranlib
checking command to parse /home/guorongfei/Android/standalone-toolchains/android-toolchain-arm/bin//arm-linux-androideabi-nm -B output from arm-linux-androideabi-gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for arm-linux-androideabi-mt... no
checking for mt... mt
configure: WARNING: using cross tools not prefixed with host triplet
checking if mt is a manifest tool... no
checking how to run the C preprocessor... arm-linux-androideabi-gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if arm-linux-androideabi-gcc supports -fno-rtti -fno-exceptions... no
checking for arm-linux-androideabi-gcc option to produce PIC... -fPIC -DPIC
checking if arm-linux-androideabi-gcc PIC flag -fPIC -DPIC works... yes
checking if arm-linux-androideabi-gcc static flag -static works... yes
checking if arm-linux-androideabi-gcc supports -c -o file.o... yes
checking if arm-linux-androideabi-gcc supports -c -o file.o... (cached) yes
checking whether the arm-linux-androideabi-gcc linker (/home/guorongfei/Android/standalone-toolchains/android-toolchain-arm/arm-linux-androideabi/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... Android linker
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... arm-linux-androideabi-g++ -E
checking for ld used by arm-linux-androideabi-g++... /home/guorongfei/Android/standalone-toolchains/android-toolchain-arm/arm-linux-androideabi/bin/ld
checking if the linker (/home/guorongfei/Android/standalone-toolchains/android-toolchain-arm/arm-linux-androideabi/bin/ld) is GNU ld... yes
checking whether the arm-linux-androideabi-g++ linker (/home/guorongfei/Android/standalone-toolchains/android-toolchain-arm/arm-linux-androideabi/bin/ld) supports shared libraries... yes
checking for arm-linux-androideabi-g++ option to produce PIC... -fPIC -DPIC
checking if arm-linux-androideabi-g++ PIC flag -fPIC -DPIC works... yes
checking if arm-linux-androideabi-g++ static flag -static works... yes
checking if arm-linux-androideabi-g++ supports -c -o file.o... yes
checking if arm-linux-androideabi-g++ supports -c -o file.o... (cached) yes
checking whether the arm-linux-androideabi-g++ linker (/home/guorongfei/Android/standalone-toolchains/android-toolchain-arm/arm-linux-androideabi/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... Android linker
checking how to hardcode library paths into programs... immediate
checking for ANSI C header files... (cached) yes
checking for stdint.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking for ssize_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint8_t... yes
checking for asprintf... yes
checking for strcasecmp... yes
checking for strdup... yes
checking for strerror... yes
checking for strndup... yes
checking for stpcpy... yes
checking for vasprintf... yes
checking for gmtime_r... yes
checking for localtime_r... yes
checking for timegm... yes
checking for strptime... yes
checking whether byte ordering is bigendian... no
checking wether we need platform-specific build settings... yes
checking whether arm-linux-androideabi-gcc is Clang... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking whether more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... no
checking for pthread_once in -lpthread... no
configure: error: pthread with pthread_once required to build libplist

i also tried to build following dummy code use arm-linux-androideabi-gcc

#include <pthread.h>

static pthread_once_t once_control = PTHREAD_ONCE_INIT;

void dummy() { }

int main(void)
{
    pthread_once(&once_control, dummy);
    return 0;
}

it works.

Any help would be appreciated

Crash on multithread environment, xmlCleanup causes crash

plist will crash when using from different threads.

xplist.c: methods: plist_to_xml(...) / plist_from_xml(..) are using xml cleanup:
xmlCleanupCharEncodingHandlers(); // Cleanup called from thread 1
xmlDictCleanup();
xmlResetLastError();
xmlCleanupGlobals();
xmlCleanupThreads();
xmlCleanupMemory();

crash will happen when another thread will call xmlParseMemory after another has used xmlCleanup functions.
static xmlDocPtr new_xml_plist(void)
{
char *plist = strdup(plist_base);
xmlDocPtr plist_xml = xmlParseMemory(plist, strlen(plist)); // CRAHS on thread 2

free(plist);

return plist_xml;

}

When removing cleanup functions, crash will not occur.
Can be reproduced easily:
thread 1:
idevice_get_device_list(...);

thread 2:
// wait thread 1 to finish and call:
idevice_get_device_list(...); // crash

How to complie the Source code with Visual Studio?

I want to complie the source code with visual studio ,but it seems that the project can not support my idear ,can anyone can help me ? or tell me how to complie it through the Cygwin? It seems that it need so many depend libs.

Not compiling on Mac OS X 10.9 Mavericks

It stops here:
[ 44%] Building CXX object src/CMakeFiles/plist++.dir/Dictionary.cpp.o
/Volumes/HDD/Downloads/libplist-1.8/build/libplist/src/Dictionary.cpp:154:12: error: no matching conversion for functional-style cast from 'long' to 'iterator'
(aka '__map_iterator')
return iterator(NULL);
^~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/map:539:24: note: candidate constructor (the implicit copy constructor) not
viable: no known conversion from 'long' to 'const std::__1::__map_iteratorstd::__1::__tree_iterator<std::__1::pair<std::__1::basic_string<char, PList::Node _>,
std::__1::__tree_nodestd::__1::pair<std::__1::basic_string<char, PList::Node *>, void *> *, long> >' for 1st argument
class _LIBCPP_TYPE_VIS __map_iterator
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/map:563:5: note: candidate constructor not viable: no known conversion from
'long' to 'std::__1::__tree_iteratorstd::__1::pair<std::__1::basic_string<char, PList::Node *>, std::__1::__tree_nodestd::__1::pair<std::__1::basic_string<char,
PList::Node *>, void *> *, long>' for 1st argument
__map_iterator(_TreeIterator __i) _NOEXCEPT : _i(__i) {}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/map:560:5: note: candidate constructor not viable: requires 0 arguments, but 1
was provided
__map_iterator() NOEXCEPT {}
^
1 error generated.
make[2]: *
* [src/CMakeFiles/plist++.dir/Dictionary.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/plist++.dir/all] Error 2
make: *** [all] Error 2

Cannot build on Mac with OSX 10.8.5

First, following the build steps, cmake fails:
CMake Error: The source directory "/Users/me/Desktop/project/libplist-master" does not appear to contain CMakeLists.txt.

Second, when I run ./autogen.sh I get errors about libxml2 (which I have and I believe I have the proper symbolic links:
checking how to hardcode library paths into programs... immediate
./configure: line 15358: syntax error near unexpected token libxml2,' ./configure: line 15358:PKG_CHECK_MODULES(libxml2, libxml-2.0 >= $LIBXML2_VERSION)'

Last, after commenting out the PKG_CHECK_MODULES from configure I can configure but then make will fail:
make all-recursive
Making all in libcnary
CC node.lo
CC list.lo
CC node_list.lo
CC iterator.lo
CC node_iterator.lo
CCLD libcnary.la
ranlib: unrecognized option -q' ranlib: Tryranlib --help' for more information.
ar: internal ranlib command failed
make[2]: *** [libcnary.la] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Not sure what I could be doing wrong but I cannot get the project to build on Mac. Please help if you can.

plist_form_bin crashes

demo file http://xdeng.cn/file/InfoPlist.strings

plist_form_bin crashes in bplist.c 729 line

/////////////////////////////////////
node_t* node = (node_t_)nodeslist[i];
if (NODE_IS_ROOT(node)) { //if node = NULL crashes
plist_free(node);
}
/////////////////////////////////////
Modified to
node_t_ node = (node_t*)nodeslist[i];
if (node && NODE_IS_ROOT(node)) {
plist_free(node);
}

SIGSEGV in strlen

Under some circumstances, (I've only tested with one device, iPhone 5 iOS 7.1.1) there is a call to strlen with a null pointer. Seems odd that strlen(NULL) doesn't just report a length of zero with all versions of libc, but whatever.

Support old openstep plist format

It's a lot more readable as an output format than the XML plist, and Mac OS can read it just fine. It's even the default format for XCode project specifications, oddly enough!

Not sure if that's a compelling reason to implement a whole other format, but it's a nice format ๐Ÿ˜„

Parsing dates depends on timezone and, specifically, on Daylight Saving Time

I see issues when parsing XML to plist_node. The issue is that when it comes to parsing date value, it adds unnecessary 1 hour shift for my current timezone.

I use this XML to import:

<?xml version=""1.0"" encoding=""UTF-8""?>
<!DOCTYPE plist PUBLIC ""-//Apple//DTD PLIST 1.0//EN"" ""http://www.apple.com/DTDs/PropertyList-1.0.dtd"">
<plist version=""1.0"">
<dict>
    <key>Last Backup Date</key>
    <date>2016-04-06T10:16:17Z</date>
</dict>
</plist>

After loading it via plist_from_xml, after getting the key Last Backup Date and converting it to string value, I see the value of 2016-04-06 11:16:17, which is 1 hour more than I expect to see.

I think the issue is in this line. GMT is not UTC, and it can have daylight saving time, hence the error.

Crash when replacing a value in a C++ Dictionary

The following program will crash in the second Set() call.

#include <iostream>
#include <plist/plist++.h>

using namespace PList;

int main(int argc, const char * argv[])
{
    Dictionary* dict = new Dictionary();
    dict->Set("YesNo", Boolean(false));
    dict->Set("YesNo", Boolean(true));
    std::cout << dict->ToXml();
    delete dict;
}

The Set function is:

Dictionary::iterator Dictionary::Set(const std::string& key, const Node* node)
{
    if (node)
    {
        Node* clone = node->Clone();
        UpdateNodeParent(clone);
        plist_dict_set_item(_node, key.c_str(), clone->GetPlist());
        delete _map[key];
        _map[key] = clone;
        return _map.find(key);
    }
    return iterator(this->_map.end());
}

The crash occurs at delete _map[key]; The crash occurs because plist_dict_set_item deletes the plist_t node which the containing Node object then tries to delete when it is deleted. I tried the following change to the Node destructor, where plist_free is called only when the Node is not member of a container. I'm not sure this is the best fix, but it appears to solve the problem and not cause memory leaks.

Node::~Node()
{
    if (_parent == NULL)
        plist_free(_node);
    _node = NULL;
    _parent = NULL;
}

Note: the example uses a Boolean, but any primitive PList type will behave the same. Also, PList::Remove() will trigger the same crash.

Integers are truncated on mips when converting between bin and xml format

The test emptycmp fails because 2.plist.out on mips shows 2369772560 instead of 32434543632.

It's truncated at a 32-bit boundary, so it's probably an integer size issue.

The issue is in plist_to_bin() rather than plist_from_bin(), because doing the xml->bin conversion on amd64 and then using that bin file for converting back to xml on mips succeeds (except for the timezone issue mentioned in #14).

xmlParseMemory collapse

xmlCleanupCharEncodingHandlers();
xmlDictCleanup();
xmlResetLastError();
xmlCleanupGlobals();
xmlCleanupThreads();
xmlCleanupMemory();

Multithreading will collapse

Fatel error: 'libxml/parser.h' file not found

Issue when running make:

"
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Making all in libcnary
make[2]: Nothing to be done for `all'.
Making all in src
CC xplist.lo
xplist.c:32:10: fatal error: 'libxml/parser.h' file not found

include <libxml/parser.h>

     ^

1 error generated.
make[2]: *** [xplist.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
"

Cannot 'make'

I'm having errors while doing 'sudo make'

a lot warnings about shadowed declarations

and 2 errors:
make[2]: *** [xplist.lo] Error 1
make[1]: ** [all-recursive] Error 1
make: *** [all] Error 2

Anyone has any idea how to fix this?

cheers!

libplist can't compile

Hello guy!
When I try to install idevicerestore, it says libplist 1,12 is require but I have 1.10 installed, I try to change the file configure.ac by change it to libplist PKG_CHECK_MODULES(libplist, libplist >= 1.10),it seems bypass this error but still not compiling. I Finally realize that I should intall the 1.12 version of libplist. when i try it gives me this error:
checking whether byte ordering is bigendian... no
checking whether to enable WIN32 build settings... no
checking for a Python interpreter with version >= 2.3... python
checking for python... /usr/bin/python
checking for python version... 2.7
checking for python platform... linux2
checking for python script directory... ${prefix}/lib/python2.7/dist-packages
checking for python extension module directory... ${exec_prefix}/lib/python2.7/dist-packages
checking for cython... no
configure: WARNING: cannot find 'cython' program. You should look at http://www.cython.org or install your distribution specific cython package.
checking for python2.7... (cached) /usr/bin/python
checking for a version of Python >= '2.1.0'... yes
checking for the distutils Python package... yes
checking for Python include path... ./configure: line 16698: type: /usr/bin/python-config: not found
-I/usr/include/python2.7
checking for Python library path... ./configure: line 16718: type: /usr/bin/python-config: not found
-L/usr/lib/python2.7 -lpython2.7
checking for Python site-packages path... /usr/lib/python2.7/dist-packages
checking python extra libraries... ('-L/usr/lib -lz', '-lpthread -ldl -lutil')
checking python extra linking flags... -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions
checking consistency of all components of python development environment... no
configure: error:
Could not link test program to Python. Maybe the main Python library has been
installed in some non-standard library path. If so, pass it to configure,
via the LDFLAGS environment variable.
Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"

ERROR!
You probably have to install the development version of the Python package
for your distribution. The exact name of this package varies among them.

Thank you for your coming help

Compile Error

I am having the following issue when running make on the libplist. ./autogen.sh --without-cython completes successfully, but then I encounter this when I run make. This is on a WIndows 7 machine using MinGW-32 as the cross compiler. Any help appreciated.

error

plist_from_bin() crashes trying to access already freed memory

For some reason it tries to copy node data which was already freed. The plist file which causes such behavior can be downloaded here: http://www.filedropper.com/history_2
Environment: windows 7 x86, libplist 1.12 compiled with MS VC.
The problem is not reproduced when running in Debug, since memory data appears to be valid even though it's marked as 'freed'.
The best way to reproduce the problem is to run your application under MS Application Verifier with basic checks.

plist_from_bin plist_to_xml time is not accurate

plist_from_bin plist_to_xml date time is not accurate

and plist_from_xml plist_to_bin date time is not accurate

///////////////////////////////////////////////////////////////////////////////////////////////////////////////

plist_from_bin get date val = 419855442 = 1983 4 22 pm 6:30:42

but the correct value is 1398133842 = 2014 04 22 am 10:30:42

1398133842 - 419855442 = 978278400

My English is very bad -.-

MacOS 10.12.2 Sierra 'sudo make install' fails

13:06 $ sudo make install

Making install in libcnary
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
Making install in src
test -z "/usr/local/lib" || .././install-sh -c -d "/usr/local/lib"
 /bin/sh ../libtool   --mode=install /usr/bin/install -c   libplist.la libplist++.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libplist.3.dylib /usr/local/lib/libplist.3.dylib
libtool: install: (cd /usr/local/lib && { ln -s -f libplist.3.dylib libplist.dylib || { rm -f libplist.dylib && ln -s libplist.3.dylib libplist.dylib; }; })
libtool: install: /usr/bin/install -c .libs/libplist.lai /usr/local/lib/libplist.la
libtool: install: /usr/bin/install -c .libs/libplist++.3.dylib /usr/local/lib/libplist++.3.dylib
libtool: install: (cd /usr/local/lib && { ln -s -f libplist++.3.dylib libplist++.dylib || { rm -f libplist++.dylib && ln -s libplist++.3.dylib libplist++.dylib; }; })
libtool: install: /usr/bin/install -c .libs/libplist++.lai /usr/local/lib/libplist++.la
libtool: install: /usr/bin/install -c .libs/libplist.a /usr/local/lib/libplist.a
libtool: install: chmod 644 /usr/local/lib/libplist.a
libtool: install: ranlib /usr/local/lib/libplist.a
libtool: install: /usr/bin/install -c .libs/libplist++.a /usr/local/lib/libplist++.a
libtool: install: chmod 644 /usr/local/lib/libplist++.a
libtool: install: ranlib /usr/local/lib/libplist++.a
test -z "/usr/local/lib/pkgconfig" || .././install-sh -c -d "/usr/local/lib/pkgconfig"
 /usr/bin/install -c -m 644 libplist.pc libplist++.pc '/usr/local/lib/pkgconfig'
Making install in include
make[2]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/include" || .././install-sh -c -d "/usr/local/include"
.././install-sh -c -d '/usr/local/include/plist'
 /usr/bin/install -c -m 644  plist/plist.h plist/plist++.h plist/Array.h plist/Boolean.h plist/Data.h plist/Date.h plist/Dictionary.h plist/Integer.h plist/Key.h plist/Node.h plist/Real.h plist/String.h plist/Structure.h plist/Uid.h '/usr/local/include/plist'
Making install in tools
test -z "/usr/local/bin" || .././install-sh -c -d "/usr/local/bin"
  /bin/sh ../libtool   --mode=install /usr/bin/install -c plistutil '/usr/local/bin'
libtool: install: /usr/bin/install -c .libs/plistutil /usr/local/bin/plistutil
make[2]: Nothing to be done for `install-data-am'.
Making install in test
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.

Never tried to build the lib before so I have no idea where to start looking for why this is happening, any pointers?

More of a feature request than an issue

Hi, I might just be a little bit lazy, but is there any way you could add in an option tospecify --indir= where one could speficy a directory containing multiple plist files instead of just decalring them one by one ?

Thanks

ifuse segfault (strlen related)

Hello,

I get this segfault when trying to use ifuse to mount my iPhone 5c:

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
strlen () at ../sysdeps/x86_64/strlen.S:106
106     ../sysdeps/x86_64/strlen.S: No such file or directory.
(gdb) bt full
#0  strlen () at ../sysdeps/x86_64/strlen.S:106
No locals.
#1  0x00007ffff69d9b8e in __GI___strdup (s=0x0) at strdup.c:41
        len = <optimized out>
        new = <optimized out>
#2  0x00007ffff777d1da in plist_new_string () from /usr/lib/x86_64-linux-gnu/libplist.so.2
No symbol table info available.
#3  0x00007ffff798b93c in ?? () from /usr/lib/x86_64-linux-gnu/libimobiledevice.so.4
No symbol table info available.
#4  0x00007ffff798c403 in lockdownd_client_new_with_handshake () from /usr/lib/x86_64-linux-gnu/libimobiledevice.so.4
No symbol table info available.
#5  0x000000000040172c in main (argc=<optimized out>, argv=<optimized out>) at ifuse.c:754
        res = 1
        args = {argc = 2, argv = 0x6076a0, allocated = 1}
        mst = {st_dev = 65024, st_ino = 655488, st_nlink = 2, st_mode = 16877, st_uid = 1000, st_gid = 1000, __pad0 = 0, st_rdev = 0, st_size = 4096, st_blksize = 4096, 
          st_blocks = 8, st_atim = {tv_sec = 1357837666, tv_nsec = 180116579}, st_mtim = {tv_sec = 1345467094, tv_nsec = 0}, st_ctim = {tv_sec = 1345634544, 
            tv_nsec = 61450939}, __glibc_reserved = {0, 0, 0}}
        ret = 0

I originally opened this against the libimobliedevice package, but now I think it might be related to libplist instead (and possibly a dupe of #29 although I don't see any mention of NULL pointers and I don't know enough about C to know where to look).

I have compiled libimobliedevice, libplist and ifuse from source, pulled from github today.

Thanks,

George

Location of deprecation macro (was: ไฝ็ฝฎๆ”พ้”™ไบ†)

include/plist/plist.h 364

PLIST_API void plist_dict_insert_item(plist_t node, const char* key, plist_t item) PLIST_WARN_DEPRECATED("use plist_dict_set_item instead");

Should be changed

PLIST_WARN_DEPRECATED("use plist_dict_set_item instead") PLIST_API void plist_dict_insert_item(plist_t node, const char* key, plist_t item);

Having problem with Make && Make install

I'm trying to install idevicerestore but it keeps telling me that my libplist-1.11 is 1.10 and my libusbmuxd 1.0.8 and needs to be 1.0.9. I downloaded the correct versions, after I ./configure I then try to make the file and it gives me errors. starting with the libplist-1.11 it gives me this error:

config.status: creating doxygen.cfg
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands

Configuration for libplist 1.11:

Install prefix: .........: /usr/local
Python bindings .........: no

Now type 'make' to build libplist 1.11,
and then 'make install' for installation.

root@bigbambino-VirtualBox:~/Iph/libplist-1.11# make
make all-recursive
make[1]: Entering directory /home/bigbambino/Iph/libplist-1.11' Making all in libcnary make[2]: Entering directory/home/bigbambino/Iph/libplist-1.11/libcnary'
make[2]: Nothing to be done for all'. make[2]: Leaving directory/home/bigbambino/Iph/libplist-1.11/libcnary'
Making all in src
make[2]: Entering directory /home/bigbambino/Iph/libplist-1.11/src' CXXLD libplist++.la /usr/bin/ld: .libs/Node.o: relocation R_X86_64_32S against_ZTVN5PList4NodeE' can not be used when making a shared object; recompile with -fPIC
.libs/Node.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [libplist++.la] Error 1
make[2]: Leaving directory /home/bigbambino/Iph/libplist-1.11/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory/home/bigbambino/Iph/libplist-1.11'
make: *** [all] Error 2

Can someone please help me out I've been trying for hours, I'm just starting to learn Linux.

Thanks

Trouble building OS X 10.7.5

Trying to build in order to satisfy dependencies for libirecovery. This is the result:

Davids-Mac-Pro:libplist davidgn$ sudo ./autogen.sh
glibtoolize: putting macros in AC_CONFIG_MACRO_DIR, m4'. glibtoolize: linking filem4/libtool.m4'
glibtoolize: linking file m4/ltoptions.m4' glibtoolize: linking filem4/ltsugar.m4'
glibtoolize: linking file m4/ltversion.m4' glibtoolize: linking filem4/lt~obsolete.m4'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./../install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking build system type... x86_64-apple-darwin11.4.2
checking host system type... x86_64-apple-darwin11.4.2
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld
checking if the linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
checking the name lister (/usr/bin/nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-apple-darwin11.4.2 file names to x86_64-apple-darwin11.4.2 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin11.4.2 file names to toolchain format... func_convert_file_noop
checking for /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @file support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm output from gcc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin11.4.2 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld
checking if the linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) is GNU ld... no
checking whether the g++ linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fno-common -DPIC
checking if g++ PIC flag -fno-common -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin11.4.2 dyld
checking how to hardcode library paths into programs... immediate
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for libxml2... yes
checking for ANSI C header files... (cached) yes
checking for stdint.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking for ssize_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint8_t... yes
checking for asprintf... yes
checking for strcasecmp... yes
checking for strdup... yes
checking for strerror... yes
checking for strndup... yes
checking for stpcpy... yes
checking for vasprintf... yes
checking whether byte ordering is bigendian... no
checking whether to enable WIN32 build settings... no
checking for a Python interpreter with version >= 2.3... python
checking for python... /usr/bin/python
checking for python version... 2.7
checking for python platform... darwin
checking for python script directory... ${prefix}/lib/python2.7/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python2.7/site-packages
checking for cython... no
configure: WARNING: cannot find 'cython' program. You should look at http://www.cython.org or install your distribution specific cython package.
checking for python2.7... (cached) /usr/bin/python
checking for a version of Python >= '2.1.0'... yes
checking for the distutils Python package... yes
checking for Python include path... -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
checking for Python library path... -L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 -lpython2.7
checking for Python site-packages path... /Library/Python/2.7/site-packages
checking python extra libraries... ('', '-ldl -framework CoreFoundation')
checking python extra linking flags... -u _PyMac_Error /System/Library/Frameworks/Python.framework/Versions/2.7/Python
checking consistency of all components of python development environment... yes
checking for supported compiler flags... -Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter
checking whether make supports nested variables... (cached) yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libcnary/Makefile
config.status: creating src/Makefile
config.status: creating include/Makefile
config.status: creating tools/Makefile
config.status: creating cython/Makefile
config.status: creating test/Makefile
config.status: creating libplist.pc
config.status: creating libplist++.pc
config.status: creating doxygen.cfg
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands

Configuration for libplist 1.12:

Install prefix: .........: /usr/local
Python bindings .........: no

Now type 'make' to build libplist 1.12,
and then 'make install' for installation.

Davids-Mac-Pro:libplist davidgn$ sudo make
make all-recursive
Making all in libcnary
make[2]: Nothing to be done for `all'.
Making all in src
CC xplist.lo
In file included from plist.h:25,
from xplist.c:39:
../include/plist/plist.h:339: error: wrong number of arguments specified for 'deprecated' attribute
xplist.c: In function 'new_uint_node':
xplist.c:139: warning: declaration of 'uint' shadows a global declaration
/usr/include/sys/types.h:92: warning: shadowed declaration is here
xplist.c: In function 'node_to_xml':
xplist.c:225: warning: declaration of 'time' shadows a global declaration
/usr/include/time.h:133: warning: shadowed declaration is here
xplist.c: In function 'xml_to_node':
xplist.c:398: warning: declaration of 'time' shadows a global declaration
/usr/include/time.h:133: warning: shadowed declaration is here
make[2]: *** [xplist.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Any thoughts?

Can't build under OSX 10.9

When compiling I get this
checking whether make supports nested variables... (cached) yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: error: cannot find input file: `libcnary/Makefile.in'

I tried downloading libcnary and compiling it alone, but no luck. Any idea?

Trouble building on Ubuntu 13.10

Trying to build on Ubuntu 13.10. I get this error:

$ ./autogen.sh
[snipped]
checking for libxml2... no
configure: error: Package requirements (libxml-2.0 >= 2.7.8) were not met:

No package 'libxml-2.0' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables libxml2_CFLAGS
and libxml2_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

However, when I try to install libxml2, it seems that it already is:

$ sudo apt-get install libxml2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libxml2 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.

What's going on here?

<integer>-1</integer> about uint64_t

plist_form_xml

xplist.c 378 line data->intval = strtoull((char*)strval, NULL, 0);

if strval == -1
data->intval == 18446744073709551615

but

plist_to_xml

xplist.c 185 line (void)snprintf(val, 64, "%"PRIu64, node_data->intval);

node_data->intval == 18446744073709551615
so val == "18446744073709551615"
val != strval

Different from the original

Running autogen.sh on Ubuntu 14.04 is okay but running on Windows 7 gives an error

Hello! I am trying to compile this on Ubuntu and it was okay. But on Windows 7 I get the following error:
libtoolize: $pkgltdldir is not a directory: /mingw/share/lib
./autogen.sh: line 8: aclocal: command not found
./autogen.sh: line 9: autoheader: command not found
./autogen.sh: line 10: automake: command not found
./autogen.sh: line 11: autoconf: command not found
./autogen.sh: line 14: ./configure: No such file or directory

Am I missing something here? I am new to compiling code in Windows using MinGW

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.