Bug 209031 - Files in procfs return EOF after the first partial read
Summary: Files in procfs return EOF after the first partial read
Status: NEW
Alias: None
Product: File System
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: fs_other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-25 00:26 UTC by Matias A. Fonzo
Modified: 2020-08-25 00:28 UTC (History)
1 user (show)

See Also:
Kernel Version: Any
Subsystem:
Regression: No
Bisected commit-id:


Attachments
Demo program (497 bytes, text/x-csrc)
2020-08-25 00:26 UTC, Matias A. Fonzo
Details

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

Note You need to log in before you can comment on or make changes to this bug.