On Fri, Oct 16, 2009 at 7:05 AM, Andrew Flegg <and...@bleb.org> wrote:
> On Fri, Oct 16, 2009 at 11:49, Mikko Vartiainen <mvartiai...@gmail.com> wrote:
>>>
>>> Perhaps a solution is to have maemo-optify keep the directory structure
>>> in place and create symlinks only for regular files.
>>
>> This would certainly work. maemo-optify should have option which prevents
>> it from creating directory links.
>
> Why would/should it be an option? From the sounds of it, it shouldn't
> create directory symlinks; why would a package ever want them given
> the problems it can cause?

Agreed. And I think the dpkg problem with symlinks replacing existing
directories is a inherent to the way it unpacks the application. AFAIK
dpkg upgrades packages in place, i.e. it first unpacks the new
application and later removes the files that existed only in the old
version (I might be wrong though). The files in the .deb (which is a
simple archive file) are inside a "data.tar.gz" file, which is
unpacked inplace on the root directory.

You can see this by running "ar t" on any .deb file. It will list its
"raw" contents. E.g.:

$ ar t /var/cache/apt/archives/wget_1.10.2-3ubuntu1.1_i386.deb
debian-binary
control.tar.gz
data.tar.gz

I did an experiment that consisted on creating a tarball with a
symlink called "d" and tried to unpack it on a directory with an
existing "d" directory. If the directory is *empty*, tar simply
removes the existing directory and unpacks the symlink. Now, if the
directory is not empty, this is what happens:

$ tar -xvf ../test.tar.gz
./
./d
tar: ./d: Cannot create symlink to `d2': File exists
tar: Error exit delayed from previous errors

Now why "tar" does not simply "rm -rf" the directory? I believe this
is to avoid disasters if tarballs contains for instance a "/usr"
symlink.

Therefore, I think there is no way to guarantee that .deb packages
with directory symlinks are installable UNLESS their preinst script
explicitly removes non-empty directories with the same path as the
symlinks which, again, is very dangerous IMHO.

Regards,
-- 
Anderson Lizardo
OpenBossa Labs - INdT
Manaus - Brazil
_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers

Reply via email to