Issue 88367 - "command timed out" at launch
Summary: "command timed out" at launch
Status: CLOSED DUPLICATE of issue 87538
Alias: None
Product: General
Classification: Code
Component: code (show other issues)
Version: OOo 2.4.0
Hardware: Mac Mac OS X, all
: P3 Trivial (vote)
Target Milestone: ---
Assignee: ericb
QA Contact: issues@framework
URL:
Keywords: oooqa
Depends on:
Blocks:
 
Reported: 2008-04-17 01:14 UTC by plaintiger
Modified: 2010-03-27 21:17 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
system profile (17.18 KB, text/plain)
2008-04-17 01:20 UTC, plaintiger
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description plaintiger 2008-04-17 01:14:22 UTC
i'm running OS X v.10.5.2 on a PowerPC Mac. my issue (reproducible - happens every time):

1. i launch OOo.

2. X11 opens.

3. i wait about 30 seconds.

4. i hear a system beep and the OOo icon starts bouncing in my Dock.

5. i click the OOo icon and see an alert that says only, "Command timed out" with a Cancel and a 
Continue button.

6. i click "Continue," wherupon the alert is dismissed and OOo finishes starting up as expected.

i told OOo to install both Apple and installed system fonts at installation, in case that's relevant. 
otherwise it's a brand new, unaltered installation on a system not running any haxies or other mods.
Comment 1 plaintiger 2008-04-17 01:20:12 UTC
Created attachment 52942 [details]
system profile
Comment 2 Olaf Felka 2008-04-17 06:49:47 UTC
reassigned
Comment 3 thorsten.martens 2008-04-17 09:31:23 UTC
TM->PL: please have a look, thanks !
Comment 4 philipp.lohmann 2008-04-17 09:42:09 UTC
issue for the macporter team
Comment 5 ezjay 2008-05-03 08:42:43 UTC
-- Just need to update the OpenOffice.org 2.4.app script as follows:
(*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: main.applescript,v $
 *
 *  $Revision: 1.4 $
 *
 *  last change: $Author: ihi $ $Date: 2007/06/05 11:52:25 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *		
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 *************************************************************************)

(*==== (global variables as get-functions) ====*)

on getOOInstallPath()
	return (((path to me) as string) & "Contents:")
end getOOInstallPath

on getOOResourcesPath()
	return (((path to me) as string) & "Contents:Resources:")
end getOOResourcesPath

on getOOProgramPath()
	return (getOOInstallPath() & "MacOS:")
end getOOProgramPath

on getScriptPath()
	-- set this to absolute path when debugging
	return (((path to me) as string) & "Contents:Resources:Scripts:")
end getScriptPath

on getOOUserSettingsPath()
	return (((path to home folder) as string) & "Library:Application Support:OpenOffice.org:2:")
end getOOUserSettingsPath

on getOOUserFontPath()
	return (getOOUserSettingsPath() & "user:fonts:")
end getOOUserFontPath

on getUserLogsPath()
	return (((path to home folder) as string) & "Library:Logs:")
end getUserLogsPath

on shellTerminator()
	return (" &>/dev/null & echo $!") as string
end shellTerminator

--
-- the default handlers: run, open, idle, quit
--

on run
	if (preRun()) then
		logEvent("(Scripts/main) Running OpenOffice.org")
		openSoffice("-")
	end if
end run

on open (theFiles)
	if (preRun()) then
		openFiles(theFiles)
	end if
end open

on idle
	-- close icon only if ooo has terminated
	if (hasOOoQuit()) then
		tell me to quit
	end if
	-- check all x seconds if ok to quit
	return 3
end idle

on quit
	if (hasOOoQuit()) then
		continue quit
	end if
end quit

-------------------------------------------------------------

on preRun()
	
	
	-- Check for the required version of Mac OS X
	if (not atLeastOSXVersion(10, 3, 0)) then
		display dialog getMessage("ERROR_NEED_PANTHER")
		return false
	end if
	
	-- Check for that OOo can be found
	if (not isRealPath(getOOProgramPath())) then
		display dialog getMessage("ERROR_OOO_NOT_FOUND")
		return false
	end if
	
	if (not isRealPath(getOOUserFontPath())) then
		set createUserFont to "mkdir -p " & (quoted form of POSIX path of getOOUserFontPath()) & "; "
		do shell script createUserFont
	end if
	
	-- If no crash occured before, ~/Library/Logs does not exist, and OpenOffice.org cannot be 
