Subject: Re: Compile - MacOSX Mojave 10.14.6
From: Ondřej Jirman
Date: Sat, 13 Jul 2019 23:38:08 +0200
Hi,

On Sun, Jul 14, 2019 at 02:52:02AM +0800, Lee Wei Yeong wrote:
> Hi,
> 
> 1. as documented in the following pages:
> 
>    -
>    https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getxattr.2.html
>    <https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setxattr.2.html>
>    -
>    https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setxattr.2.html
>    -
>    https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/listxattr.2.html
>    <https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setxattr.2.html>

Thank you, but that code will not work on Linux. That code was contributed
by the user, and I'll probably remove the OS dependent parts of it before
making next 1.11.x release.

I don't recommend using the master branch, atm.

Please use this branch: https://megous.com/git/megatools/log/?h=1.11.x

thanks,
	o.

> $ diff --git a/lib/mega.c b/lib/mega.c
> index 90071f4..3d2fe40 100644
> --- a/lib/mega.c
> +++ b/lib/mega.c
> @@ -4161,7 +4161,7 @@ try_again:
>   #define XATTR_MAX_SIZE 65535
>   char xattr_list[XATTR_MAX_SIZE];
>   char xattr_value[XATTR_MAX_SIZE];
> - ssize_t list_len = listxattr(local_path, xattr_list, XATTR_MAX_SIZE);
> + ssize_t list_len = listxattr(local_path, xattr_list, XATTR_MAX_SIZE, 0);
>   if (list_len > 0) {
>   // serialize extended attributes as json
>   SJsonGen *gen = s_json_gen_new();
> @@ -4170,7 +4170,7 @@ try_again:
> 
>   int li;
>   for (li = 0; li < list_len; li += strlen(&xattr_list[li]) + 1) {
> - ssize_t value_len = getxattr(local_path, &xattr_list[li], xattr_value,
> XATTR_MAX_SIZE);
> + ssize_t value_len = getxattr(local_path, &xattr_list[li], xattr_value,
> XATTR_MAX_SIZE, 0, 0);
>   if (value_len > -1) {
>   s_json_gen_start_object(gen);
>   s_json_gen_member_string(gen, "n", &xattr_list[li]); // xattr name
> 
> $ diff --git a/tools/sync.c b/tools/sync.c
> index 8c5d258..49f7258 100644
> --- a/tools/sync.c
> +++ b/tools/sync.c
> @@ -451,7 +451,7 @@ static gboolean dl_sync_file(struct mega_node *node,
> GFile *file, const gchar *r
>   gsize value_len;
>   guchar* xattr_value = g_base64_decode(xattr_value_encoded, &value_len);
> 
> - if (setxattr(local_path, xattr_name, xattr_value, value_len, 0)) {
> + if (setxattr(local_path, xattr_name, xattr_value, value_len, 0, 0)) {
>   // ignore this error if the file system does not support extended
> attributes
>   if (errno != ENOTSUP) {
>   tool_print_err("Failed to set extended attributes on %s: %s\n",
> local_path, g_strerror(errno));
> 
> 2. change `pkgconfig` path as follows:
> export
> PKG_CONFIG_PATH="${PREFIX}/opt/openssl/lib/pkgconfig:${PKG_CONFIG_PATH}"
> export
> PKG_CONFIG_PATH="${PREFIX}/opt/libffi/lib/pkgconfig:${PKG_CONFIG_PATH}"
> <https://about.me/evandrix?promo=email_sig&utm_source=product&utm_medium=email_sig&utm_campaign=gmail_api&utm_content=thumb>
> Lee Wei Yeong
> about.me/evandrix
> <https://about.me/evandrix?promo=email_sig&utm_source=product&utm_medium=email_sig&utm_campaign=gmail_api&utm_content=thumb>