Bug 88595 - gawk-3.1.2-1 won't read special device which stat() says is empty
Summary: gawk-3.1.2-1 won't read special device which stat() says is empty
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: gawk
Version: 1.0
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Florian La Roche
QA Contact: Brock Organ
Depends On:
TreeView+ depends on / blocked
Reported: 2003-04-11 06:53 UTC by Jonathan Kamens
Modified: 2007-04-18 16:52 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2003-04-15 08:43:34 UTC

Attachments (Terms of Use)

Description Jonathan Kamens 2003-04-11 06:53:35 UTC
jik:~!1021$ rpm -q gawk
jik:~!1022$ stat /proc/mdstat
  File: `/proc/mdstat'
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: 2h/2d   Inode: 4468        Links: 1    
Access: (0444/-r--r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2003-04-11 02:52:24.000000000 -0400
Modify: 2003-04-11 02:52:24.000000000 -0400
Change: 2003-04-11 02:52:24.000000000 -0400

jik:~!1023$ cat /proc/mdstat | awk '{print}'
Personalities : [raid1] 
read_ahead 1024 sectors
md0 : active raid1 [dev 08:05][1] hde6[0]
      2305152 blocks [2/2] [UU]
md1 : active raid1 [dev 08:06][1] hdg4[0]
      4096448 blocks [2/2] [UU]
md2 : active raid1 [dev 08:07][1] hdg3[0]
      264960 blocks [2/2] [UU]
md3 : active raid1 [dev 08:08][1] hdg1[0]
      3140608 blocks [2/2] [UU]
unused devices: <none>
jik:~!1024$ awk '{print}' /proc/mdstat

Awk is being too smart here.  If the file it's told to read is a device rather
than a regular file, it shouldn't pay attention to the size indicated in the
stat() structure for the file -- it should just open the file and try to read it
until it gets EOF.

Comment 1 Florian La Roche 2003-04-11 18:51:08 UTC
This is no device, but marked as regular file.

Florian La Roche

Comment 2 Florian La Roche 2003-04-15 08:43:34 UTC
Fixed in gawk-3.1.2-2, soon in rawhide.

Thanks a lot for this bug-report,

Florian La Roche

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