Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove 1000 char xattr limit #76

Closed
wants to merge 1 commit into from
Closed

Remove 1000 char xattr limit #76

wants to merge 1 commit into from

Conversation

crrodriguez
Copy link
Contributor

We need to access xattrs much bigger than 1000, up to the size
allowed by the filesystem.

We need to access xattrs much bigger than 1000, up to the size
allowed by the filesystem.
@DeepDiver1975
Copy link

@crrodriguez please have a look at the failing tests - to my understanding the tests should still all be green.
In addition adding a test for xattr wiht more then 1000 chars would be a good thing. THX

@eduardok
Copy link
Owner

Please try this code instead: https://github.com/eduardok/libsmbclient-php/tree/edtests

@crrodriguez
Copy link
Contributor Author

Please try this code instead: https://github.com/eduardok/libsmbclient-php/tree/edtests

This patch is the same thing I had before, but avoided posting it do the different paths needed for old PHP versions, should do exacmle the same thing.

@eduardok
Copy link
Owner

Please try this code instead: https://github.com/eduardok/libsmbclient-php/tree/edtests

This patch is the same thing I had before, but avoided posting it do the different paths needed for old PHP versions, should do exacmle the same thing.

Not sure what you mean by exactly the same since this pull request's code (b8137f6) is quite different from the one I pointed you to (565d0af). It uses no ALLOCA_FLAG/do_alloca, handles different PHP versions, and passes CI (https://travis-ci.org/github/eduardok/libsmbclient-php/builds/748486644).

@crrodriguez
Copy link
Contributor Author

Please try this code instead: https://github.com/eduardok/libsmbclient-php/tree/edtests

This patch is the same thing I had before, but avoided posting it do the different paths needed for old PHP versions, should do exacmle the same thing.

Not sure what you mean by exactly the same since this pull request's code (b8137f6) is quite different from the one I pointed you to (565d0af). It uses no ALLOCA_FLAG/do_alloca, handles different PHP versions, and passes CI (https://travis-ci.org/github/eduardok/libsmbclient-php/builds/748486644).

Sorry if I was unclear, I mean an early version of this request that isn't online was very similar to yours.

if(retsize < 0)
goto fail;

RETVAL_STRING(values);
Copy link
Contributor

@remicollet remicollet Feb 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break support for PHP 5, see deleted line above (and previous comments about duplication)

RETURN_EMPTY_STRING();
}

values = do_alloca(xattr_size + 1, use_heap);
Copy link
Contributor

@remicollet remicollet Feb 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not a simple emalloc ?

BTW, for PHP 7+, will be better to use a zend_string, which will avoid double allocation (RETURN_STR will use the allocated string, while RETURN_STRING allocate a new one)
(and for PHP 5, RETURN_STRING have a duplicate flag to avoid double allocation)


values = do_alloca(xattr_size + 1, use_heap);

retsize = smbc_getxattr(state->ctx, url, name, values, sizeof(values));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sizeof(values) is only the pointer size...

@remicollet remicollet mentioned this pull request Feb 9, 2022
@remicollet
Copy link
Contributor

PR #96 seems better

@eduardok
Copy link
Owner

eduardok commented Apr 1, 2023

Pulled Remi's request, please use release 1.0.7.

@eduardok eduardok closed this Apr 1, 2023
@remicollet
Copy link
Contributor

We need to access xattrs much bigger than 1000, up to the size allowed by the filesystem.

Any idea of what size is needed ?
because dyn alloc doesn't work anymore :(

@crrodriguez
Copy link
Contributor Author

We need to access xattrs much bigger than 1000, up to the size allowed by the filesystem.

Any idea of what size is needed ? because dyn alloc doesn't work anymore :(

64k

@remicollet
Copy link
Contributor

remicollet commented Apr 3, 2023

@crrodriguez thanks (test/feedback on PR #100 welcome)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants