Bug #4825 | mysql 4.0.20 fails to ./configure at "checking for ps" | ||
---|---|---|---|
Submitted: | 30 Jul 2004 11:43 | Modified: | 30 Jul 2004 14:42 |
Reporter: | [ name withheld ] | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Compiling | Severity: | S2 (Serious) |
Version: | 4.0.20 | OS: | Linux (Linux) |
Assigned to: | Sergei Golubchik | CPU Architecture: | Any |
[30 Jul 2004 11:43]
[ name withheld ]
[30 Jul 2004 12:28]
Sergei Golubchik
Sorry, but I cannot understand how it can fail because of the reason you described. ps prepends - to indicate login shell: > ps p $$ PID TTY STAT TIME COMMAND 31368 pts/9 S 0:00 -bash But when you run it from the script there can be no - there because the shell is not login shell (also it will be shown as sh, not bash). but even if it would be -bash in the ps output it cannot cause problems for grep, because it's grep $0 and $0 is the name of the script - that is configure - and not the output of the ps (and, of course, MySQL compiles just fine on the linux box where I run the ps command from above)
[30 Jul 2004 13:11]
[ name withheld ]
You're quite correct about it grepping for ./configure and not -bash. It turns out that because I had restricted /bin/ps execute permissions to root and the wheel group, and because Gentoo's Portage runs configure/make as the user "portage", configure could not execute ps. Sorry for the confusion, but should -- not be added to grep for safety?
[30 Jul 2004 14:42]
Sergei Golubchik
It would only help the the script will be renamed to something that start with "-" so it's not very probable scenario. But actually I'm worried about the portability of "grep --" - for example configure script from GNU autoconf (which was carefully tuned for maximal portability) never uses "--"
[30 Jul 2004 15:15]
Marko Mäkelä
What about grep -e "$0" (note the quotes around "$0", in case the script is renamed to something that contains a character in $IFS)? GNU Emacs M-x grep suggests -e on the command line, so I assume it is portable. At least the Solaris grep(1) man page documents it: -e pattern_list Used to specify one or more patterns to match. If more than one pattern is specified in pattern_list, they must be separated by newline charac- ters (carriage returns). The -e option is useful for specifying a pat- tern that begins with a - (dash). I don't know if there is a grep(1) switch for treating the argument as a fixed string and not a regexp.