Re: Re: dpkg behavior when following symlinks
On 11/20/19 9:49 PM, Guillem Jover wrote:
> Hi!
>
> On Wed, 2019-11-20 at 22:59:04 +0000, Alejandro Del Castillo wrote:
>> I am the current maintainer of opkg, dpkg's little brother used mainly
>> for embedded systems.
>
> Ah, thanks for getting in touch! :)
=)
>
>> Opkg uses dpkg control file syntax, and follows
>> debian policy (for the most part). Recently, a bug [1] was opened
>> against opkg regarding symlinks. Basically, debian policy states that
>> symlinks should be followed, when installing files. But, empirically, I
>> don't see that:
>>
>> (bb) adelcast@delcastillo2 ~/dpkg $ tree a_1.0
>> a_1.0
>> ├── DEBIAN
>> │ └── control
>> ├── myfile
>> └── tmp
>> ├── lib
>> └── lib64 -> lib/
>>
>> 4 directories, 2 files
>> (bb) adelcast@delcastillo2 ~/dpkg $ tree b_1.0
>> b_1.0
>> ├── DEBIAN
>> │ └── control
>> ├── myfile2
>> └── tmp
>> └── lib64
>> └── otherfile
>>
>> (bb) adelcast@delcastillo2 ~/dpkg $ sudo dpkg -i a_1.0.deb
>> Selecting previously unselected package a.
>> (Reading database ... 620831 files and directories currently installed.)
>> Preparing to unpack a_1.0.deb ...
>> Unpacking a (1.0) ...
>> Setting up a (1.0) ...
>> (bb) adelcast@delcastillo2 ~/dpkg $ sudo dpkg -i b_1.0.deb
>> Selecting previously unselected package b.
>> (Reading database ... 620834 files and directories currently installed.)
>> Preparing to unpack b_1.0.deb ...
>> Unpacking b (1.0) ...
>> dpkg: error processing archive b_1.0.deb (--install):
>> trying to overwrite '/tmp/lib64', which is also in package a 1.0
>> Errors were encountered while processing:
>> b_1.0.deb
>>
>> Can someone clarify why dpkg is behaving this way? Or am I
>> misinterpreting Debian standards?
>
> This is supposed to work, as exemplified by the following functional
> test case:
>
> https://urldefense.com/v3/__https://git.dpkg.org/cgit/dpkg/dpkg-tests.git/tree/t-symlink-dir__;!!FbZ0ZwI3Qg!59PE0ACeuyQPgkAbQXSPg-Y6YxcGclN7HzWI--UmMsEKm_kR6DpZaLBscqsn50S7M9HD6w$
>
I was pretty mystified on what's different...then I realized that the
issue only happens when following symlinks on tmpfs (/tmp). Adding an
extra directory (tmp) to the dpkg-test example reproduces the failure.
At the end of the email, I have a patch that modifies the tests to show
the failure (I tried attaching the patch to the email, but that made the
list bot swallow my message).
Is this a know issue or expected behavior?
> Are you sure the contents of these packages are what's expected?
> «dpkg-deb -c» would be more telling instead of tree on the unpacked
> directory. Or perhaps the pathname on disk was neither a directory
> nor a symlink?
>
> Otherwise I guess placing the exact test packages somewhere might
> help, or you could check with «dpkg --debug=111».
>
> Thanks,
> Guillem
>
From c5c86a3cb21ea58fe1656e04f7ff080b78718645 Mon Sep 17 00:00:00 2001
From: Alejandro del Castillo <alejandro.delcastillo@ni.com>
Date: Thu, 21 Nov 2019 23:03:44 +0000
Subject: [PATCH] dpkg-tests: add tmp directory to dir hierarchy
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
---
t-symlink-dir/pkg-dir-real/{ => tmp}/test-dir/file-dir | 0
t-symlink-dir/pkg-dir-symlink-0/{ => tmp}/file-symlink | 0
t-symlink-dir/pkg-dir-symlink-0/{ => tmp}/test-symlink | 0
t-symlink-dir/pkg-dir-symlink-1/{ => tmp}/file-symlink | 0
t-symlink-dir/pkg-dir-symlink-1/{ => tmp}/test-symlink | 0
t-symlink-dir/pkg-file/DEBIAN/conffiles | 2 +-
t-symlink-dir/pkg-file/{ => tmp}/test-symlink/file-file | 0
7 files changed, 1 insertion(+), 1 deletion(-)
rename t-symlink-dir/pkg-dir-real/{ => tmp}/test-dir/file-dir (100%)
rename t-symlink-dir/pkg-dir-symlink-0/{ => tmp}/file-symlink (100%)
rename t-symlink-dir/pkg-dir-symlink-0/{ => tmp}/test-symlink (100%)
rename t-symlink-dir/pkg-dir-symlink-1/{ => tmp}/file-symlink (100%)
rename t-symlink-dir/pkg-dir-symlink-1/{ => tmp}/test-symlink (100%)
rename t-symlink-dir/pkg-file/{ => tmp}/test-symlink/file-file (100%)
diff --git a/t-symlink-dir/pkg-dir-real/test-dir/file-dir
b/t-symlink-dir/pkg-dir-real/tmp/test-dir/file-dir
similarity index 100%
rename from t-symlink-dir/pkg-dir-real/test-dir/file-dir
rename to t-symlink-dir/pkg-dir-real/tmp/test-dir/file-dir
diff --git a/t-symlink-dir/pkg-dir-symlink-0/file-symlink
b/t-symlink-dir/pkg-dir-symlink-0/tmp/file-symlink
similarity index 100%
rename from t-symlink-dir/pkg-dir-symlink-0/file-symlink
rename to t-symlink-dir/pkg-dir-symlink-0/tmp/file-symlink
diff --git a/t-symlink-dir/pkg-dir-symlink-0/test-symlink
b/t-symlink-dir/pkg-dir-symlink-0/tmp/test-symlink
similarity index 100%
rename from t-symlink-dir/pkg-dir-symlink-0/test-symlink
rename to t-symlink-dir/pkg-dir-symlink-0/tmp/test-symlink
diff --git a/t-symlink-dir/pkg-dir-symlink-1/file-symlink
b/t-symlink-dir/pkg-dir-symlink-1/tmp/file-symlink
similarity index 100%
rename from t-symlink-dir/pkg-dir-symlink-1/file-symlink
rename to t-symlink-dir/pkg-dir-symlink-1/tmp/file-symlink
diff --git a/t-symlink-dir/pkg-dir-symlink-1/test-symlink
b/t-symlink-dir/pkg-dir-symlink-1/tmp/test-symlink
similarity index 100%
rename from t-symlink-dir/pkg-dir-symlink-1/test-symlink
rename to t-symlink-dir/pkg-dir-symlink-1/tmp/test-symlink
diff --git a/t-symlink-dir/pkg-file/DEBIAN/conffiles
b/t-symlink-dir/pkg-file/DEBIAN/conffiles
index 551fc78..82a12cc 100644
--- a/t-symlink-dir/pkg-file/DEBIAN/conffiles
+++ b/t-symlink-dir/pkg-file/DEBIAN/conffiles
@@ -1 +1 @@
-/test-symlink/file-file
+/tmp/test-symlink/file-file
diff --git a/t-symlink-dir/pkg-file/test-symlink/file-file
b/t-symlink-dir/pkg-file/tmp/test-symlink/file-file
similarity index 100%
rename from t-symlink-dir/pkg-file/test-symlink/file-file
rename to t-symlink-dir/pkg-file/tmp/test-symlink/file-file
--
2.11.0
--
Cheers,
Alejandro
Reply to: