safe_open expects a mode when creating or using a temporary file, which is read via a variadic argument. Add the mode when it is missing for a few tests.
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com --- .../kernel/syscalls/name_to_handle_at/name_to_handle_at01.c | 2 +- .../kernel/syscalls/open_by_handle_at/open_by_handle_at01.c | 2 +- testcases/kernel/syscalls/utimensat/utimensat01.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c index 9677b06719e3..6535fdf5c0ed 100644 --- a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c +++ b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c @@ -72,7 +72,7 @@ static void setup(void) dir_fd = SAFE_OPEN(TEST_DIR, O_DIRECTORY); SAFE_CHDIR(TEST_DIR); SAFE_TOUCH(TEST_FILE, 0600, NULL); - file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT); + file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT, 0600); fhp = allocate_file_handle(AT_FDCWD, TEST_FILE); }
diff --git a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c b/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c index 76be720cad78..6171229f0b6f 100644 --- a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c +++ b/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c @@ -55,7 +55,7 @@ static void setup(void) dir_fd = SAFE_OPEN(TEST_DIR, O_DIRECTORY); SAFE_CHDIR(TEST_DIR); SAFE_TOUCH(TEST_FILE, 0600, NULL); - file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT); + file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT, 0600);
f_fhp = allocate_file_handle(AT_FDCWD, TEST_FILE); d_fhp = allocate_file_handle(AT_FDCWD, TEST_FILE); diff --git a/testcases/kernel/syscalls/utimensat/utimensat01.c b/testcases/kernel/syscalls/utimensat/utimensat01.c index ac267e7d9f84..ce9d12bd5a3f 100644 --- a/testcases/kernel/syscalls/utimensat/utimensat01.c +++ b/testcases/kernel/syscalls/utimensat/utimensat01.c @@ -233,7 +233,7 @@ static void run(unsigned int i) dfd = SAFE_OPEN(TEST_DIR, tc->oflags);
if (tc->pathname) { - fd = SAFE_OPEN(tc->pathname, O_WRONLY | O_CREAT); + fd = SAFE_OPEN(tc->pathname, O_WRONLY | O_CREAT, 0600); pathname = tc->pathname; SAFE_CHMOD(tc->pathname, tc->mode); reset_time(pathname, dfd, tc->flags, i);
On Tue, Mar 07, 2023 at 01:53:39PM +0000, Teo Couprie Diaz wrote:
safe_open expects a mode when creating or using a temporary file, which is read via a variadic argument. Add the mode when it is missing for a few tests.
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com
.../kernel/syscalls/name_to_handle_at/name_to_handle_at01.c | 2 +- .../kernel/syscalls/open_by_handle_at/open_by_handle_at01.c | 2 +- testcases/kernel/syscalls/utimensat/utimensat01.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c index 9677b06719e3..6535fdf5c0ed 100644 --- a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c +++ b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c @@ -72,7 +72,7 @@ static void setup(void) dir_fd = SAFE_OPEN(TEST_DIR, O_DIRECTORY); SAFE_CHDIR(TEST_DIR); SAFE_TOUCH(TEST_FILE, 0600, NULL);
- file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT);
- file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT, 0600); fhp = allocate_file_handle(AT_FDCWD, TEST_FILE);
} diff --git a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c b/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c index 76be720cad78..6171229f0b6f 100644 --- a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c +++ b/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c @@ -55,7 +55,7 @@ static void setup(void) dir_fd = SAFE_OPEN(TEST_DIR, O_DIRECTORY); SAFE_CHDIR(TEST_DIR); SAFE_TOUCH(TEST_FILE, 0600, NULL);
- file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT);
- file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT, 0600);
f_fhp = allocate_file_handle(AT_FDCWD, TEST_FILE); d_fhp = allocate_file_handle(AT_FDCWD, TEST_FILE); diff --git a/testcases/kernel/syscalls/utimensat/utimensat01.c b/testcases/kernel/syscalls/utimensat/utimensat01.c index ac267e7d9f84..ce9d12bd5a3f 100644 --- a/testcases/kernel/syscalls/utimensat/utimensat01.c +++ b/testcases/kernel/syscalls/utimensat/utimensat01.c @@ -233,7 +233,7 @@ static void run(unsigned int i) dfd = SAFE_OPEN(TEST_DIR, tc->oflags); if (tc->pathname) {
fd = SAFE_OPEN(tc->pathname, O_WRONLY | O_CREAT);
fd = SAFE_OPEN(tc->pathname, O_WRONLY | O_CREAT, 0600);
As this one is using O_WRONLY, shouldn't the mode be 0200 ?
Otherwise the change looks good.
--- BR B.
pathname = tc->pathname; SAFE_CHMOD(tc->pathname, tc->mode); reset_time(pathname, dfd, tc->flags, i);
-- 2.25.1
linux-morello-ltp mailing list -- linux-morello-ltp@op-lists.linaro.org To unsubscribe send an email to linux-morello-ltp-leave@op-lists.linaro.org
On 09/03/2023 13:36, Beata Michalska wrote:
On Tue, Mar 07, 2023 at 01:53:39PM +0000, Teo Couprie Diaz wrote:
safe_open expects a mode when creating or using a temporary file, which is read via a variadic argument. Add the mode when it is missing for a few tests.
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com
.../kernel/syscalls/name_to_handle_at/name_to_handle_at01.c | 2 +- .../kernel/syscalls/open_by_handle_at/open_by_handle_at01.c | 2 +- testcases/kernel/syscalls/utimensat/utimensat01.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c index 9677b06719e3..6535fdf5c0ed 100644 --- a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c +++ b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c @@ -72,7 +72,7 @@ static void setup(void) dir_fd = SAFE_OPEN(TEST_DIR, O_DIRECTORY); SAFE_CHDIR(TEST_DIR); SAFE_TOUCH(TEST_FILE, 0600, NULL);
- file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT);
- file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT, 0600); fhp = allocate_file_handle(AT_FDCWD, TEST_FILE); }
diff --git a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c b/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c index 76be720cad78..6171229f0b6f 100644 --- a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c +++ b/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c @@ -55,7 +55,7 @@ static void setup(void) dir_fd = SAFE_OPEN(TEST_DIR, O_DIRECTORY); SAFE_CHDIR(TEST_DIR); SAFE_TOUCH(TEST_FILE, 0600, NULL);
- file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT);
- file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT, 0600);
f_fhp = allocate_file_handle(AT_FDCWD, TEST_FILE); d_fhp = allocate_file_handle(AT_FDCWD, TEST_FILE); diff --git a/testcases/kernel/syscalls/utimensat/utimensat01.c b/testcases/kernel/syscalls/utimensat/utimensat01.c index ac267e7d9f84..ce9d12bd5a3f 100644 --- a/testcases/kernel/syscalls/utimensat/utimensat01.c +++ b/testcases/kernel/syscalls/utimensat/utimensat01.c @@ -233,7 +233,7 @@ static void run(unsigned int i) dfd = SAFE_OPEN(TEST_DIR, tc->oflags); if (tc->pathname) {
fd = SAFE_OPEN(tc->pathname, O_WRONLY | O_CREAT);
fd = SAFE_OPEN(tc->pathname, O_WRONLY | O_CREAT, 0600);
As this one is using O_WRONLY, shouldn't the mode be 0200 ?
That would be more appropriate indeed, thanks for pointing it out !
Otherwise the change looks good.
As you only have a minor comment, happy for you to change it when merging if you'd prefer.
Thanks for the review, Téo
BR B.
pathname = tc->pathname; SAFE_CHMOD(tc->pathname, tc->mode); reset_time(pathname, dfd, tc->flags, i);
-- 2.25.1
linux-morello-ltp mailing list -- linux-morello-ltp@op-lists.linaro.org To unsubscribe send an email to linux-morello-ltp-leave@op-lists.linaro.org
On 09-03-2023 13:36, Beata Michalska wrote:
On Tue, Mar 07, 2023 at 01:53:39PM +0000, Teo Couprie Diaz wrote:
safe_open expects a mode when creating or using a temporary file, which is read via a variadic argument. Add the mode when it is missing for a few tests.
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com
.../kernel/syscalls/name_to_handle_at/name_to_handle_at01.c | 2 +- .../kernel/syscalls/open_by_handle_at/open_by_handle_at01.c | 2 +- testcases/kernel/syscalls/utimensat/utimensat01.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c index 9677b06719e3..6535fdf5c0ed 100644 --- a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c +++ b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c @@ -72,7 +72,7 @@ static void setup(void) dir_fd = SAFE_OPEN(TEST_DIR, O_DIRECTORY); SAFE_CHDIR(TEST_DIR); SAFE_TOUCH(TEST_FILE, 0600, NULL);
- file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT);
- file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT, 0600); fhp = allocate_file_handle(AT_FDCWD, TEST_FILE); }
diff --git a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c b/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c index 76be720cad78..6171229f0b6f 100644 --- a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c +++ b/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c @@ -55,7 +55,7 @@ static void setup(void) dir_fd = SAFE_OPEN(TEST_DIR, O_DIRECTORY); SAFE_CHDIR(TEST_DIR); SAFE_TOUCH(TEST_FILE, 0600, NULL);
- file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT);
- file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT, 0600);
f_fhp = allocate_file_handle(AT_FDCWD, TEST_FILE); d_fhp = allocate_file_handle(AT_FDCWD, TEST_FILE); diff --git a/testcases/kernel/syscalls/utimensat/utimensat01.c b/testcases/kernel/syscalls/utimensat/utimensat01.c index ac267e7d9f84..ce9d12bd5a3f 100644 --- a/testcases/kernel/syscalls/utimensat/utimensat01.c +++ b/testcases/kernel/syscalls/utimensat/utimensat01.c @@ -233,7 +233,7 @@ static void run(unsigned int i) dfd = SAFE_OPEN(TEST_DIR, tc->oflags); if (tc->pathname) {
fd = SAFE_OPEN(tc->pathname, O_WRONLY | O_CREAT);
fd = SAFE_OPEN(tc->pathname, O_WRONLY | O_CREAT, 0600);
As this one is using O_WRONLY, shouldn't the mode be 0200 ?
Otherwise the change looks good.
Good find, I missed them in my previous SAFE_OPEN patch. I agree, it looks good! I think this change can be upstreamed if you want.
Thanks, Tudor
BR B.
pathname = tc->pathname; SAFE_CHMOD(tc->pathname, tc->mode); reset_time(pathname, dfd, tc->flags, i);
-- 2.25.1
linux-morello-ltp mailing list -- linux-morello-ltp@op-lists.linaro.org To unsubscribe send an email to linux-morello-ltp-leave@op-lists.linaro.org
linux-morello-ltp mailing list -- linux-morello-ltp@op-lists.linaro.org To unsubscribe send an email to linux-morello-ltp-leave@op-lists.linaro.org
On 13/03/2023 10:04, Tudor Cretu wrote:
On 09-03-2023 13:36, Beata Michalska wrote:
On Tue, Mar 07, 2023 at 01:53:39PM +0000, Teo Couprie Diaz wrote:
safe_open expects a mode when creating or using a temporary file, which is read via a variadic argument. Add the mode when it is missing for a few tests.
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com
.../kernel/syscalls/name_to_handle_at/name_to_handle_at01.c | 2 +- .../kernel/syscalls/open_by_handle_at/open_by_handle_at01.c | 2 +- testcases/kernel/syscalls/utimensat/utimensat01.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c index 9677b06719e3..6535fdf5c0ed 100644 --- a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c +++ b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c @@ -72,7 +72,7 @@ static void setup(void) dir_fd = SAFE_OPEN(TEST_DIR, O_DIRECTORY); SAFE_CHDIR(TEST_DIR); SAFE_TOUCH(TEST_FILE, 0600, NULL); - file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT); + file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT, 0600); fhp = allocate_file_handle(AT_FDCWD, TEST_FILE); } diff --git a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c b/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c index 76be720cad78..6171229f0b6f 100644 --- a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c +++ b/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c @@ -55,7 +55,7 @@ static void setup(void) dir_fd = SAFE_OPEN(TEST_DIR, O_DIRECTORY); SAFE_CHDIR(TEST_DIR); SAFE_TOUCH(TEST_FILE, 0600, NULL); - file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT); + file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT, 0600); f_fhp = allocate_file_handle(AT_FDCWD, TEST_FILE); d_fhp = allocate_file_handle(AT_FDCWD, TEST_FILE); diff --git a/testcases/kernel/syscalls/utimensat/utimensat01.c b/testcases/kernel/syscalls/utimensat/utimensat01.c index ac267e7d9f84..ce9d12bd5a3f 100644 --- a/testcases/kernel/syscalls/utimensat/utimensat01.c +++ b/testcases/kernel/syscalls/utimensat/utimensat01.c @@ -233,7 +233,7 @@ static void run(unsigned int i) dfd = SAFE_OPEN(TEST_DIR, tc->oflags); if (tc->pathname) { - fd = SAFE_OPEN(tc->pathname, O_WRONLY | O_CREAT); + fd = SAFE_OPEN(tc->pathname, O_WRONLY | O_CREAT, 0600);
As this one is using O_WRONLY, shouldn't the mode be 0200 ?
Otherwise the change looks good.
Good find, I missed them in my previous SAFE_OPEN patch. I agree, it looks good! I think this change can be upstreamed if you want.
Thanks, Tudor
Thanks for the review Tudor !
I was waiting on the patch to be merge before upstreaming, in case anyone had something else to say ! :)
Best regards Téo
BR B.
pathname = tc->pathname; SAFE_CHMOD(tc->pathname, tc->mode); reset_time(pathname, dfd, tc->flags, i); -- 2.25.1
linux-morello-ltp mailing list -- linux-morello-ltp@op-lists.linaro.org To unsubscribe send an email to linux-morello-ltp-leave@op-lists.linaro.org
linux-morello-ltp mailing list -- linux-morello-ltp@op-lists.linaro.org To unsubscribe send an email to linux-morello-ltp-leave@op-lists.linaro.org
On Tue, Mar 14, 2023 at 09:54:08AM +0000, Teo Couprie Diaz wrote:
On 13/03/2023 10:04, Tudor Cretu wrote:
On 09-03-2023 13:36, Beata Michalska wrote:
On Tue, Mar 07, 2023 at 01:53:39PM +0000, Teo Couprie Diaz wrote:
safe_open expects a mode when creating or using a temporary file, which is read via a variadic argument. Add the mode when it is missing for a few tests.
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com
.../kernel/syscalls/name_to_handle_at/name_to_handle_at01.c | 2 +- .../kernel/syscalls/open_by_handle_at/open_by_handle_at01.c | 2 +- testcases/kernel/syscalls/utimensat/utimensat01.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c index 9677b06719e3..6535fdf5c0ed 100644 --- a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c +++ b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c @@ -72,7 +72,7 @@ static void setup(void) dir_fd = SAFE_OPEN(TEST_DIR, O_DIRECTORY); SAFE_CHDIR(TEST_DIR); SAFE_TOUCH(TEST_FILE, 0600, NULL); - file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT); + file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT, 0600); fhp = allocate_file_handle(AT_FDCWD, TEST_FILE); } diff --git a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c b/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c index 76be720cad78..6171229f0b6f 100644 --- a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c +++ b/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c @@ -55,7 +55,7 @@ static void setup(void) dir_fd = SAFE_OPEN(TEST_DIR, O_DIRECTORY); SAFE_CHDIR(TEST_DIR); SAFE_TOUCH(TEST_FILE, 0600, NULL); - file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT); + file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT, 0600); f_fhp = allocate_file_handle(AT_FDCWD, TEST_FILE); d_fhp = allocate_file_handle(AT_FDCWD, TEST_FILE); diff --git a/testcases/kernel/syscalls/utimensat/utimensat01.c b/testcases/kernel/syscalls/utimensat/utimensat01.c index ac267e7d9f84..ce9d12bd5a3f 100644 --- a/testcases/kernel/syscalls/utimensat/utimensat01.c +++ b/testcases/kernel/syscalls/utimensat/utimensat01.c @@ -233,7 +233,7 @@ static void run(unsigned int i) dfd = SAFE_OPEN(TEST_DIR, tc->oflags); if (tc->pathname) { - fd = SAFE_OPEN(tc->pathname, O_WRONLY | O_CREAT); + fd = SAFE_OPEN(tc->pathname, O_WRONLY | O_CREAT, 0600);
As this one is using O_WRONLY, shouldn't the mode be 0200 ?
Otherwise the change looks good.
Good find, I missed them in my previous SAFE_OPEN patch. I agree, it looks good! I think this change can be upstreamed if you want.
Thanks, Tudor
Thanks for the review Tudor !
I was waiting on the patch to be merge before upstreaming, in case anyone had something else to say ! :)
Now merged with the small change for mode to write-only (as discussed).
--- BR B.
Best regards Téo
BR B.
pathname = tc->pathname; SAFE_CHMOD(tc->pathname, tc->mode); reset_time(pathname, dfd, tc->flags, i); -- 2.25.1
linux-morello-ltp mailing list -- linux-morello-ltp@op-lists.linaro.org To unsubscribe send an email to linux-morello-ltp-leave@op-lists.linaro.org
linux-morello-ltp mailing list -- linux-morello-ltp@op-lists.linaro.org To unsubscribe send an email to linux-morello-ltp-leave@op-lists.linaro.org
linux-morello-ltp@op-lists.linaro.org