Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Nov 2003 09:17:58 +0100 (CET)
From:      dirk.meyer@dinoex.sub.org
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/59456: fdescfs stat / compress creates only empty files
Message-ID:  <200311190817.hAJ8HwjD019104@home.dinoex.sub.de>
Resent-Message-ID: <200311190820.hAJ8KOGJ084283@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         59456
>Category:       bin
>Synopsis:       fdescfs stat / compress creates only empty files
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 19 00:20:24 PST 2003
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311190817.hAJ8HwjD019104>