Do not create output file on error

  • Open
  • quality assurance status badge
Details
2 participants
  • Arun Isaac
  • Ludovic Courtès
Owner
unassigned
Submitted by
Arun Isaac
Severity
normal
A
A
Arun Isaac wrote on 27 Mar 2022 10:51
(address . skribilo-bugs@nongnu.org)
87ee2nrd60.fsf@systemreboot.net
Skribilo creates an empty output file even when it errors out. For
example, if I invoke skribilo as follows with foo.skb being
non-existent, skribilo will error out but still create a foo.html.

Toggle snippet (38 lines)
$ ls foo.html
ls: cannot access 'foo.html': No such file or directory

$ ls foo.skb
ls: cannot access 'foo.skb': No such file or directory

$ skribilo -t html -o foo.html foo.skb
Backtrace:
In ice-9/boot-9.scm:
1752:10 10 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
In unknown file:
9 (apply-smob/0 #<thunk 7f583ec7d2e0>)
In ice-9/boot-9.scm:
724:2 8 (call-with-prompt _ _ #<procedure default-prompt-handler (k proc)>)
In ice-9/eval.scm:
619:8 7 (_ #(#(#<directory (guile-user) 7f583ec83c80>)))
In ice-9/command-line.scm:
185:19 6 (_ #<input: string 7f583ec7c850>)
In unknown file:
5 (eval (call-with-skribilo-error-catch/exit (lambda () (apply (module-ref (resolve-interface (quote (skribilo))) (quote skribilo)) (cdr (command-line))))) #<directory (guile-user) 7f583ec83c80>)
In ice-9/boot-9.scm:
1752:10 4 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
In skribilo.scm:
429:14 3 (skribilo . _)
In ice-9/ports.scm:
450:11 2 (call-with-input-file "foo.skb" #<procedure 7f583ec69e60 at ice-9/ports.scm:494:3 (p)> #:binary _ #:encoding _ #:guess-encoding _)
In unknown file:
1 (open-file "foo.skb" "r" #:encoding #f #:guess-encoding #f)
In ice-9/boot-9.scm:
1685:16 0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure open-file: No such file or directory: "foo.skb"

$ ls foo.html
foo.html

Among other things, this upsets the use of skribilo in Makefiles. When a
skribilo invocation in a Makefile recipe fails, an output file is still
created, and when make is run again, the skribilo invocation is not
re-run.
L
L
Ludovic Courtès wrote on 10 Apr 2022 22:01
(name . Arun Isaac)(address . arunisaac@systemreboot.net)(address . 54593@debbugs.gnu.org)
87k0bw6741.fsf@gnu.org
Arun Isaac <arunisaac@systemreboot.net> skribis:

Toggle quote (5 lines)
> Among other things, this upsets the use of skribilo in Makefiles. When a
> skribilo invocation in a Makefile recipe fails, an output file is still
> created, and when make is run again, the skribilo invocation is not
> re-run.

Indeed. Furthermore, I think the output file should be created
atomically, with something like Guix’s ‘with-atomic-file-output’.

Ludo’.
A
A
Arun Isaac wrote on 12 Apr 2022 21:45
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 54593@debbugs.gnu.org)
87ilre3x2s.fsf@systemreboot.net
Toggle quote (3 lines)
> Furthermore, I think the output file should be created atomically,
> with something like Guix’s ‘with-atomic-file-output’.

Definitely, agreed!
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 54593@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 54593
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch