Closed Bug 3534 Opened 26 years ago Closed 25 years ago

[PP] PR_Seek should allow offsets past EOF

Categories

(NSPR :: NSPR, defect, P3)

PowerPC
Mac System 8.5
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: gordon, Assigned: sdagley)

Details

John McMullen reports that PR_Seek on other platforms actually allows an offset past the end of file. PR_Seek on macintosh should be made to work the same way.
Summary: [PP] → [PP] PR_Seek should allow offsets past EOF
Assignee: wtc → gordon
Reassigned the bug to gordon.
Status: NEW → ASSIGNED
Target Milestone: M4
Changed target milestone to M4. I thought this was fixed already?
Don, pink fixed the only one known place (in the registry code) where this was called with the win/unix assumption. The real fix is to make the win/unix assumption valid always in future. Pink's fix was to write out enough bogus data to make the seek work.
And i'm sure that I'm writing out random bits of memory to disk, so there are certain privacy issues involved in that ;)
Note that while PR_Seek on Unix/Win platforms allows setting the file pointer beyond the current end of file, the file size itself is not changed by the seek operation. The next PR_Write call causes the write to happen at the new pointer; the data between the original end-of-file position and the position of the file pointer after PR_Seek is zero-filled by the OS. That is, if PR_Seek is used to seek beyond the end-of-file and the file is closed, there will be no change to the contents of the file (or the file size) on Unix/win platforms. To emulate the same semantics on Mac, one can save the file pointer in nspr's fd and extend the file on the next call to PR_Write. Also, file extension should be done with zero-filled pages, rather than random data.
Changed target milestone to M6.
Assignee: gordon → sdagley
Status: ASSIGNED → NEW
Offloading some of gordon's doomage
NSPR now has its own Bugzilla product. Moving this bug to the NSPR product.
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Fix checked in. The old code would actually re-set the EOF on a seek past the current EOF but did not advance the file mark after resetting EOF.
this fix is not visible to qa. if you think this bug should be reopened, please do so. will mark as verified.
Status: RESOLVED → VERIFIED
Target Milestone: M6 → ---
You need to log in before you can comment on or make changes to this bug.