fallback if creating hard links fail (patch)
Hi,
I've a filesystem that do not support hard links across directories.
Currently we solve the problems while the dpkg unpack phase with this
patch:
#v+
diff -ur dpkg-1.10.25/main/archives.c dpkg-1.10.25.patched/main/archives.c
--- dpkg-1.10.25/main/archives.c 2004-11-11 21:10:03.000000000 +0100
+++ archives.c 2004-12-02 17:20:06.000000000 +0
@@ -570,8 +570,15 @@
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)) {
+ if (errno != EXDEV)
+ ohshite(_("error creating hard link `%.255s'"),ti->Name);
+
+ fprintf(stderr, "dpkg: warning - creation of hardlink failed %s -> %s"
+ " - making symlink\n", hardlinkfn.buf, fnamenewvb.buf);
+ 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-
It's a simple fallback to symlinks if hard links fail. Is it possible to
add this patch to the debian package?
Bye, Jörg.
--
Richard is only to blame for his inability to spell /dev/disk correctly.
Albert Cahalan, <1072236794.1743.244.camel@cube>, lkml
Reply to: