public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] android: access02: fix the executable shell path
@ 2017-08-28 22:31 Sandeep Patil
  2017-08-29 12:08 ` Cyril Hrubis
  0 siblings, 1 reply; 5+ messages in thread
From: Sandeep Patil @ 2017-08-28 22:31 UTC (permalink / raw)
  To: ltp

The test generated script used the hardcoded "/bin/sh" shell path
that doesn't exist on Android system. So fix that by using
"_PATH_BSHELL" variable defined in paths.h for both bionic and glibc.

Signed-off-by: Sandeep Patil <sspatil@google.com>
---

FWIW, I tested this both with an Android system as well as on an x86, ubuntu
system to make sure this works with glibc as well as bionic.

 testcases/kernel/syscalls/access/access02.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/access/access02.c b/testcases/kernel/syscalls/access/access02.c
index 0154b83a4..78449ca0b 100644
--- a/testcases/kernel/syscalls/access/access02.c
+++ b/testcases/kernel/syscalls/access/access02.c
@@ -38,6 +38,7 @@
 #include <pwd.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <paths.h>
 #include "tst_test.h"
 
 #define FNAME_F	"file_f"
@@ -187,7 +188,7 @@ static void setup(void)
 	SAFE_TOUCH(FNAME_R, 0444, NULL);
 	SAFE_TOUCH(FNAME_W, 0222, NULL);
 	SAFE_TOUCH(FNAME_X, 0555, NULL);
-	SAFE_FILE_PRINTF(FNAME_X, "#!/bin/sh\n");
+	SAFE_FILE_PRINTF(FNAME_X, "#!%s\n", _PATH_BSHELL);
 
 	SAFE_SYMLINK(FNAME_F, SNAME_F);
 	SAFE_SYMLINK(FNAME_R, SNAME_R);
-- 
2.14.1.342.g6490525c54-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [LTP] [PATCH] android: access02: fix the executable shell path
  2017-08-28 22:31 [LTP] [PATCH] android: access02: fix the executable shell path Sandeep Patil
@ 2017-08-29 12:08 ` Cyril Hrubis
  2017-08-29 15:04   ` Petr Vorel
  0 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2017-08-29 12:08 UTC (permalink / raw)
  To: ltp

Hi!
> The test generated script used the hardcoded "/bin/sh" shell path
> that doesn't exist on Android system. So fix that by using
> "_PATH_BSHELL" variable defined in paths.h for both bionic and glibc.

I checked that the header is defined on musl libc as well and pushed,
thanks.

BTW: There is _PATH_TMP defined in that header as well, is that one present
     on android as well? If so and if it's pointing to something
     sensible we could have used that one in the getcwd test...

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] [PATCH] android: access02: fix the executable shell path
  2017-08-29 12:08 ` Cyril Hrubis
@ 2017-08-29 15:04   ` Petr Vorel
  2017-08-29 15:09     ` Petr Vorel
  0 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2017-08-29 15:04 UTC (permalink / raw)
  To: ltp

Hi,

> BTW: There is _PATH_TMP defined in that header as well, is that one present
>      on android as well? If so and if it's pointing to something
>      sensible we could have used that one in the getcwd test...
_PATH_TMP is defined in all API versions, so possible to use it.


Kind regards,
Petr

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] [PATCH] android: access02: fix the executable shell path
  2017-08-29 15:04   ` Petr Vorel
@ 2017-08-29 15:09     ` Petr Vorel
  2017-09-05 21:49       ` Sandeep Patil
  0 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2017-08-29 15:09 UTC (permalink / raw)
  To: ltp

Hi,

> > BTW: There is _PATH_TMP defined in that header as well, is that one present
> >      on android as well? If so and if it's pointing to something
> >      sensible we could have used that one in the getcwd test...

> _PATH_TMP is defined in all API versions, so possible to use it.
Sorry, it is defined, but has the same value ("/tmp/"), so not much useful for us.
This should be fixed in Android.

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] [PATCH] android: access02: fix the executable shell path
  2017-08-29 15:09     ` Petr Vorel
@ 2017-09-05 21:49       ` Sandeep Patil
  0 siblings, 0 replies; 5+ messages in thread
From: Sandeep Patil @ 2017-09-05 21:49 UTC (permalink / raw)
  To: ltp

On Tue, Aug 29, 2017 at 05:09:03PM +0200, Petr Vorel wrote:
> Hi,
> 
> > > BTW: There is _PATH_TMP defined in that header as well, is that one present
> > >      on android as well? If so and if it's pointing to something
> > >      sensible we could have used that one in the getcwd test...
> 
> > _PATH_TMP is defined in all API versions, so possible to use it.
> Sorry, it is defined, but has the same value ("/tmp/"), so not much useful for us.
> This should be fixed in Android.

No _PATH_TMP isn't defined in bionic, *most* of the library code depends on
$TMPDIR which is set by Init.

(The only exception as far as I see is tempnam() implementation which also
uses _PATH_TMP as a failsafe to $TMPDIR environment variable being available.)

- ssp

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-09-05 21:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-28 22:31 [LTP] [PATCH] android: access02: fix the executable shell path Sandeep Patil
2017-08-29 12:08 ` Cyril Hrubis
2017-08-29 15:04   ` Petr Vorel
2017-08-29 15:09     ` Petr Vorel
2017-09-05 21:49       ` Sandeep Patil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox