Affects Version/s: 1.2
Fix Version/s: None
Linux 2.6.18-53.1.14.el5 #1 SMP Wed Mar 5 11:37:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
The fixUser function in script-utils uses two methods to determine the username of the parent process (oldwhoami). If the first method fails for certain reasons it will fallback to the second method. For most people the first method will succeed but I know that in my particular installation the first method fails so I need the second method to succeed. Unfortunately, that fallback method doesn't work because it uses pgrep to lookup the current script's name and on my Linux 2.6.18 platform pgrep is limited to 15 characters. The names of many scripts in the SOLR distribution are longer than that, causing pgrep to return nothing and the subsequent ps invocation to fail with an error:
ERROR: List of process IDs must follow -p.
You can easily reproduce that behaviour with
/app/solr/solr/bin/snappuller-enable < /dev/null
The redirection of stdin from /dev/null causes fixUser to fallback to the second method but there are other, more realistic scenarios in which the fallback happens, like
ssh jetty@host /app/solr/solr/bin/snappuller-enable
The fix is to use the -f option which causes pgrep to compare the full path of the executable. Interestingly, that method is not subject to the 15 character length limit. The limit is not actually enforced by jetty but rather by the procfs file system of the linux kernel. If you look at /proc/*/stat you will notice that the second column is limited to 15 characters.