Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Rule dependencies' behaviour is strange, possibly broken or poorly documented

Aperta
#626 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
ruby
Ambito
build-system

Direzione di ricerca

Riproduci il report dal Rakefile fornito, eseguendo prima rake, rake test.pre, rake test0.txt e rake test.txt, quindi ripeti dopo aver modificato test.pre e test0.pre. Traccia la risoluzione delle dipendenze delle regole e la gestione dei timestamp da parte di Rake. Il lavoro è completato quando il comportamento delle dipendenze è corretto o chiaramente documentato, con una copertura di regressione per entrambi i casi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Consider this Rakefile:

require 'rake/clean'

task default: :test
task test: 'test.txt'

file 'test.txt' => 'test0.txt'

rule '.txt' => '.pre' do |t|
  sh 'cp', t.source, t.name
end

rule '.pre' do |t|
  sh 'touch', t.name
end

CLEAN.include('*.pre')
CLOBBER.include('*.txt')

This Rakefile demonstrates 2 related issues.

The implicit dependency test.pre is not built automatically

In a folder containing only this Rakefile, try:

$ rake
touch test0.pre
cp test0.pre test0.txt
cp test.pre test.txt
cp: cannot stat 'test.pre': No such file or directory
rake aborted!
Command failed with status (1): [cp test.pre test.txt...]
[...]

This creates test0.pre and test0.txt, but fails to create test.pre and test.txt.

However, the following sequence of commands works without issues:

$ rake test.pre
touch test.pre
$ rake
touch test0.pre
cp test0.pre test0.txt
cp test.pre test.txt

Thus, rake knows how to build test.pre, but skips it unless asked explicitly.

Note that despite skipping test.pre, rake builds test0.pre automatically, while both are dependencies by the same rule.

In fact, starting from a folder containing only this Rakefile,

  • rake test0.txt works,
  • rake test.txt fails.

Updating test.pre does not trigger rebuilding of test.txt

Assume that everything has been built with

$ rake test.pre
$ rake

Now, try this:

$ touch test.pre
$ rake

Nothing happens.

Now, try:

$ touch test0.pre
$ rake
cp test0.pre test0.txt
cp test.pre test.txt

This triggers rebuilding.

Rake version

rake version: 13.0.6.

Lingua principale
Ruby
Stelle
2.5k
Fork
650
Merge medio
6m
PR unite (30g)
3

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ruby/rake

Tutte le issue di ruby/rake

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.