From kahatlen@gmail.com  Tue Sep  5 08:38:02 2006
Return-Path: <kahatlen@gmail.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id DA09216A4DE
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  5 Sep 2006 08:38:02 +0000 (UTC)
	(envelope-from kahatlen@gmail.com)
Received: from smtp.bluecom.no (smtp.bluecom.no [193.75.75.28])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 725E043D45
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  5 Sep 2006 08:38:02 +0000 (GMT)
	(envelope-from kahatlen@gmail.com)
Received: from ugle.hatlen.net (unknown [193.71.105.147])
	by smtp.bluecom.no (Postfix) with ESMTP id D540516F8AD
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  5 Sep 2006 10:37:52 +0200 (CEST)
Received: from ugle.hatlen.net (localhost [127.0.0.1])
	by ugle.hatlen.net (8.13.6/8.13.6) with ESMTP id k858bEL5005524
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 5 Sep 2006 10:37:14 +0200 (CEST)
	(envelope-from kah@ugle.hatlen.net)
Received: (from kah@localhost)
	by ugle.hatlen.net (8.13.6/8.13.6/Submit) id k858bEwB005523;
	Tue, 5 Sep 2006 10:37:14 +0200 (CEST)
	(envelope-from kah)
Message-Id: <200609050837.k858bEwB005523@ugle.hatlen.net>
Date: Tue, 5 Sep 2006 10:37:14 +0200 (CEST)
From: Knut Anders Hatlen <kahatlen@gmail.com>
Reply-To: Knut Anders Hatlen <kahatlen@gmail.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: linux_base-fc-4 - remove() function does not delete empty directories
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         102897
>Category:       ports
>Synopsis:       linux_base-fc-4 - remove() function does not delete empty directories
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-emulation
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 05 08:40:20 GMT 2006
>Closed-Date:    Sun Sep 17 11:24:51 GMT 2006
>Last-Modified:  Sun Sep 17 11:24:51 GMT 2006
>Originator:     Knut Anders Hatlen
>Release:        FreeBSD 6.1-RELEASE-p5 i386
>Organization:
>Environment:
System: FreeBSD ugle.hatlen.net 6.1-RELEASE-p5 FreeBSD 6.1-RELEASE-p5 #4: Mon Sep 4 22:19:20 CEST 2006 root@ugle.hatlen.net:/usr/obj/usr/src/sys/KAH-KERNEL-I386 i386

linux_base-fc-4_8

	
>Description:

After upgrading linux_base from the RedHat port to FC4, I noticed that
a Linux application was unable to remove empty directories (it could
with the RedHat port). When investigating the issue further, it seems
like FC4 has changed the behaviour of the remove() function. With the
RedHat port, it behaves as rmdir() on directories and as unlink()
otherwise (which is the correct behaviour according to the manual for
the GNU C Library). With the FC4 port, it always behaves as unlink()
and therefore fails when it is used on directories.

>How-To-Repeat:

% cat removetest.c
#include <stdio.h>

int main()
{
  if (remove("emptydir") == -1) {
    perror("error");
  }
  return 0;
}
% /usr/compat/linux/usr/bin/gcc removetest.c
% mkdir emptydir
% ./a.out 
error: Operation not permitted


>Fix:

	


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->freebsd-emulation 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Tue Sep 5 09:32:03 UTC 2006 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=102897 

From: "Boris B. Samorodov" <bsam@ipt.ru>
To: bug-followup@FreeBSD.org,kahatlen@gmail.com
Cc:  
Subject: Re: ports/102897: linux_base-fc-4 - remove() function does not delete empty directories?Gcc=INBOX.Sent
Date: Tue, 05 Sep 2006 13:58:23 +0400

 Is your emptydir located under /compat/linux? If not can it be removed
 using full path? Can you send me ktrace.out for "ktrace ./a.out" by
 email?
 
 WBR
 -- 
 bsam

From: Alexander Leidinger <Alexander@Leidinger.net>
To: "Boris B. Samorodov" <bsam@ipt.ru>
Cc: bug-followup@freebsd.org
Subject: Re: ports/102897: linux_base-fc-4 - remove() function does not
	delete empty directories?Gcc=INBOX.Sent
Date: Tue, 05 Sep 2006 17:41:14 +0200

 Quoting "Boris B. Samorodov" <bsam@ipt.ru> (from Tue, 5 Sep 2006 =20
 10:00:44 GMT):
 
 >  Is your emptydir located under /compat/linux? If not can it be removed
 >  using full path? Can you send me ktrace.out for "ktrace ./a.out" by
 >  email?
 
 One of the best ways of handling this would be to test it on a real =20
 FC4 system. If the problem occours there too, the problem is not =20
 FreeBSD related and should be discussed with Fedora.
 
 Since remove() is a libc function and not a syscall, we can't really =20
 do anything in FreeBSD about it when it is a FC4 problem (except to =20
 update the FC4 port with a more recent version of FC4 RPMs).
 
 If a real FC4 system doesn't exhibit this behavior, we need to have a =20
 look at the errno and path handling of the linuxolator.
 
 Bye,
 Alexander.
 
 --=20
 Civilization is the limitless multiplication of unnecessary necessities.
 =09=09-- Mark Twain
 
 http://www.Leidinger.net    Alexander @ Leidinger.net: PGP ID =3D B0063FE7
 http://www.FreeBSD.org       netchild @ FreeBSD.org  : PGP ID =3D 72077137
 

From: Knut Anders Hatlen <kahatlen@gmail.com>
To: Alexander Leidinger <Alexander@Leidinger.net>
Cc: "Boris B. Samorodov" <bsam@ipt.ru>,  bug-followup@freebsd.org
Subject: Re: ports/102897: linux_base-fc-4 - remove() function does not delete empty directories
Date: Tue, 05 Sep 2006 21:42:21 +0200

 Thank you for your suggestions!
 
 The directory is not removed regardless of where it is located. Using
 full path doesn't help either. Output from ktrace can be found at
 http://people.apache.org/~kahatlen/logs/ktrace.out.
 
 I found a real FC4 system (uname -a says: Linux atum01
 2.6.16-1.2096_FC4 #1 Wed Apr 19 15:27:46 EDT 2006 i686 i686 i386
 GNU/Linux) and ran the test there with no problems.
 
 -- 
 Knut Anders

From: Boris Samorodov <bsam@ipt.ru>
To: Knut Anders Hatlen <kahatlen@gmail.com>
Cc: Alexander Leidinger <Alexander@Leidinger.net>,  bug-followup@freebsd.org
Subject: Re: ports/102897: linux_base-fc-4 - remove() function does not delete empty directories
Date: Wed, 06 Sep 2006 00:26:22 +0400

 On Tue, 05 Sep 2006 21:42:21 +0200 Knut Anders Hatlen wrote:
 
 > The directory is not removed regardless of where it is located. Using
 > full path doesn't help either. Output from ktrace can be found at
 > http://people.apache.org/~kahatlen/logs/ktrace.out.
 
 Here is the end of kdump:
 -----
   1107 a.out    CALL  #91(0x28064000,0x3c62)
   1107 a.out    RET   #91 0
   1107 a.out    CALL  unlink(0x80483e0)
   1107 a.out    NAMI  "emptydir"
   1107 a.out    RET   unlink RESTART
   1107 a.out    CALL  dup(0x2)
   1107 a.out    RET   dup 3
   1107 a.out    CALL  semget(0x3,0x3,0)
   1107 a.out    RET   semget 2
   1107 a.out    CALL  ktrace(0)
   1107 a.out    RET   ktrace 134520832/0x804a000
   1107 a.out    CALL  ktrace(0x806b000)
   1107 a.out    RET   ktrace 134656000/0x806b000
   1107 a.out    CALL  mmap(0x3,0xbfbfe1b0,0x28182ff4)
   1107 a.out    RET   mmap 0
   1107 a.out    CALL  ioctl(0x3,0x5401 ,0xbfbfe124)
   1107 a.out    RET   ioctl 0
   1107 a.out    CALL  dup2(0xbfbfe198)
   1107 a.out    RET   dup2 671498240/0x28064000
   1107 a.out    CALL  adjtime(0x3,0,0,0xbfbfe1f4,0x1)
   1107 a.out    RET   adjtime 0
   1107 a.out    CALL  write(0x3,0x28064000,0x1f)
   1107 a.out    GIO   fd 3 wrote 31 bytes
        "error: Operation not permitted
        "
   1107 a.out    RET   write 31/0x1f
   1107 a.out    CALL  close(0x3)
   1107 a.out    RET   close 0
   1107 a.out    CALL  #91(0x28064000,0x1000)
   1107 a.out    RET   #91 0
   1107 a.out    CALL  openbsd_poll(0)
 -----
 
 > I found a real FC4 system (uname -a says: Linux atum01
 > 2.6.16-1.2096_FC4 #1 Wed Apr 19 15:27:46 EDT 2006 i686 i686 i386
 > GNU/Linux) and ran the test there with no problems.
 
 Seems that lunixulator should be patched.
 
 
 WBR
 -- 
 Boris Samorodov (bsam)
 Research Engineer, http://www.ipt.ru, Telephone & Internet SP
 FreeBSD committer, http://www.FreeBSD.org, The Power To Serve
 
State-Changed-From-To: open->patched 
State-Changed-By: netchild 
State-Changed-When: Sun Sep 10 14:30:36 UTC 2006 
State-Changed-Why:  
Patched in -current. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=102897 

From: Knut Anders Hatlen <kahatlen@gmail.com>
To: bug-followup@freebsd.org
Cc: saper@system.pl
Subject: Re: ports/102897: linux_base-fc-4 - remove() function does not delete empty directories
Date: Mon, 11 Sep 2006 08:09:49 +0200

 I have applied Marcin's patch to my source tree (RELENG_6_1) and
 verified that the problem is solved. Thank you very much for fixing it
 so quickly!
 
 -- 
 Knut Anders

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/102897: commit references a PR
Date: Sun, 17 Sep 2006 10:56:43 +0000 (UTC)

 netchild    2006-09-17 10:56:16 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     sys/compat/linux     linux_file.c 
   Log:
   MFC rev 1.97:
   The Linux unlink syscall uses a different errno value when trying to unlink
   a directory.
   
   PR:             102897 [1]  http://www.FreeBSD.org/cgi/query-pr.cgi?pr=102897
   Noticed by:     Knut Anders Hatlen <kahatlen@gmail.com> [1], testrun with LTP
   Submitted by:   Marcin Cieslak <saper@SYSTEM.PL>
   Tested by:      netchild (LTP test run)
   Approved by:    re
   
   Revision  Changes    Path
   1.91.2.1  +7 -0      src/sys/compat/linux/linux_file.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: netchild 
State-Changed-When: Sun Sep 17 11:24:14 UTC 2006 
State-Changed-Why:  
Fix committed to RELENG_6. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=102897 
>Unformatted:
