0

Today in Drive Genius 3, I ran the “Verify Preferences” function in Repair. It yielded this strange result:

/bin/sh: xargs: command not found

The only option Drive Genius gives is to remove the file, and it seems like I probably shouldn't remove a file in /bin! Can somebody help me fix this problem and tell me what I should do? My specs are below. Thanks!

MacBook Pro (13-inch, Early 2011)
OS X Yosemite (10.10)
Error was found using Drive Genius 3.2.4 running on a bootable USB drive

4
  • 1
    What is the $PATH environment variable for this /bin/sh session? – glenn jackman Nov 18 '14 at 22:03
  • echo $PATH returns /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin. Is that what you're referring to? – jffffj Nov 18 '14 at 22:24
  • Is that the shell value in Drive Genius - another question is what file does it suggest remove? - to debug this I suspect we need to see the shell file running – mmmmmm Nov 18 '14 at 22:25
  • Hm…Drive Genius suggests removing the /bin/sh file itself. – jffffj Nov 18 '14 at 22:32
1

This is somewhat speculative, but too long to fit in a comment.

The error message sounds like Drive Genius calls a helper script which attempts to run sh and which contains an error which botches the PATH inside this script.

The proof of concept is something like

#!/bin/sh
PATH=  # oops
xargs </dev/null

Without access to Drive Genius, it's near impossible to find the precise location of the error. The command could be hard-coded into a binary which does something like

execvp("sh", "-c", "PATH=; xargs");

which will be hard to find, and impossible to fix, without access to the program's source code.

A common beginner error is choosing PATH as your variable name for something which doesn't want to actually modify the shell's executable search path. The guidance for shell scripts is to only use lowercase variable names for your script's internal variables, but this advice is widely ignored, even in scripts written by so-called professionals.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .