diff options
| -rw-r--r-- | 3_01.txt (renamed from 3_0.txt) | 10 | ||||
| -rw-r--r-- | REFLECTION | 31 | ||||
| -rw-r--r-- | php-pecl-xattr.spec | 47 | ||||
| -rw-r--r-- | xattr-php7.patch | 222 | 
4 files changed, 292 insertions, 18 deletions
@@ -1,6 +1,6 @@  --------------------------------------------------------------------  -                  The PHP License, version 3.0 -Copyright (c) 1999 - 2006 The PHP Group. All rights reserved. +                  The PHP License, version 3.01 +Copyright (c) 1999 - 2014 The PHP Group. All rights reserved.  --------------------------------------------------------------------   Redistribution and use in source and binary forms, with or without @@ -38,8 +38,8 @@ are met:    6. Redistributions of any form whatsoever must retain the following       acknowledgment: -     "This product includes PHP, freely available from -     <http://www.php.net/>". +     "This product includes PHP software, freely available from +     <http://www.php.net/software/>".  THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND   ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, @@ -64,5 +64,5 @@ The PHP Group can be contacted via Email at group@php.net.  For more information on the PHP Group and the PHP project,   please see <http://www.php.net>. -This product includes the Zend Engine, freely available at +PHP includes the Zend Engine, freely available at  <http://www.zend.com>. @@ -1,4 +1,4 @@ -Extension [ <persistent> extension #142 xattr version 1.2.0 ] { +Extension [ <persistent> extension #86 xattr version 1.2.0 ] {    - Constants [4] {      Constant [ integer XATTR_ROOT ] { 2 } @@ -9,14 +9,43 @@ Extension [ <persistent> extension #142 xattr version 1.2.0 ] {    - Functions {      Function [ <internal:xattr> function xattr_set ] { + +      - Parameters [4] { +        Parameter #0 [ <required> $path ] +        Parameter #1 [ <required> $name ] +        Parameter #2 [ <required> $value ] +        Parameter #3 [ <optional> $flags ] +      }      }      Function [ <internal:xattr> function xattr_get ] { + +      - Parameters [3] { +        Parameter #0 [ <required> $path ] +        Parameter #1 [ <required> $name ] +        Parameter #2 [ <optional> $flags ] +      }      }      Function [ <internal:xattr> function xattr_remove ] { + +      - Parameters [3] { +        Parameter #0 [ <required> $path ] +        Parameter #1 [ <required> $name ] +        Parameter #2 [ <optional> $flags ] +      }      }      Function [ <internal:xattr> function xattr_list ] { + +      - Parameters [2] { +        Parameter #0 [ <required> $path ] +        Parameter #1 [ <optional> $flags ] +      }      }      Function [ <internal:xattr> function xattr_supported ] { + +      - Parameters [2] { +        Parameter #0 [ <required> $path ] +        Parameter #1 [ <optional> $flags ] +      }      }    }  } diff --git a/php-pecl-xattr.spec b/php-pecl-xattr.spec index a99eedf..8e30313 100644 --- a/php-pecl-xattr.spec +++ b/php-pecl-xattr.spec @@ -22,7 +22,7 @@  Summary:        Extended attributes  Name:           %{?scl_prefix}php-pecl-%{pecl_name}  Version:        1.2.0 -Release:        5%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}.1 +Release:        6%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}  License:        PHP  Group:          Development/Languages  URL:            http://pecl.php.net/package/%{pecl_name} @@ -30,15 +30,15 @@ Source0:        http://pecl.php.net/get/%{pecl_name}-%{version}.tgz  # https://bugs.php.net/65842 Please Provides LICENSE file  # URL from xattr.c headers -Source1:        http://www.php.net/license/3_0.txt +Source1:        http://www.php.net/license/3_01.txt + +Patch0:         %{pecl_name}-php7.patch  BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)  BuildRequires:  %{?scl_prefix}php-devel  BuildRequires:  %{?scl_prefix}php-pear  BuildRequires:  libattr-devel -Requires(post): %{__pecl} -Requires(postun): %{__pecl}  Requires:       %{?scl_prefix}php(zend-abi) = %{php_zend_api}  Requires:       %{?scl_prefix}php(api) = %{php_core_api}  %{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} @@ -62,6 +62,10 @@ Obsoletes:     php55w-pecl-%{pecl_name} <= %{version}  Obsoletes:     php56u-pecl-%{pecl_name} <= %{version}  Obsoletes:     php56w-pecl-%{pecl_name} <= %{version}  %endif +%if "%{php_version}" > "7.0" +Obsoletes:     php70u-pecl-%{pecl_name} <= %{version} +Obsoletes:     php70w-pecl-%{pecl_name} <= %{version} +%endif  %endif  %if 0%{?fedora} < 20 && 0%{?rhel} < 7 @@ -75,13 +79,21 @@ Obsoletes:     php56w-pecl-%{pecl_name} <= %{version}  This package allows to manipulate extended attributes on filesystems that  support them. Requires libattr from Linux XFS project. +Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection}. +  %prep  %setup -q -c + +# Don't install/register tests +sed -e 's/role="test"/role="src"/' -i package.xml + +  mv %{pecl_name}-%{version} NTS  cd NTS  cp %{SOURCE1} LICENSE +%patch0 -p3 -b .php7  # http://svn.php.net/viewvc?view=revision&revision=331704  sed -e 's:/lib:/$PHP_LIBDIR:' -i config.m4 @@ -142,22 +154,27 @@ make -C ZTS install INSTALL_ROOT=%{buildroot}  install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}  %endif -# Test & Documentation +# Documentation  cd NTS -for i in $(grep 'role="test"' ../package.xml | sed -e 's/^.*name="//;s/".*$//') -do install -Dpm 644 $i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i -done  for i in LICENSE $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//')  do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i  done -%post -%{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : +# when pear installed alone, after us +%triggerin -- %{?scl_prefix}php-pear +if [ -x %{__pecl} ] ; then +    %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : +fi +# posttrans as pear can be installed after us +%posttrans +if [ -x %{__pecl} ] ; then +    %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : +fi  %postun -if [ $1 -eq 0 ] ; then +if [ $1 -eq 0 -a -x %{__pecl} ] ; then      %{pecl_uninstall} %{pecl_name} >/dev/null || :  fi @@ -182,9 +199,10 @@ rm -rf %{buildroot}  %files  %defattr(-,root,root,-) +%{?_licensedir:%license NTS/LICENSE}  %doc %{pecl_docdir}/%{pecl_name} -%doc %{pecl_testdir}/%{pecl_name}  %{pecl_xmldir}/%{name}.xml +  %config(noreplace) %{php_inidir}/%{ini_name}  %{php_extdir}/%{pecl_name}.so @@ -195,6 +213,11 @@ rm -rf %{buildroot}  %changelog +* Mon Apr  6 2015 Remi Collet <remi@fedoraproject.org> - 1.2.0-6 +- add fix for PHP-7 +- drop runtime dependency on pear, new scriptlets +- don't install/register tests +  * Wed Dec 24 2014 Remi Collet <remi@fedoraproject.org> - 1.2.0-5.1  - Fedora 21 SCL mass rebuild diff --git a/xattr-php7.patch b/xattr-php7.patch new file mode 100644 index 0000000..fbd2285 --- /dev/null +++ b/xattr-php7.patch @@ -0,0 +1,222 @@ +--- pecl/xattr/trunk/php_xattr.h	2015/04/06 16:58:20	336402 ++++ pecl/xattr/trunk/php_xattr.h	2015/04/06 17:01:25	336403 +@@ -1,13 +1,13 @@ + /* +   +----------------------------------------------------------------------+ +-  | PHP Version 5                                                        | ++  | PHP Version 5, 7                                                     | +   +----------------------------------------------------------------------+ +-  | Copyright (c) 1997-2004 The PHP Group                                | ++  | Copyright (c) 1997-2015 The PHP Group                                | +   +----------------------------------------------------------------------+ +-  | This source file is subject to version 3.0 of the PHP license,       | ++  | This source file is subject to version 3.01 of the PHP license,      | +   | that is bundled with this package in the file LICENSE, and is        | +   | available through the world-wide-web at the following url:           | +-  | http://www.php.net/license/3_0.txt.                                  | ++  | http://www.php.net/license/3_01.txt.                                 | +   | If you did not receive a copy of the PHP license and are unable to   | +   | obtain it through the world-wide-web, please send a note to          | +   | license@php.net so we can mail you a copy immediately.               | +@@ -45,6 +45,17 @@ + PHP_FUNCTION(xattr_list); + PHP_FUNCTION(xattr_supported); +  ++#if PHP_MAJOR_VERSION < 7 ++typedef long zend_long; ++typedef int strsize_t; ++#define _RETVAL_STRINGL(s,l,d) RETVAL_STRINGL(s,l,d) ++#define _RETURN_STRINGL(s,l,d) RETURN_STRINGL(s,l,d) ++#else ++typedef size_t strsize_t; ++#define _RETVAL_STRINGL(s,l,d) { RETVAL_STRINGL(s,l); if (!d) efree(s); } ++#define _RETURN_STRINGL(s,l,d) { _RETVAL_STRINGL(s,l,d); return; } ++#endif ++ + #endif	/* PHP_XATTR_H */ +  +  +--- pecl/xattr/trunk/xattr.c	2015/04/06 16:58:20	336402 ++++ pecl/xattr/trunk/xattr.c	2015/04/06 17:01:25	336403 +@@ -1,13 +1,13 @@ + /* +   +----------------------------------------------------------------------+ +-  | PHP Version 5                                                        | ++  | PHP Version 5, 7                                                     | +   +----------------------------------------------------------------------+ +-  | Copyright (c) 1997-2004 The PHP Group                                | ++  | Copyright (c) 1997-2015 The PHP Group                                | +   +----------------------------------------------------------------------+ +-  | This source file is subject to version 3.0 of the PHP license,       | ++  | This source file is subject to version 3.01 of the PHP license,      | +   | that is bundled with this package in the file LICENSE, and is        | +   | available through the world-wide-web at the following url:           | +-  | http://www.php.net/license/3_0.txt.                                  | ++  | http://www.php.net/license/3_01.txt                                  | +   | If you did not receive a copy of the PHP license and are unable to   | +   | obtain it through the world-wide-web, please send a note to          | +   | license@php.net so we can mail you a copy immediately.               | +@@ -43,17 +43,39 @@ + #include <sys/types.h> + #include <attr/xattr.h> +  ++ZEND_BEGIN_ARG_INFO_EX(xattr_set_arginfo, 0, 0, 3) ++  ZEND_ARG_INFO(0, path) ++  ZEND_ARG_INFO(0, name) ++  ZEND_ARG_INFO(0, value) ++  ZEND_ARG_INFO(0, flags) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(xattr_get_arginfo, 0, 0, 2) ++  ZEND_ARG_INFO(0, path) ++  ZEND_ARG_INFO(0, name) ++  ZEND_ARG_INFO(0, flags) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(xattr_list_arginfo, 0, 0, 1) ++  ZEND_ARG_INFO(0, path) ++  ZEND_ARG_INFO(0, flags) ++ZEND_END_ARG_INFO() ++ + /* {{{ xattr_functions[] +  * +  * Every user visible function must have an entry in xattr_functions[]. +  */ + zend_function_entry xattr_functions[] = { +-	PHP_FE(xattr_set,		NULL) +-	PHP_FE(xattr_get,		NULL) +-	PHP_FE(xattr_remove,	NULL) +-	PHP_FE(xattr_list,		NULL) +-	PHP_FE(xattr_supported,	NULL) +-	{NULL, NULL, NULL}	/* Must be the last line in xattr_functions[] */ ++	PHP_FE(xattr_set,       xattr_set_arginfo) ++	PHP_FE(xattr_get,       xattr_get_arginfo) ++	PHP_FE(xattr_remove,    xattr_get_arginfo) ++	PHP_FE(xattr_list,      xattr_list_arginfo) ++	PHP_FE(xattr_supported,	xattr_list_arginfo) ++#ifdef PHP_FE_END ++	PHP_FE_END ++#else ++	{ NULL, NULL, NULL } ++#endif + }; + /* }}} */ +  +@@ -112,7 +134,9 @@ + 	char *attr_name = NULL; + 	char *attr_value = NULL; + 	char *path = NULL; +-	int error, tmp, value_len, flags = 0; ++	int error; ++	zend_long flags = 0; ++	strsize_t tmp, value_len; +  + 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|l", &path, &tmp, &attr_name, &tmp, &attr_value, &value_len, &flags) == FAILURE) { + 		return; +@@ -131,7 +155,7 @@ + 	flags &= ATTR_ROOT | ATTR_DONTFOLLOW | ATTR_CREATE | ATTR_REPLACE;  + 	 + 	/* Attempt to set an attribute, warn if failed. */  +-	error = attr_set(path, attr_name, attr_value, value_len, flags); ++	error = attr_set(path, attr_name, attr_value, (int)value_len, (int)flags); + 	if (error == -1) { + 		switch (errno) { + 			case E2BIG: +@@ -164,8 +188,10 @@ + 	char *attr_name = NULL; + 	char *attr_value = NULL; + 	char *path = NULL; +-	int error, tmp, flags = 0; +-	size_t buffer_size = XATTR_BUFFER_SIZE; ++	int error; ++	strsize_t tmp; ++	zend_long flags = 0; ++	int buffer_size = XATTR_BUFFER_SIZE; +  + 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &path, &tmp, &attr_name, &tmp, &flags) == FAILURE) { + 		return; +@@ -192,7 +218,7 @@ + 	 * If buffer is too small then attr_get sets errno to E2BIG and tells us + 	 * how many bytes are required by setting buffer_size variable. + 	 */ +-	error = attr_get(path, attr_name, attr_value, &buffer_size, flags); ++	error = attr_get(path, attr_name, attr_value, &buffer_size, (int)flags); +  + 	/*  + 	 * Loop is necessary in case that someone edited extended attributes +@@ -203,13 +229,14 @@ + 		if (!attr_value) + 			RETURN_FALSE; + 		 +-		error = attr_get(path, attr_name, attr_value, &buffer_size, flags);		 ++		error = attr_get(path, attr_name, attr_value, &buffer_size, (int)flags); + 	} +  + 	/* Return a string if everything is ok */ + 	if (!error) { +-		attr_value = erealloc(attr_value, buffer_size); +-		RETURN_STRINGL(attr_value, buffer_size, 0); ++		_RETVAL_STRINGL(attr_value, buffer_size, 1); /* copy + free instead of realloc */ ++		efree(attr_value); ++		return; + 	} + 	 + 	/* Error handling part */ +@@ -240,8 +267,10 @@ +    Checks if filesystem supports extended attributes */ + PHP_FUNCTION(xattr_supported) + { +-	char *buffer, *path = NULL; +-	int error, tmp, flags = 0; ++	char *buffer="", *path = NULL; ++	int error; ++	strsize_t tmp; ++	zend_long flags = 0; +  + 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &tmp, &flags) == FAILURE) { + 		return; +@@ -290,7 +319,9 @@ + { + 	char *attr_name = NULL; + 	char *path = NULL; +-	int error, tmp, flags = 0; ++	int error; ++	strsize_t tmp; ++	zend_long flags = 0; + 	 + 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &path, &tmp, &attr_name, &tmp, &flags) == FAILURE) { + 		return; +@@ -309,7 +340,7 @@ + 	flags &= ATTR_ROOT | ATTR_DONTFOLLOW;  + 	 + 	/* Attempt to remove an attribute, warn if failed. */  +-	error = attr_remove(path, attr_name, flags); ++	error = attr_remove(path, attr_name, (int)flags); + 	if (error == -1) { + 		switch (errno) { + 			case E2BIG: +@@ -341,8 +372,10 @@ + { + 	char *buffer, *path = NULL; + 	char *p, *prefix; +-	int error, tmp, flags = 0; +-	ssize_t i = 0, buffer_size = XATTR_BUFFER_SIZE; ++	int error; ++	strsize_t tmp; ++	zend_long flags = 0; ++	size_t i = 0, buffer_size = XATTR_BUFFER_SIZE; + 	size_t len, prefix_len; + 	 + 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &tmp, &flags) == FAILURE) { +@@ -442,7 +475,11 @@ + 	while (i != buffer_size) { + 		len = strlen(p) + 1;	/* +1 for NULL */ + 		if (strstr(p, prefix) == p) { ++#if PHP_MAJOR_VERSION < 7 + 			add_next_index_stringl(return_value, p + prefix_len, len - 1 - prefix_len, 1); ++#else ++			add_next_index_stringl(return_value, p + prefix_len, len - 1 - prefix_len); ++#endif + 		} + 		 + 		p += len;  | 
