tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: OWN_DIRS doesn't protect directories as advertised



On 11/14/2011 6:57 PM, John Marino wrote:
> Take this real-life example:
> 1. Install php-5.2
> 2. Install php5-pgsql
> 3. Deinstall php5-pgsql
> 
> The directory /usr/pkg/lib/php/20040412, which was present after step 1
> is missing after the completion of step 3.
> 
> I was told previously that "OWN_DIRS" is the mechanism to tells pkgsrc
> not the delete directories that belong to another package.
> 
> 
> Excerpt lang/php5/Makefile.common:
> ==================================================
> PHP_EXTENSION_DIR= lib/php/20040412
> 
> Excerpt lang/php5/Makefile:
> ==================================================
> OWN_DIRS= ${PREFIX}/${PHP_EXTENSION_DIR}
> 
> 
> This package was already configured with OWN_DIRS, and it didn't prevent
> the removal of the directory in question after php5-pgsql's file
> lib/php/20040412/pgsql.so was removed during php5-pgsql deinstallation.
> 
> OWN_DIRS by itself doesn't seem to preserve these directories.  A brute
> force method like touching a dummy file in that directory would work,
> but it's not very elegant.
> 
> So to revisit this topic: Is there any way to prevent deinstalled
> packages from deleting directories installed by other packages?
> John
> 
> P.S. The pkgsrc handbook doesn't actually claim that OWN_DIRS will
> protect the directories, it was mentioned on the mail lists.
> 
> 


To address the inadvertent deletion of directories, perhaps we can
modify the creation and destruction behavior of OWN_DIRS and MAKE_DIRS
variables.

When an OWN_DIRS directory is created, a zero-byte ".keep" file could be
placed there.  When it is time to deinstall the package that owns the
directory, the .keep file would be deleted first.

It's a little bit brute force, but it should defeat the automatic and
undesired pruning of these directories.

I had committed some changes to DEINSTALL scripts that were emitting
"directory doesn't exist" errors.  They were all caused by this problem,
and the modified OWN_DIRS / MAKE_DIRS handling should be applied to
those packages as well, since my commits only addressed the symptoms and
not any problems that may occur when an expected directory does not exist.

John


Home | Main Index | Thread Index | Old Index