Skip to contentSkip to conversation

android: access02: fix the executable shell path

PATCH New Sandeep Patil 3 participants 5 messages Aug 28, 2017 – Sep 5, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 android: access02: fix the executable shell path

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.

---

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(-)
testcases/kernel/syscalls/access/access02.c +2 -1
index 0154b83a4..78449ca0b 100644
@@ -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);
Signature · 1 line
2.14.1.342.g6490525c54-goog
#1 lore raw

PATCH 1/1 android: access02: fix the executable shell path

Hi!

Quoted 3 lines

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...

Signature · 2 lines
Cyril Hrubis
[email protected]
#2 lore raw

PATCH 1/1 android: access02: fix the executable shell path

Hi,

Quoted 3 lines

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

#3 lore raw

PATCH 1/1 android: access02: fix the executable shell path

Hi,

Quoted 5 lines
Quoted 3 lines

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

#4 lore raw

PATCH 1/1 android: access02: fix the executable shell path

Quoted 9 lines · Petr Vorel

Hi,

Quoted 5 lines
Quoted 3 lines

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