View Issue Details

IDProjectCategoryView StatusLast Update
00004891003.1(2008)/Issue 7System Interfacespublic2019-06-10 08:55
Reportereblake Assigned Toajosey  
PrioritynormalSeverityObjectionTypeError
Status ClosedResolutionAccepted 
NameEric Blake
OrganizationRed Hat
User Referenceebb.truncate
Sectiontruncate
Page Number2136
Line Number67570
Interp Status---
Final Accepted Text
Summary0000489: truncate should affect timestamps even for no size change
DescriptionThe wording for ftruncate() requires mtime and ctime updates on successful
completion, even when no change in file size occurs. However, truncate()
does not describe what happens when no size change occurs, which is
inconsistent with ftruncate(), and which is at odds with XBD 4.8 stating
that ctime updates occur even if the metadata written (in this case, the
file size) is identical to what it already was.
Desired ActionAt line 67570 [XSH truncate() DESCRIPTION], change the sentence:

"Upon successful completion, if the file size is changed, truncate( )
shall mark for update the last data modification and last file status
change timestamps of the file, and the S_ISUID and S_ISGID bits of the
file mode may be cleared."

to:

"Upon successful completion, truncate( ) shall mark for update the last
data modification and last file status change timestamps of the file,
and the S_ISUID and S_ISGID bits of the file mode may be cleared."
Tagstc2-2008

Relationships

related to 0000485 Closedajosey Unclear explanation about when last file status change timestamp shall be updated 

Activities

mkerrisk

2012-02-14 10:36

reporter   bugnote:0001127

While I agree with Eric about the strange inconsistency between truncate() and ftruncate(), the approved change *will* make Linux nonconformant.

On Linux, the ftruncate() system call always changes the file timestamps, even if the file size is not changed. However, Linux truncate() only changes the timestamps if the file size changes. (This observation is based on my reading of the kernel source and some userspace programs to test these details.) I haven't delved into the history, but quite possibly the Linux behavior occurs because the implementers looked closely at the specifications for these two functions.

I think some consideration should be given to existing Linux behavior before modifying the standard in a way that renders Linux nonconformant.

Issue History

Date Modified Username Field Change
2011-09-01 15:48 eblake New Issue
2011-09-01 15:48 eblake Status New => Under Review
2011-09-01 15:48 eblake Assigned To => ajosey
2011-09-01 15:48 eblake Name => Eric Blake
2011-09-01 15:48 eblake Organization => Red Hat
2011-09-01 15:48 eblake User Reference => ebb.truncate
2011-09-01 15:48 eblake Section => truncate
2011-09-01 15:48 eblake Page Number => 2136
2011-09-01 15:48 eblake Line Number => 67570
2011-09-01 15:48 eblake Interp Status => ---
2011-09-01 15:50 eblake Relationship added related to 0000485
2011-09-08 15:32 nick Status Under Review => Resolved
2011-09-08 15:32 nick Resolution Open => Accepted
2011-09-08 15:32 nick Tag Attached: tc2-2008
2012-02-14 10:36 mkerrisk Note Added: 0001127
2019-06-10 08:55 agadmin Status Resolved => Closed