ruby / ruby/rake

Shared multitask prerequisite intermittently executed multiple times

Offen
#274 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Ruby
Sterne
2.5k
Forks
650
Ø Merge
6 Min.
Gemergte PRs (30 T.)
3

Beschreibung

Given a Rakefile

multitask :default => [:a, :b, :c, :d, :e]

task :a => ['target']
task :b => ['target']
task :c => ['target']
task :d => ['target']
task :e => ['target']

rule(/^target$/ => [ 'source' ]) do |t|
    p "#{t.name} => #{t.source}"
    p t.actions
end

file 'source'

the target may get executed multiple times like this

$ ruby --version
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-musl]
$ rake --version
rake, version 12.3.1
$ rake --trace --rules
** Invoke default (first_time)
** Invoke a (first_time)
Attempting Rule target => source
** Invoke b (first_time)
Attempting Rule target => source
** Invoke c (first_time)
Attempting Rule target => source
** Invoke d (first_time)
Attempting Rule target => source
(target => source ... EXIST)
** Invoke e (first_time)
Attempting Rule target => source
(target => source ... EXIST)
(target => source ... EXIST)
** Invoke target (first_time)
(target => source ... EXIST)
** Invoke source (first_time)
(target => source ... EXIST)
** Execute source
** Execute target
"target => source"
[#<Proc:0x000055e092b971c0@/repo/Rakefile:10>, #<Proc:0x000055e092b971c0@/repo/Rakefile:10>, #<Proc:0x000055e092b971c0@/repo/Rakefile:10>, #<Proc:0x000055e092b971c0@/repo/Rakefile:10>, #<Proc:0x000055e092b971c0@/repo/Rakefile:10>]
"target => source"
[#<Proc:0x000055e092b971c0@/repo/Rakefile:10>, #<Proc:0x000055e092b971c0@/repo/Rakefile:10>, #<Proc:0x000055e092b971c0@/repo/Rakefile:10>, #<Proc:0x000055e092b971c0@/repo/Rakefile:10>, #<Proc:0x000055e092b971c0@/repo/Rakefile:10>]
"target => source"
[#<Proc:0x000055e092b971c0@/repo/Rakefile:10>, #<Proc:0x000055e092b971c0@/repo/Rakefile:10>, #<Proc:0x000055e092b971c0@/repo/Rakefile:10>, #<Proc:0x000055e092b971c0@/repo/Rakefile:10>, #<Proc:0x000055e092b971c0@/repo/Rakefile:10>]
"target => source"
[#<Proc:0x000055e092b971c0@/repo/Rakefile:10>, #<Proc:0x000055e092b971c0@/repo/Rakefile:10>, #<Proc:0x000055e092b971c0@/repo/Rakefile:10>, #<Proc:0x000055e092b971c0@/repo/Rakefile:10>, #<Proc:0x000055e092b971c0@/repo/Rakefile:10>]
"target => source"
[#<Proc:0x000055e092b971c0@/repo/Rakefile:10>, #<Proc:0x000055e092b971c0@/repo/Rakefile:10>, #<Proc:0x000055e092b971c0@/repo/Rakefile:10>, #<Proc:0x000055e092b971c0@/repo/Rakefile:10>, #<Proc:0x000055e092b971c0@/repo/Rakefile:10>]
** Execute d
** Invoke target 
** Execute b
** Invoke target 
** Execute a
** Invoke target 
** Execute c
** Invoke target 
** Execute e
** Execute default

The results differ between runs. It seems to happen more often with debug output.

The same action block gets added multiple times to the same task.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere das Problem mit der bereitgestellten Rakefile-Datei unter Verwendung von rake --trace --rules, wobei die Debug-Ausgabe und wiederholte Ausführungen variiert werden. Verfolge die Einstiegspunkte von multitask und rule-resolution, um festzustellen, warum dieselbe Aktion wiederholt hinzugefügt wird; fertig ist die Aufgabe, wenn die Aktion des gemeinsamen Ziels konsistent genau einmal ausgeführt wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
ruby
Bereich
build-system
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.