-
Notifications
You must be signed in to change notification settings - Fork 254
ls #1272
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
base: master
Are you sure you want to change the base?
ls #1272
Conversation
08a1db1 to
866b069
Compare
86cb32c to
352937f
Compare
352937f to
52ed32f
Compare
6e05e52 to
afca498
Compare
c69ff9b to
f0e13f5
Compare
4f27d71 to
5ec6add
Compare
fcb5151 to
989b2ab
Compare
989b2ab to
a0b24e5
Compare
2505a9c to
0968836
Compare
|
Did you verify that the testsuites behave identically with and without this set? |
I didn't. Are you worried about any specific commit? |
|
I was worried about the comma_to_list() change. The code seems correct. But it would |
Okay, how about having a separate PR for that change, and then test that one thoroughly there? I prefer doing that after the release, so we can maybe merge the first few commits before the release, and keep the other part for afterwards. |
df8d071 to
dcae3d8
Compare
This is for consistency with how this is done in sgetsgent(). Now we need to make sure that the list is NULL before the first call, which means that the 'grent' structure must be cleared. Since it's a static object, it's already true, but let's be explicit about it. Since we remember the address of the list in grent.gr_mem (which is static), we don't need to keep 'members' being static too, so we get rid of one static thing. Signed-off-by: Alejandro Colomar <alx@kernel.org>
Imitate how this is done in sgetgrent(). BE CAREFUL: The NULL check needs to be performed after *both* build_list() calls, since we need to make sure that either a NULL or a valid pointer is stored in both .sg_adm and .sg_mem, since we'll call free(3) next time sgetsgent() is called. Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Move build_list() to "lib/list.c", where we can reuse it. Signed-off-by: Alejandro Colomar <alx@kernel.org>
In some places we call comma_to_list(), and in others build_list(), and they're essentially the same thing: they transform a comma-separated list into an array of strings. Both of them consider an empty list to have 0 members instead of one. However, they differ in how they treat trailing commas: - comma_to_list() interprets that as an empty field. - build_list() ignores the trailing comma. The behavior of build_list() seems more appropriate, since it allows tools to generate the CSVs more easily. Also, these lists are used to represent user names or group names, so an empty user name makes no sense. This patch makes both functions be more consistent, which will eventually allow us to de-duplicate code. Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
get_gid() will fail to parse a number if the field is empty. Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This name tells better what this API does. The name has a leading 'a', as it allocates memory, and then 'csv2ls' because it parses a CSV into a list. Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
dcae3d8 to
d0c84ec
Compare
I've managed to remove one of the
static, but most of them seem necessary, since these shadow APIs are either libc APIs or similar to libc APIs, and they're specified as using static memory.I've also done a lot of simplification and de-duplication work in surrounding code, especially in code transforming CSVs to lists.
Revisions:
v1b
v1c
v1d
v1e
v1f
v2
v2b
v3
v3b
v3c
v3d
v3e