ruby / ruby/rake

Rake executes file task when prerequisites have older timestamp

オープン
#246 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Ruby
スター
2.5k
フォーク
650
平均マージ
6分
マージ済み PR(30日)
3

説明

When a file task depends on some non-file task indirectly,
Rake executes the file task even if its immediate prerequisite files have older timestamp.

It looks like the behavior changed at 12.1.0.

Example
require "rake/clean"

CLEAN.include("config.yml", "component")

task "setup" do
  puts Rake::VERSION
  touch "config.yml" unless File.exist?("config.yml")
end

file "config.yml" => "setup"

file "component" => "config.yml" do |t|
  puts "[config.yml] #{File.mtime(t.prerequisites[0])}"
  puts "[component]  #{File.exist?(t.name) && File.mtime(t.name)}"
  sleep 1
  touch t.name
end

Based on the above Rakefile, clean up and create the "component" first.

$ rake clean && rake component

The next rake component results in different behavior as follows.
On 12.0.0:

$ rake component --trace
(in /path/to/Rakefile-directory)
** Invoke component (first_time, not_needed)
** Invoke config.yml (first_time)
** Invoke setup (first_time)
** Execute setup
12.0.0
** Execute config.yml

On 12.1.0:

$ rake component --trace
(in /path/to/Rakefile-directory)
** Invoke component (first_time)
** Invoke config.yml (first_time)
** Invoke setup (first_time)
** Execute setup
12.1.0
** Execute config.yml
** Execute component
[config.yml] 2018-01-01 15:13:19 +0900
[component]  2018-01-01 15:13:20 +0900
touch component

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Rakefile の例で問題を再現し、影響を受ける動作と 12.0 の間で --trace の出力を比較します。まず、file-task の前提条件とタイムスタンプがどのように評価されるかを追跡します。rake component が直接の前提ファイルが古い場合に file task を実行しなくなれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
ruby
領域
build-system
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。