Project

General

Profile

Actions

Bug #11638

closed

[doc] misleading IO.write offset description

Added by akostadinov (Aleksandar Kostadinov) about 9 years ago. Updated over 6 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:71277]

Description

"If offset is not given, the file is truncated. Otherwise, it is not truncated."

The above is NOT true when 'a' mode is used. I'd suggest to clarify in documentation that offset is usually 0 if not specified but in 'a' mode it is at end of file or something along these lines.

http://ruby-doc.org/core-2.2.0/IO.html#method-c-write

Updated by takanabe (Takayuki Watanabe) over 7 years ago

Yes. When we use appending mode without offset, the file is not truncated.
Truncating files are occurred in write mode only. So it seems that we should just add the behaviour in write mode rather than adding behaviour in append mode.

I created PR for this ticket on github: https://github.com/ruby/ruby/pull/1571

Actions #2

Updated by hsbt (Hiroshi SHIBATA) about 7 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r60294.


Clarify the behavior of IO.write without offset in write mode.

https://github.com/ruby/ruby/pull/1571

Patch by @takanabe (Takayuki Watanabe) [fix GH-1571]
[Bug #11638][ruby-core:71277]

Actions #3

Updated by hsbt (Hiroshi SHIBATA) about 7 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.2: DONTNEED, 2.3: REQUIRED, 2.4: REQUIRED

Updated by nagachika (Tomoyuki Chikanaga) over 6 years ago

  • Backport changed from 2.2: DONTNEED, 2.3: REQUIRED, 2.4: REQUIRED to 2.2: DONTNEED, 2.3: REQUIRED, 2.4: DONE

ruby_2_4 r62692 merged revision(s) 60294.

Updated by usa (Usaku NAKAMURA) over 6 years ago

  • Backport changed from 2.2: DONTNEED, 2.3: REQUIRED, 2.4: DONE to 2.2: DONTNEED, 2.3: DONE, 2.4: DONE

ruby_2_3 r62823 merged revision(s) 60294.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0