Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian Development (http://www.linux-archive.org/debian-development/)
-   -   rm -rf /usr/somedir in maintainer scripts? (http://www.linux-archive.org/debian-development/708449-rm-rf-usr-somedir-maintainer-scripts.html)

Nikolaus Rath 09-30-2012 12:29 AM

rm -rf /usr/somedir in maintainer scripts?
 
"Andrej N. Gritsenko" <andrej@rep.kiev.ua> writes:
> Hello!
>
> I have written on Sunday, 30 September, at 2:12:
>>Nikolaus Rath has written on Saturday, 29 September, at 18:56:
>>>"Andrej N. Gritsenko" <andrej@rep.kiev.ua> writes:
>>>> I've solved that in the
>>>> preinst script by 'rm -rf /usr/include/libfm' and I thought yet that was
>>>> a right step since upgrade 1.0.1 -> 1.0.2 went smooth.
>
>>>Somehow that sounds like a really bad idea to me. Admittedly manually
>>>placing some file in /usr/include/libfm is pretty ugly, but I would
>>>still certainly not expect that upgrading the libfm package would remove
>>>it.
>
>>>Is that really good practice? Can packages "own" a directory, so that
>>>anything that the local admin puts there may be removed automatically?
>
>> Probably I'm wrong in that. Do you think preinst script should fail
>>instead if target-to-replace directory is not empty?
>
> And that will not work certainly. If package is being upgraded then old
> files will be still in place so rmdir will fail in any case.
>
> Could you propose any better way to do then? Postinst script which does
> rmdir and makes symlink instead of not-installed from package? Isn't it
> dirty somehow?

No, I'm afraid I don't have any good suggestion for the problem at hand.
I'm writing this mostly as a user who gets really concerned when he reads
rm -rf.


Sorry...

-Nikolaus

--
»Time flies like an arrow, fruit flies like a Banana.«

PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87d3145p62.fsf@vostro.rath.org">http://lists.debian.org/87d3145p62.fsf@vostro.rath.org

gregor herrmann 09-30-2012 01:57 AM

rm -rf /usr/somedir in maintainer scripts?
 
On Sat, 29 Sep 2012 20:29:09 -0400, Nikolaus Rath wrote:

> >>>> I've solved that in the
> >>>> preinst script by 'rm -rf /usr/include/libfm' and I thought yet that was
> >>>> a right step since upgrade 1.0.1 -> 1.0.2 went smooth.
> >>>Somehow that sounds like a really bad idea to me. Admittedly manually
> >>>placing some file in /usr/include/libfm is pretty ugly, but I would
> >>>still certainly not expect that upgrading the libfm package would remove
> >>>it.
> >>>Is that really good practice? Can packages "own" a directory, so that
> >>>anything that the local admin puts there may be removed automatically?

Yes, there's no guarantee that a directory belonging to a package
will be there after the next upgrade.

> No, I'm afraid I don't have any good suggestion for the problem at hand.
> I'm writing this mostly as a user who gets really concerned when he reads
> rm -rf.

On my laptop:

% grep 'rm -rf' /var/lib/dpkg/info/* | wc -l
183


Cheers,
gregor

--
.'`. Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
: :' : Debian GNU/Linux user, admin, and developer - http://www.debian.org/
`. `' Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
`- NP: Funny van Dannen: 1000 Dinge

Nikolaus Rath 09-30-2012 05:43 PM

rm -rf /usr/somedir in maintainer scripts?
 
gregor herrmann <gregoa@debian.org> writes:
> On Sat, 29 Sep 2012 20:29:09 -0400, Nikolaus Rath wrote:
>
>> >>>> I've solved that in the
>> >>>> preinst script by 'rm -rf /usr/include/libfm' and I thought yet that was
>> >>>> a right step since upgrade 1.0.1 -> 1.0.2 went smooth.
>> >>>Somehow that sounds like a really bad idea to me. Admittedly manually
>> >>>placing some file in /usr/include/libfm is pretty ugly, but I would
>> >>>still certainly not expect that upgrading the libfm package would remove
>> >>>it.
>> >>>Is that really good practice? Can packages "own" a directory, so that
>> >>>anything that the local admin puts there may be removed automatically?
>
> Yes, there's no guarantee that a directory belonging to a package
> will be there after the next upgrade.

How do I check if a directory belongs to a package?

What should package do if it wants to install a file in a directory
owned by another package?


Thanks,

-Nikolaus

--
»Time flies like an arrow, fruit flies like a Banana.«

PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87obknwgmq.fsf@vostro.rath.org">http://lists.debian.org/87obknwgmq.fsf@vostro.rath.org

Tollef Fog Heen 09-30-2012 06:31 PM

rm -rf /usr/somedir in maintainer scripts?
 
]] Nikolaus Rath

> How do I check if a directory belongs to a package?

dpkg -S ?

> What should package do if it wants to install a file in a directory
> owned by another package?

The maintainers should talk with each other and come to some sort of
agreement. What they decide on should be documented in some kind of
policy document, typically shipped in the «owning» package.

--
Tollef Fog Heen
UNIX is user friendly, it's just picky about who its friends are


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87y5jrgy67.fsf@xoog.err.no">http://lists.debian.org/87y5jrgy67.fsf@xoog.err.no

Nikolaus Rath 09-30-2012 08:29 PM

rm -rf /usr/somedir in maintainer scripts?
 
Tollef Fog Heen <tfheen@err.no> writes:
> ]] Nikolaus Rath
>
>> How do I check if a directory belongs to a package?
>
> dpkg -S ?

I guess you shouldn't have used "belongs" but "owns" here. For example,
for /usr/share/dict dpkg -S lists wamerican, base-files and
dictionaries-common. How do I find out which of these owns this
directory and may rm -rf it?


Best,

-Nikolaus

--
»Time flies like an arrow, fruit flies like a Banana.«

PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87pq535k5u.fsf@vostro.rath.org">http://lists.debian.org/87pq535k5u.fsf@vostro.rath.org

Russ Allbery 09-30-2012 09:20 PM

rm -rf /usr/somedir in maintainer scripts?
 
Nikolaus Rath <Nikolaus@rath.org> writes:
> Tollef Fog Heen <tfheen@err.no> writes:
>> ]] Nikolaus Rath

>>> How do I check if a directory belongs to a package?

>> dpkg -S ?

> I guess you shouldn't have used "belongs" but "owns" here. For example,
> for /usr/share/dict dpkg -S lists wamerican, base-files and
> dictionaries-common. How do I find out which of these owns this
> directory and may rm -rf it?

This is not normally a thing that you would ever do, which is why that
answer is hard to come by. Normally, in Debian, packages own files, and
directories appear and disappear based on whether the package has to put a
file in that directory. (Yes, the directories themselves are also
included in the package, but it's not normally a useful conceptual model
for the *intent* of the package.) There are some cases where the package
intends to ship an empty directory, often in /var for run-time state, but
this is the exception rather than the common case, and it's particularly
uncommon in /usr.

A package that wants to change a directory to a symlink (or vice versa) is
a very special case, and one that runs afoul of dpkg support for the local
system administrator moving and symlinking directories (something that can
be quite useful if one screws up disk partitioning or runs out of disk
space in the / or /usr partition, which admittedly is getting less common
on typical servers and desktops but can still be an issue for smaller
devices).

The most accurate statement about this case is probably "this change is
not fully supported by the current Debian packaging tools." I don't think
it's something for which we currently have easy answers. It may require
either some design work or some case-by-case analysis.

--
Russ Allbery (rra@debian.org) <http://www.eyrie.org/~eagle/>


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87y5jr6wdl.fsf@windlord.stanford.edu">http://lists.debian.org/87y5jr6wdl.fsf@windlord.stanford.edu

Tollef Fog Heen 10-01-2012 06:51 AM

rm -rf /usr/somedir in maintainer scripts?
 
]] Russ Allbery

> A package that wants to change a directory to a symlink (or vice versa) is
> a very special case, and one that runs afoul of dpkg support for the local
> system administrator moving and symlinking directories (something that can
> be quite useful if one screws up disk partitioning or runs out of disk
> space in the / or /usr partition, which admittedly is getting less common
> on typical servers and desktops but can still be an issue for smaller
> devices).

Now that we have well working bind mounts, we could actually deprecate
the old way and just tell people to use bind mounts instead. At least
if our non-Linux ports has decent support for it.

--
Tollef Fog Heen
UNIX is user friendly, it's just picky about who its friends are


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87r4pid6rq.fsf@qurzaw.varnish-software.com">http://lists.debian.org/87r4pid6rq.fsf@qurzaw.varnish-software.com

Simon McVittie 10-01-2012 07:35 AM

rm -rf /usr/somedir in maintainer scripts?
 
On 01/10/12 07:51, Tollef Fog Heen wrote:
> Now that we have well working bind mounts, we could actually deprecate
> [sysadmins moving directories to a less full filesystem and leaving
> symlinks behind] and just tell people to use bind mounts instead. At
least
> if our non-Linux ports has decent support for it.

kFreeBSD has "nullfs" which seems to be meant to work (at least, a
search for "kfreebsd nullfs" shows that bugs in it sometimes get fixed).

S


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 506947C5.9010109@debian.org">http://lists.debian.org/506947C5.9010109@debian.org


All times are GMT. The time now is 12:58 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.