From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] Access02 and use of system() library function
Date: Mon, 20 Mar 2017 12:11:28 +0100 [thread overview]
Message-ID: <20170320111128.GA3322@rei.lan> (raw)
In-Reply-To: <beacb487-181d-2d9c-380a-128b985b2250@gezedo.com>
Hi!
> in order to check the actual executable mode of a file, access02 calls system() library function.
>
> The test fails when the return value of system() is not 0. Shouldn't the return value being tested only for its sign instead (and even versus -1 only) ?
>
> The system() function returns -1 in case of error, and the return value of the command otherwise. Even in the case the command returns non-zero value, its execution is positively checked, but access02 fails because the return value is not 0.
>
> This corner case happens when the shell is busybox's hush. Hush uses execvp to execute the test_file3, this leads the kernel to return ENOEXEC (bad exec format). Then execvp tries to execute the shell "/bin/sh" with the name of the file "./test_file3" as argv[0]. Then busybox returns that no such an applet does exist, and terminates with error code 127.
What LTP version is this? The access02 test was rewritten some time ago and
there is no test_file3 since commit:
commit adb3e23d9de5f8ff54d2395112f79f25c36cf598
Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
Date: Wed Jul 20 18:44:39 2016 +0800
syscalls/access02: reconstruct and convert to new API
Which is included in last to stable releases....
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2017-03-20 11:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-16 14:04 [LTP] Access02 and use of system() library function Laurent GONZALEZ
2017-03-20 11:11 ` Cyril Hrubis [this message]
2017-03-20 12:22 ` Laurent GONZALEZ
2017-03-30 14:19 ` Cyril Hrubis
2017-03-31 7:58 ` Laurent GONZALEZ
2017-03-31 11:29 ` Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170320111128.GA3322@rei.lan \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox