where to place patch for #163988
Hi,
I need a patch for bug #163988, but I don't know where to change the
code. The decision to create a link is made in lib/tarfn.c, but it is
overwritten by main/archives.c. So it should be the right thing to place
in archives.c the patch, but what's going on in lib/star.c? When is it
used?
The best thing I think is to try to create a symlink if link() fails. So
my patch would look this:
#v+
diff -ur dpkg-1.10.15/main/archives.c /home/Sources/dpkg-1.10.15/main/archives.c
--- dpkg-1.10.15/main/archives.c 2002-08-24 21:22:33.000000000 +0200
+++ /home/Sources/dpkg-1.10.15/main/archives.c 2003-11-28 18:26:47.000000000 +0100
@@ -535,8 +535,12 @@
varbufreset(&hardlinkfn);
varbufaddstr(&hardlinkfn,instdir); varbufaddc(&hardlinkfn,'/');
varbufaddstr(&hardlinkfn,ti->LinkName); varbufaddc(&hardlinkfn,0);
- if (link(hardlinkfn.buf,fnamenewvb.buf))
- ohshite(_("error creating hard link `%.255s'"),ti->Name);
+ if (link(hardlinkfn.buf,fnamenewvb.buf)) {
+ fprintf(_("dpkg: warning - creating hard link `%.255s' failed;"
+ " creating symbolic link instead"),ti->Name);
+ if (symlink(hardlinkfn.buf,fnamenewvb.buf))
+ ohshite(_("error creating symbolic link `%.255s'"),ti->Name);
+ }
debug(dbg_eachfiledetail,"tarobject HardLink");
newtarobject_allmodes(fnamenewvb.buf,ti, nifd->namenode->statoverride);
break;
#v-
This isn't the final patch, but before I would go on, I'd like to know if
I am on the right way. Should there be an option to enable this behaviour?
Bye, Joerg.
Reply to: