From dm@home.dinoex.sub.de  Wed Nov 19 00:18:10 2003
Return-Path: <dm@home.dinoex.sub.de>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 63A6916A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 19 Nov 2003 00:18:10 -0800 (PST)
Received: from uucp.dinoex.sub.de (uucp.dinoex.sub.de [212.184.201.182])
	by mx1.FreeBSD.org (Postfix) with ESMTP id AC75643FA3
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 19 Nov 2003 00:18:08 -0800 (PST)
	(envelope-from dm@home.dinoex.sub.de)
Received: from home.dinoex.sub.de (home.dinoex.sub.de [217.6.200.196])
	by uucp.dinoex.sub.de (8.12.10/8.12.10) with ESMTP id hAJ8HtHJ032562
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 19 Nov 2003 09:17:55 +0100 (CET)
	(envelope-from dm@home.dinoex.sub.de)
Received: (from dm@localhost)
	by home.dinoex.sub.de (8.12.10/8.12.9/Submit) id hAJ8HwjD019104;
	Wed, 19 Nov 2003 09:17:58 +0100 (CET)
	(envelope-from dm)
Message-Id: <200311190817.hAJ8HwjD019104@home.dinoex.sub.de>
Date: Wed, 19 Nov 2003 09:17:58 +0100 (CET)
From: dirk.meyer@dinoex.sub.org
Reply-To: dirk.meyer@dinoex.sub.org
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: fdescfs stat / compress creates only empty files
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         59456
>Category:       kern
>Synopsis:       fdescfs stat / compress creates only empty files
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 19 00:20:24 PST 2003
>Closed-Date:    Sat Jan 23 14:43:33 CET 2010
>Last-Modified:  Sat Jan 23 14:43:33 CET 2010
>Originator:     Dirk Meyer
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
privat
>Environment:

	FreeBSD 5.1-CURRENT

http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/compress/compress.c.diff?r1=1.20&r2=1.21&f=h

>Description:

	compress aborts when writing via stodout.

	fails when fdescfs is mounted:
add to /etc/fstab:
fdescfs                 /dev/fd         fdescfs rw              0       0

# ls -l /dev/stdout
lrwxr-xr-x  1 root  wheel  6 11 Nov 19:39 /dev/stdout@ -> fd/1

without fdescfs:

# ls -l /dev/fd/  
total 0
crw-rw-rw-  1 root  wheel   22,   0 11 Nov 19:39 0
crw-rw-rw-  1 root  wheel   22,   1 11 Nov 19:39 1
crw-rw-rw-  1 root  wheel   22,   2 11 Nov 19:39 2

with fdescfs:
# ls -l /dev/fd/
total 16
crw--w----  1 root  tty      5,   1 19 Nov 05:43 0
crw--w----  1 root  tty      5,   1 19 Nov 05:43 1
crw--w----  1 root  tty      5,   1 19 Nov 05:43 2
crw--w----  1 root  tty      5,   1 19 Nov 05:43 3
crw--w----  1 root  tty      5,   1 19 Nov 05:43 4
crw--w----  1 root  tty      5,   1 19 Nov 05:43 5
d-w-------  1 root  wheel      1024 19 Nov 05:04 6/
d---------  1 root  wheel       512 12 Nov 04:45 7/

but root should be ablte to write

from truss with fdescfs:
stat("/dev/stdout",0xbfbfe610)                   = 0 (0x0)
ioctl(2,TIOCGETA,0xbfbfe160)                     = 0 (0x0)

from truss without fdescfs:
stat("/dev/stdout",0xbfbff540)                   = 0 (0x0)
open("/dev/stdin",0x0,0666)                      = 6 (0x6)
stat("/dev/stdin",0xbfbff5a0)                    = 0 (0x0)

st_mode with fdescfs:
stat = 0x81a4	0100644

#define S_IFREG  0100000                /* regular */
is a regular file (ERROR)

st_mode without fdescfs:
stat = 0x21b6	0020666

#define S_IFCHR  0020000                /* character special */
is character special (OK)


>How-To-Repeat:

root@current# compress -b12 <test.2p >test.2
overwrite /dev/stdout? root@current#

root@current# ls -l test.2*
-rw-r--r--  1 root  wheel  38 19 Nov 04:54 test.2p
-rw-r--r--  1 root  wheel   0 19 Nov 05:11 test.2

>Fix:


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: dinoex 
State-Changed-When: Sat Jan 23 14:41:43 CET 2010 
State-Changed-Why:  


Problem is fixed in FreeBSD 8.0-STABLE #0: Sat Dec 26 16:48:15 CET 2009 

Problem not fixed in FreeBSD 7.2-STABLE #11: Thu Jan  7 10:35:08 CET 2010 


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