On Tue, Mar 18, 2014 at 03:33:35PM +0100, Guillem Jover wrote:
> Hi!
Hi Guillem,
[..]
> This is “expected” behaviour, I documented it in the dpkg FAQ because it
> seems to trip people over. The Debian policy also documents this (§6.6.4).
>
> <https://wiki.debian.org/Teams/Dpkg/FAQ#Q:_Will_dpkg_replace_a_symlink_with_a_directory_or_vice_versa.3F>
>
> Given the above, I'll be closing this report if there's no other
> issues besides this one.
Thanks for your reply and the link to the FAQ and sorry for this
unneeded bugreport. I should have been move careful in my
research. Feel free to close the report.
Given that this behavior is not that (that) intuitive I wonder if dpkg
could issue a warning during unpack? Maybe something like the attached
patch? I'm happy to improve the warning message and add one for the
other way around (dir is replaced with symlink).
Could you elaborate a little bit what the FAQ means with metadata
tracking? Would the $pkg.lists file need to be amended with
information like:
/path/to/dir =d
/path/to/file =f
/path/to/symlink =s
?
Thanks for your consideration.
Cheers,
Michael
diff -Nru dpkg-1.17.5ubuntu5/src/archives.c dpkg-1.17.5ubuntu6/src/archives.c
--- dpkg-1.17.5ubuntu5/src/archives.c 2013-12-10 07:15:02.000000000 +0100
+++ dpkg-1.17.5ubuntu6/src/archives.c 2014-03-18 18:41:32.000000000 +0100
@@ -880,6 +880,11 @@
}
break;
case tar_filetype_dir:
+ // warn if a previous fs symlink becomes a dir
+ if (lstat(fnamevb.buf,&stabtmp) == 0 && S_ISLNK(stabtmp.st_mode)) {
+ warning(_("New directory %s is currently a symlink, things may go bad. See debian policy §6.6.4"), fnamevb.buf);
+ }
+
/* If it's already an existing directory, do nothing. */
if (!stat(fnamevb.buf,&stabtmp) && S_ISDIR(stabtmp.st_mode)) {
debug(dbg_eachfiledetail, "tarobject directory exists");