Subject: kern/32061: # cat /dev/ulpt0 -- causes fatal trap 12
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <apivovarov@gamil.com>
List: netbsd-bugs
Date: 11/13/2005 10:01:00
>Number:         32061
>Category:       kern
>Synopsis:       # cat /dev/ulpt0  --  causes fatal trap 12
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 13 10:01:00 +0000 2005
>Originator:     Alex Pivovarov
>Release:        2.0.2
>Organization:
>Environment:
>Description:
# cat /dev/ulpt0  --  causes fatal trap 12

this problem was firstly discovered in FreeBSD
PR 88886
http://www.freebsd.org/cgi/query-pr.cgi?pr=88886

and was fixed.
I tried it on NetBSD 2.0.2 - and get the same result (fatal trap 12)
>How-To-Repeat:
Connect some USB printer and type

# cat /dev/ulpt0 

then after pressing Ctrl-C  you get fatal trap 12
>Fix:
alex@st1$ diff -u 1.69 ulpt.c
--- 1.69        Sun Nov 13 12:49:10 2005
+++ ulpt.c      Sun Nov 13 12:57:43 2005
@@ -619,7 +619,7 @@
                }

                /* If it's not opened for read then set up a reader. */
-               if (!(flags &amp; FREAD)) {
+               if (!(flag &amp; FREAD)) {
                        DPRINTF((&quot;ulpt_open: start read callout\n&quot;));
                        usb_callout_init(sc-&gt;sc_read_callout);
                        usb_callout(sc-&gt;sc_read_callout, hz/5, ulpt_tick, sc);