Skip to content

Commit 8947d2b

Browse files
committed
[GR-18163] Fix File.utime to return the number of file names in the arguments
PullRequest: truffleruby/3223
2 parents 4b3ede9 + a29662d commit 8947d2b

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Compatibility:
4040
* Update `String#<<` to require one argument (#2609, @bjfish).
4141
* Update `String#split` to raise `TypeError` when false is given (#2606, @bjfish).
4242
* Update `String#lstrip!` to remove leading null characters (#2607, @bjfish).
43+
* Update `File.utime` to return the number of file names in the arguments (#2616, @bjfish).
4344

4445
Performance:
4546

spec/ruby/core/file/utime_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@
7777
File.mtime(@file1).nsec.should.between?(0, 123500000)
7878
end
7979

80+
it "returns the number of filenames in the arguments" do
81+
File.utime(@atime.to_f, @mtime.to_f, @file1, @file2).should == 2
82+
end
83+
8084
platform_is :linux do
8185
platform_is wordsize: 64 do
8286
it "allows Time instances in the far future to set mtime and atime (but some filesystems limit it up to 2446-05-10 or 2038-01-19)" do

src/main/ruby/truffleruby/core/file.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,7 @@ def self.utime(atime, mtime, *paths)
11161116
mtime.to_i, mtime.nsec)
11171117
Errno.handle unless n == 0
11181118
end
1119+
paths.size
11191120
end
11201121

11211122
def self.world_readable?(path)

0 commit comments

Comments
 (0)