Bug 43891

Summary: Undocumented behavior: write(2) over a disk label returns EROFS
Product: Documentation Reporter: Diomidis Spinellis <dds>
Component: Books & ArticlesAssignee: Jens Schweikhardt <schweikh>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Diomidis Spinellis 2002-10-10 13:50:02 UTC
Writing over a disk label results in write(2) returning EROFS.
The EROFS return value is not documented in the write(2) man page.
The disklabel(8) man page claims that the driver does silently ignore
writing over disk labels.

Fix: I propose fixing the documentation to conform to the code;
silently ignoring requests is bad behaviour.  Apply the following
fix:
*** disklabel.8	2002/10/10 11:52:48	1.1
--- disklabel.8	2002/10/10 11:58:07
***************
How-To-Repeat: strace dd if=/dev/zero of=/dev/ad0
If you feel nervous abour running the above command (I certainly would,
it can trash the entire disk) search for EROFS in
src/sys/kern/subr_diskslice.c
Comment 1 Jens Schweikhardt freebsd_committer freebsd_triage 2002-10-10 18:22:50 UTC
Responsible Changed
From-To: freebsd-doc->schweikh

I'll take care of my fellow IOCCC winner's problem report :-)
Comment 2 Jens Schweikhardt freebsd_committer freebsd_triage 2002-10-10 20:16:25 UTC
State Changed
From-To: open->patched

Committed to -current with a slight modification, s/disk/slice/. 
MFC in 3 days. Thanks Diomidis!
Comment 3 Jens Schweikhardt freebsd_committer freebsd_triage 2002-10-13 18:42:27 UTC
State Changed
From-To: patched->closed

MFC committed to RELENG_4.