Skip to content
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

Tweaks needed to shell script wrapper on Ubuntu 16.04 #6

Closed
nickcrabtree opened this issue Dec 21, 2016 · 1 comment
Closed

Tweaks needed to shell script wrapper on Ubuntu 16.04 #6

nickcrabtree opened this issue Dec 21, 2016 · 1 comment

Comments

@nickcrabtree
Copy link

Didn't work out-of-the-box on Ubuntu 16.04: [[ test not supported in vanilla /bin/sh, and the .so is not executable so the file test failed.

Fixed by making these edits:

--- soft/ksm_preload/ksm-wrapper        2016-12-21 12:42:43.590732436 +0000
+++ /usr/local/bin/ksm-wrapper  2016-12-21 12:59:28.366223605 +0000
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # Runs the provided executable with ksm-preload.so , which enables KSM
 # on heap-allocated memory.
 
@@ -22,12 +22,13 @@
 readonly KSM_SO_GIT="${KSM_PATH}/libksm_preload.so"
 readonly KSM_SO_CMAKE="${KSM_PATH}/../share/ksm_preload/libksm_preload.so"
 
-if  [[ -x "${KSM_SO_GIT}" ]]; then
+if  [[ -s "${KSM_SO_GIT}" ]]; then
     readonly KSM_SO="${KSM_SO_GIT}"
-elif [[ -x "${KSM_SO_CMAKE}" ]]; then
+elif [[ -s "${KSM_SO_CMAKE}" ]]; then
     readonly KSM_SO="${KSM_SO_CMAKE}"
 else
-    echo $KSM_SO_CMAKE
+    echo "KSM_SO_CMAKE is " $KSM_SO_CMAKE
+    echo "KSM_SO is " $KSM_SO
     echo "Could not find libksm_preload.so. Have you compiled it with 'make' ?"
     exit 1
 fi
@KenSharp
Copy link
Contributor

KenSharp commented Nov 7, 2017

Just change [[ and ]] to [ and ], respectively. The double brackets are superfluous. Running bash each time is madness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants