[bug #48371] read(fd, NULL, 0) from /dev/klog blocks until there is data

2016-07-01 Thread Kalle Olavi Niemitalo
URL:
  

 Summary: read(fd, NULL, 0) from /dev/klog blocks until there
is data
 Project: The GNU Hurd
Submitted by: kon
Submitted on: Fri Jul  1 21:47:46 2016
Category: Hurd Servers
Severity: 3 - Normal
Priority: 5 - Normal
  Item Group: Standard Compliance
  Status: None
 Privacy: Public
 Assigned to: None
 Originator Name: 
Originator Email: 
 Open/Closed: Open
 Discussion Lock: Any
 Reproducibility: None
  Size (loc): None
 Planned Release: None
  Effort: 0.00
Wiki-like text discussion box: 

___

Details:

I patched rsyslog 8.16.0 to make it use /dev/klog on the Hurd.  (Set
os_type="bsd" in configure.ac.)  It opened /dev/klog all right but then hung
waiting for input.  rpctrace showed that it was calling read with size=0. 
This call is in plugins/imklog/bsd.c (klogWillRunPostPrivDrop).  I removed the
call and rsyslog then started quickly.

The translator of /dev/klog is "/hurd/streamio kmsg".  I assume storeio gets
to the dev_read function, which then waits for input from the kernel, without
noticing that the requested size is 0.

According to antrik, POSIX specifies that read with nbyte==0 must immediately
return 0 or return an error.  This could be implemented in libc, libtrivfs, or
streamio.  It seems best to implement this in streamio so that translators can
still return EBADF if the file was not opened for reading.




___

Reply to this item at:

  

___
  Message sent via/by Savannah
  http://savannah.gnu.org/




[bug #48372] read with size 0 from fifo blocks

2016-07-01 Thread Kalle Olavi Niemitalo
URL:
  

 Summary: read with size 0 from fifo blocks
 Project: The GNU Hurd
Submitted by: kon
Submitted on: Fri Jul  1 22:00:01 2016
Category: Hurd Servers
Severity: 3 - Normal
Priority: 5 - Normal
  Item Group: Standard Compliance
  Status: None
 Privacy: Public
 Assigned to: None
 Originator Name: 
Originator Email: 
 Open/Closed: Open
 Discussion Lock: Any
 Reproducibility: Every Time
  Size (loc): None
 Planned Release: None
  Effort: 0.00
Wiki-like text discussion box: 

___

Details:

mkfifo da; sleep 1000 > da & rpctrace perl -e 'sysread STDIN, $_, 0' < da

hangs at:  136<--159(pid1132)->io_read (-1 0)

According to antrik, POSIX specifies that read with nbyte==0 must immediately
return 0 or return an error. This could be implemented in libc, libtrivfs,
fifo, or libpipe. It seems best to implement this in fifo or libpipe so that
fifo can still return EBADF if the fifo was not opened for reading.

I filed this as distinct from bug 48371 (for the streamio translator) because
they can be fixed and tested independently.




___

Reply to this item at:

  

___
  Message sent via/by Savannah
  http://savannah.gnu.org/




[bug #48371] read(fd, NULL, 0) from /dev/klog blocks until there is data

2016-07-01 Thread Kalle Olavi Niemitalo
Follow-up Comment #1, bug #48371 (project hurd):

I wrote "storeio gets to the dev_read function" but I really meant streamio.

___

Reply to this item at:

  

___
  Message sent via/by Savannah
  http://savannah.gnu.org/




[bug #48372] read with size 0 from fifo blocks

2016-07-01 Thread Kalle Olavi Niemitalo
Follow-up Comment #1, bug #48372 (project hurd):

/hurd/new-fifo has the same problem.

___

Reply to this item at:

  

___
  Message sent via/by Savannah
  http://savannah.gnu.org/