started
	if (not isRealPath(getUserLogsPath())) then
		set createUserLogsPath to "mkdir -p " & (quoted form of POSIX path of getUserLogsPath()) & "; "
		do shell script createUserLogsPath
	end if
	
	-- Checks are ok, now do the PostInstall stuff (e.g. fondu)
	
	-- load helper library
	set postinstall to load script alias ¬
		(getScriptPath() & "PostInstall.scpt")
	-- execute the postinstall script
	run of postinstall
	
	
	return true
end preRun


on hasOOoQuit()
	if (isRealPath(getOOProgramPath())) then
		-- set the location of soffice binary
		set soffice to (quoted form of (POSIX path of getOOProgramPath() & "soffice"))
		
		set isRunning to do shell script "_FOUND_=`ps -wx -o command | grep " & soffice & " | grep -
v grep`; echo $_FOUND_"
		if isRunning ≠ "" then
			return false
		else
			return true
		end if
	else
		return true
	end if
end hasOOoQuit


on openSoffice(aFile)
	set theDisplay to startXServer()
	if (theDisplay is equal to "error") then
		return
	end if
	set theEnv to "DISPLAY=" & theDisplay & " ; export DISPLAY; "
	set theCmd to "sh " & (quoted form of (POSIX path of getOOProgramPath() & "soffice")) & " "
	do shell script theEnv & theCmd & aFile & shellTerminator()
	-- logEvent("open CMD: " & theEnv & theCmd & aFile)
end openSoffice


-- helper function to start X11 server
on startXServer()
	
	-- get X settings
	set XSettingsList to findXServer()
	set whichserver to item 1 of XSettingsList
	set Xserverloc to item 2 of XSettingsList
	
	-- debug:
	-- logEvent("(scripts/main) X settings: " & whichserver & "--" & POSIX path of Xserverloc)
	-- set whichserver to "NOXSERVER"
	
	-- if nothing really was found, display an error message.
	if (whichserver is equal to "NOXSERVER") then
		
		display dialog getMessage("ERROR_NEED_X11") buttons {"Quit", "More Info"} default button 
"More Info"
		if the button returned of the result is "Quit" then
			quit
		else
			-- if more info is chosen, then open a help web page
			do shell script "open http://porting.openoffice.org/mac/faq/installing/X11.html"
			-- cannot continue, so quit the script
			return "error"
		end if
		
	end if
	
	set now_running to ""
	set now_running to do shell script "INX=`ps -wcx | grep  " & quoted form of (whichserver & "$") & 
"`; echo $INX"
	if whichserver = "NOXSERVER" then
		-- display dialog "No XServer Found"
		set now_running to "Skip"
	end if
	if now_running = "" then
		if whichserver = "X11" then
			set x11cmd to quoted form of (Xserverloc & "/Contents/MacOS/X11") & shellTerminator()
			do shell script x11cmd
			-- save process id
			set x11pid to the result
			-- wait until the window manager is started which is the second child process of x11
			-- set numchildrencmd to "ps -x -o ppid | grep " & x11pid & " | wc -l"
			set numchildrencmd to "ps -xf | grep X11 | grep -v grep | wc -l"
			set numchildren to 0
			set d to current date
			set t1 to time of d
			-- repeat while numchildren ≠ 2
			repeat while numchildren < 2
				set d to current date
				set t2 to time of d
				-- give up after 30 seconds
				if t2 - t1 > 30 then
					display dialog "Command timed out"
					exit repeat
				end if
				set result to do shell script numchildrencmd
				set numchildren to result as integer
			end repeat
		else -- startup XDarwin
			do shell script "open " & quoted form of Xserverloc & shellTerminator()
			do shell script "sleep 4"
		end if
	end if
	if whichserver is equal to "X11" then
		-- the DISPLAY variable is different for every user currently logged in
		-- X11 passes the DISPLAY as the last command line parameter to its child process
		-- we can use ps to read the command line and parse the trailing :0, :1, or whatever
		set xdisplay to do shell script "ps -wx -o command | grep X11.app | grep \":.$\" | sed 
\"s/^.*:/:/g\""
		--display dialog xdisplay
		return xdisplay
	else
		-- TODO: find out how XDarwin does it
		return ":0"
	end if
end startXServer


on openFiles(fileList)
	if (count of fileList) > 0 then
		repeat with i from 1 to the count of fileList
			set theDocument to (item i of fileList)
			set theFilePath to (quoted form of POSIX path of theDocument)
			set theFileInfo to (info for theDocument)
			openSoffice(theFilePath)
			logEvent("(Scripts/main) Open file: " & theFilePath)
		end repeat
	end if
end openFiles


(* ===== (Helper functions) ======= *)

-- get a localized string
on getMessage(aKey)
	try
		if (aKey is equal to "YES_KEY") then
			return "Yes"
		end if
		
		if (aKey is equal to "NO_KEY") then
			return "No"
		end if
		
		if (aKey is equal to "ERROR_OOO_NOT_FOUND") then
			return "OpenOffice.org was not found on your system. Please (re-)install OpenOffice.org 
first."
		end if
		
		if (aKey is equal to "ERROR_NEED_PANTHER") then
			return "This build of OpenOffice.org cannot be run on this system, OpenOffice.org 
requires MacOSX 10.3 (Panther) or newer system"
		end if
		
		if (aKey is equal to "ERROR_NEED_X11") then
			return "OpenOffice.org for Mac OS X cannot be started, because the X11 software is not 
installed. Please install Apple X11 first from the Mac OS X install DVD. More information: 
http://porting.openoffice.org/mac/faq/installing/X11.html"
		end if
	end try
end getMessage


-- function for logging script messages
on logEvent(themessage)
	set theLine to (do shell script ¬
		"date  +'%Y-%m-%d %H:%M:%S'" as string) ¬
		& " " & themessage
	do shell script "echo " & quoted form of theLine & ¬
		" >> ~/Library/Logs/OpenOffice2.log"
end logEvent


-- function for checking if a path exists
on isRealPath(aPath)
	try
		alias aPath
		return true
	on error
		-- error number -43 from aPath
		-- display dialog "NotRP -- " & aPath
		return false
	end try
end isRealPath

-- try to find X11 server on the Mac OS X system
-- return value: the found server or "NOXSERVER"
on findXServer()
	-- First try standard X11 location, then try standard XDarwin location
	
	set whichserver to "NOXSERVER"
	--Utilities folder of system
	set Xserverloc to ((path to utilities folder from system domain) as string) & "X11.app:"
	--display dialog " Xserverloc" & Xserverloc
	if (isRealPath(Xserverloc)) then
		set whichserver to "X11"
		set Xserverloc to (POSIX path of Xserverloc)
	else
		--Applications folder of system
		set Xserverloc to ((path to applications folder from system domain) as string) & "XDarwin.app:"
		if (isRealPath(Xserverloc)) then
			set whichserver to "XDarwin"
			set Xserverloc to (POSIX path of Xserverloc)
		end if
	end if
	
	-- if nothing found yet try using locate, first with X11.app and then with XDarwin.app
	if (whichserver is equal to "NOXSERVER") then
		set Xserverloc to do shell script "locate X11.app/Contents/MacOS/X11 | sed -e 's-
/Contents/MacOS/X11--g'"
		if Xserverloc ≠ "" then
			set whichserver to "X11"
		end if
	end if
	
	if (whichserver is equal to "NOXSERVER") then
		set Xserverloc to do shell script "locate XDarwin.app/Contents/MacOS/XDarwin | sed -e 's-
/Contents/MacOS/XDarwin--g'"
		if Xserverloc ≠ "" then
			set whichserver to "XDarwin"
		end if
	end if
	
	return {whichserver, Xserverloc}
end findXServer


-- Test for a minimum version of Mac OS X
on atLeastOSXVersion(verMajor, verMinor, verStep)
	-- The StandardAdditions's 'system attribute' used to be the Finder's 'computer' command.
	tell application "Finder" to set sysv to (system attribute "sysv")
	
	-- Generate sysv-compatible number from given version
	set reqVer to ((verMajor div 10) * 4096 + (verMajor mod 10) * 256 + verMinor * 16 + verStep)
	
	-- DEBUGGING:	
	-- display dialog ("RV:" & reqVer & " < " & sysv as string)
	
	-- set major to ((sysv div 4096) * 10 + (sysv mod 4096 div 256))
	-- set minor to (sysv mod 256 div 16)
	-- set step to (sysv mod 16)
	-- display dialog ("Your Mac OS X version: " & major & "." & minor & "." & step)
	
	if (reqVer > sysv) then
		return false
	else
		return true
	end if
end atLeastOSXVersion

Comment 6 ezjay 2008-05-03 09:09:18 UTC
The changes being:
1) 
set numchildrencmd to "ps -x -o ppid | grep " & x11pid & " | wc -l"
should be
set numchildrencmd to "ps -xf | grep X11 | grep -v grep | wc -l"

2) 
repeat while numchildren ≠ 2 
should be
repeat while numchildren < 2

Comment 7 shaunmcdonald131 2008-05-03 14:11:09 UTC
ezjay: Interesting, that is a different method to what I used. Your change doesn't stop the $DISPLAY 
variable from being used.
Comment 8 traut 2008-05-25 08:13:39 UTC
Confirmed on G4, MacOS 10.4.11 and OOo 2.4 Beta - I did not apply the suggested
patch yet.

File Menu contains "Use Startup Screen" only (disabled).

Edit shows "Edit Script", but does not show any effect.
Comment 9 mjroberts 2008-07-10 18:21:16 UTC
I have the same issue occurring 
Mac mini OS X 10.5.4 and OOo 2.4

File menu contains "Use Startup Screen" only (disabled).
Edit menu shows "Undo, Cut, Copy, Paste, Clear" all disabled and "Edit Script" enabled, but does not show 
any effect.

Result is either "Command timed out" or no response from OOo. Must Force Quit OOo to exit.

Have tried the patch suggested here by ezjay Sat May 3 07:42:43 but has no effect.
Comment 10 shaunmcdonald131 2008-07-11 11:06:01 UTC
have you tried the fix at:
http://shaunmcdonald131.blogspot.com/2008/03/ooo-possible-fix-for-command-timed-out.html
Comment 11 mjroberts 2008-07-12 08:46:14 UTC
Just tried the fix at http://shaunmcdonald131.blogspot.com/2008/03/ooo-possible-fix-for-command-
timed-out.html but did not resolve. The command time out error report no longer displays but nothing 
else happens, OOo just seems to stop with the File and Edit menus showing only as described above.
Comment 12 mjroberts 2008-09-14 19:26:47 UTC
I have now a new Mac (for other reasons) - Mac mini OS X 10.5.4 and OOo 2.4. I am experiencing the 
same problem as above. Can anyone help further with this?
Comment 13 ezjay 2008-09-14 19:58:55 UTC
Shaun's fix is the best I've seen. It even eliminates the unnecessary xterm
window! (Of course, if you have an Intel Mac, you should just switch to
OpenOffice 3 for Auqa.)

His fix is to replace the openSoffice function in main.scpt with:

on openSoffice(aFile)
 if (atLeastOSXVersion(10, 5, 0)) then
  -- if we have leopard, we don't need to manually start the X server first
  set theCmd to "sh " & (quoted form of (POSIX path of getOOProgramPath() &
"soffice")) & " "
  do shell script theCmd & aFile & shellTerminator()
 else
  set theDisplay to startXServer()
  if (theDisplay is equal to "error") then
   return
  end if
  set theEnv to "DISPLAY=" & theDisplay & " ; export DISPLAY; "
  set theCmd to "sh " & (quoted form of (POSIX path of getOOProgramPath() &
"soffice")) & " "
  do shell script theEnv & theCmd & aFile & shellTerminator()
  -- logEvent("open CMD: " & theEnv & theCmd & aFile)
 end if
end openSoffice

Comment 14 plaintiger 2008-09-15 05:40:24 UTC
thank you, ezjay, for the tip about OO 3 for Aqua. just recently got an Intel Mac and am trying the new 
package out. i've only glanced at it so far, but the glance has been promising. that's probably going to 
by my fix.

good luck ironing this out though...thanks again...

tiger
Comment 15 Graham Perrin 2008-11-13 14:12:29 UTC
I too experienced these symptoms whilst using OOo 2.4.x (I can't recall which version(s), exactly) most 
likely on my MacBook Pro, Intel, Mac OS X 10.5.x. 

I have since upgraded to OOo 3.0. 
Comment 17 eric.bachard 2008-11-24 22:26:43 UTC
@grahamperrin :

Please have a look at http://www.openoffice.org/issues/show_bug.cgi?id=87538

-> imho 
1) this issue is a dupe
2) the fix is commited, it works, but has not yet been integrated, for a reason I ignore


Comment 18 Graham Perrin 2008-11-24 23:10:39 UTC
@ plaintiger and with a focus on the summary line, 

> "command timed out" at launch

Please, can you advise whether you remain affected by this issue? 

(Has OOo 3 succeeded your use of 2.x?)

----
@ mjroberts and with a focus on your confirmation, 

> command time out error report no longer displays

Please, can you reaffirm that the 'time out' error no longer displays?

----
@ anyone with developer expertise, with a focus on the _distinction_ offered by mjroberts,

> OOo just seems to stop with the File and Edit menus showing only

If the fix described in this ticket is not enough for the secondary symptom described by mjroberts, then 
should we suggest a separate ticket? 

(Or is there a clear relationship, and additional fixing to be done?)
Comment 19 lohmaier 2010-03-27 21:16:31 UTC
duplicate and obsolete as well - OOo 3.x doesn't require X11 anymore and thus 
doesn't need to launch X11.app

*** This issue has been marked as a duplicate of 87538 ***
Comment 20 lohmaier 2010-03-27 21:17:12 UTC
closing.