Bug 209031

Summary: Files in procfs return EOF after the first partial read
Product: File System Reporter: Matias A. Fonzo (selk)
Component: OtherAssignee: fs_other
Status: NEW ---    
Severity: normal CC: selk
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: Any Subsystem:
Regression: No Bisected commit-id:
Attachments: Demo program

Description Matias A. Fonzo 2020-08-25 00:26:09 UTC
Created attachment 292157 [details]
Demo program

Shells must read in single-byte reads, and that procfs violates the normal filesystem expectations, and that the C sample program demonstrates that behavior.

My use case is with the mksh shell, for example:

IFS= read -r < /proc/sys/kernel/random/poolsize size; echo $size

Gives:
4

Then it returns with 1 (exit status).

The default value at the poolsize is: 4096