Issue 79645 - Extension Manager should not write into the user directory when installing a shared extension
Summary: Extension Manager should not write into the user directory when installing a ...
Status: CLOSED FIXED
Alias: None
Product: General
Classification: Code
Component: code (show other issues)
Version: 680m220
Hardware: All All
: P2 Trivial (vote)
Target Milestone: OOo 2.3
Assignee: joerg.skottke
QA Contact: issues@framework
URL:
Keywords:
Depends on: 78167
Blocks: 80294
  Show dependency tree
 
Reported: 2007-07-16 09:30 UTC by joachim.lingner
Modified: 2007-10-31 10:06 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description joachim.lingner 2007-07-16 09:30:00 UTC
Currently when the PackageManagerFactory is created it also creates the
directory structure of user and shared settings. Using sudo (without -H)to
install a office with bundled extensions would cause several folders and files
be written with root file access. The user will not be able to change them later
on. See also tr148665.
Comment 1 joachim.lingner 2007-07-16 09:31:14 UTC
.
Comment 2 joachim.lingner 2007-07-17 15:07:06 UTC
When a unopkg add --shared is called (for example for a bundled extension) then
only the directory structure for the shared extensions is created which is
located in the office installation. 

What causes the .dat files (see  tr tr148665) to be written is the config
manager service.

Comment 3 joachim.lingner 2007-07-19 12:31:15 UTC
Since changing the config manager to not use caching during installation is a
risky thing, we will use for the time being a temporary UserInstallation. That
is unopkg can be started with the bootstrap variable
-env:UserInstallation=path_to_temporary_directory, so that nothing is written to
the root's home directory.
Follow up issue is  i79786.
Comment 4 joachim.lingner 2007-07-19 12:40:32 UTC
We need to resync with native84 in order to make the changes in instset_native.
Comment 5 joachim.lingner 2007-08-01 14:03:31 UTC
Now, the installation should not create the user installation directory in the
root.  The scripts in the packages or the custom action (Windows) create a
temporary folder which is then used by unopkg as the user installation. When
unopkg is done then the directory is deleted.

On Windows the Temp directory is obtained by using the GetTempPath function. See
the documentation at 
http://msdn2.microsoft.com/en-us/library/Aa364992.aspx
to find out what the exact tmp directory will be.

On Linux and Solaris the tmp directory will determined by the environment variables
$TMPDIR, then 
$TMP

When both are not set then it is assumed that /tmp is the temp folder.

On Linux and Solaris the tmp dir is created by mktemp and if it is not available
then mkdir is used. mktemp is at /usr/lib/mktemp on Solaris and at /bin/mktemp
on Linux.

Please check if the alternate method to create the temporary directory works as
well.

The part which creates the directory looks like this:
Linux:#Find the temp dir
if [ -n "$TMPDIR" ]; then
  UNOPKGTMP="$TMPDIR"
elif [ -n "$TMP" ]; then
  UNOPKGTMP="$TMP"
elif [ -d "/tmp" ]; then
  UNOPKGTMP="/tmp"
else
  echo "No tmp directory found!"
  exit 1
fi

#Create the command which creates a temporary directory
if [ -x "/bin/mktemp" ]
then
  INSTDIR=`/bin/mktemp -d "${UNOPKGTMP}/userinstall.XXXXXX"`
else
  INSTDIR="${UNOPKGTMP}/userinstall.$$"
  mkdir "$INSTDIR"
fi

Solaris:
if [ -n "$TMPDIR" ]; then
  UNOPKGTMP="$TMPDIR"
elif [ -n "$TMP" ]; then
  UNOPKGTMP="$TMP"
elif [ -d "/tmp" ]; then
  UNOPKGTMP="/tmp"
else
  echo "No tmp directory found!"
  exit 1
fi

#Create the command which creates a temporary directory
if [ -x "/usr/bin/mktemp" ]
then
  INSTDIR=`/usr/bin/mktemp -d "${UNOPKGTMP}/userinstall.XXXXXX"`
else
  INSTDIR="${UNOPKGTMP}/userinstall.$$"
  mkdir "$INSTDIR"
fi
================================================
Please also verify the update of a package on Linux (rpm -U). For that reason I
have prepared an rpm whhich has a higher build id. It can be found in the SRC680
directory of the cws. A similar rpm exist also for openoffice.

Because I needed to adapt the script also for OpenOffice, you should test OOo as
well. 

The install sets of the cws contain a leaves1.oxt which is only availabe on this
cws and will not get into the master. It is just for testing purposes.






Comment 6 joachim.lingner 2007-08-01 14:40:16 UTC
In case the postrun (/usr/lib/postrun) is used on Solaris, then the tmp
directory may be created in /var/tmp/
Comment 7 joachim.lingner 2007-08-01 14:57:06 UTC
Also, when postrun is used, then uninstalling of a Java extensions fails. See
i79643.
Comment 8 joachim.lingner 2007-08-06 08:58:52 UTC
.
Comment 9 joachim.lingner 2007-08-06 08:59:43 UTC
jl->jsk: Please verify.
Comment 10 joerg.skottke 2007-08-08 14:15:45 UTC
This works for StarOffice (Linux and Solaris).
Todo: Update on Linux, Windows, OOo builds.
Comment 11 joerg.skottke 2007-08-10 09:22:01 UTC
Verified other platforms.

However, this only works due to the redirecting mechanism (bootstrapping
-env:UserInstallation=...) which is not set by default when the administrator
adds a shared extension.

During normal usage this fix does not help, the root cause has not been fixed,
this is a workaround for exactly one use case.

Verified.
Comment 12 joachim.lingner 2007-08-10 09:44:20 UTC
As for the installation, I think there is an issue with sb concerning the
configuration writing data into the user layer.
Comment 13 joerg.skottke 2007-10-31 10:06:01 UTC
Good in OOG680m7, Closing