From owner-freebsd-bugs Thu May 16 00:20:31 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id AAA03537 for bugs-outgoing; Thu, 16 May 1996 00:20:31 -0700 (PDT) Received: from hauki.clinet.fi (root@hauki.clinet.fi [194.100.0.1]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id AAA03532 for ; Thu, 16 May 1996 00:20:26 -0700 (PDT) Received: from cantina.clinet.fi (root@cantina.clinet.fi [194.100.0.15]) by hauki.clinet.fi (8.7.5/8.6.4) with ESMTP id KAA09640; Thu, 16 May 1996 10:20:00 +0300 (EET DST) Received: (hsu@localhost) by cantina.clinet.fi (8.7.5/8.6.4) id KAA19035; Thu, 16 May 1996 10:19:59 +0300 (EET DST) Date: Thu, 16 May 1996 10:19:59 +0300 (EET DST) Message-Id: <199605160719.KAA19035@cantina.clinet.fi> From: Heikki Suonsivu To: lamuh@stoat.riga.lv Cc: freebsd-bugs@freebsd.org In-reply-to: lamuh@stoat.riga.lv's message of 16 May 1996 05:23:00 +0300 Subject: Re: bin/1205: ln -F dir1 dir2 Organization: Clinet Ltd, Espoo, Finland References: <199605152321.CAA00516@stoat.riga.lv> Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk From: lamuh@stoat.riga.lv >Number: 1205 >Synopsis: hardlinked directories can be created but not deleted theres an undocumented option to ln(1), it is ``-F''. it allows to hardlink directories. seems that there is no way to delete these directories. so, fsck(8) should be done three times to correct this problem. >How-To-Repeat: # cd /tmp # mkdir dir1 # ln -F dir1 dir2 # rmdir dir1 rmdir: dir1: Directory not empty # >Fix: i have no ideas how to fix it. This might work if run as root: cat > foo.c main() { exit(unlink("dir1")); } ^D gcc foo.c -o foo ./foo rm foo At some point in history, and still reflected by unlink(2), unlink system call allows removing a directory. The result will be a mess, so make sure to fsck after doing it. Another way to get rid of the doubly linked directory is to use clri to clear the directory inode and let fsck to fix the results. -- Heikki Suonsivu, T{ysikuu 10 C 83/02210 Espoo/FINLAND, hsu@clinet.fi mobile +358-40-5519679 work +358-0-4375360 fax -4555276 home -8031121