Jason Shirk opened issue #69: -o should not require %n when %h is specified at Aki Helin / radamsa

Jason Shirk
2020-02-26T01:03:07Z

Repro:

> radamsa.exe -n 100 -o %h.%s seed.txt
Refusing to overwrite file '%h.%s' many times. You should add %n or %0[padding]n to the path.

I think this should be allowed.

I tested the following patch:

diff --git a/rad/output.scm b/rad/output.scm
index dee8ef0..dccbc3c 100644
--- a/rad/output.scm
+++ b/rad/output.scm
@@ -326,8 +326,8 @@
(make-udp-client (list->vector bs) port))
(else
(tcp-client (list->vector bs) port)))))
- ((and (> n 1) (not (m/%(0[1-9][0-9]*)?n/ str)))
- (print-to stderr "Refusing to overwrite file '" str "' many times. You should add %n or %0[padding]n to the path.")
+ ((and (> n 1) (not (m/%(h|(0[1-9][0-9]*)?n)/ str)))
+ (print-to stderr "Refusing to overwrite file '" str "' many times. You should add %h, %n or %0[padding]n to the path.")
#false)
(else
(file-writer str suf))))

Issues this patch ignores:

What if collision detection is disabled (-C 0)?

What if the output directory has an existing corpus?