Skip to content

Commit

Permalink
challenge: Really exit with non-zero upon hash mismatch.
Browse files Browse the repository at this point in the history
Reported by John Darrington.

* guix/scripts/challenge.scm (guix-challenge): Add an explicit 'exit'
call when ISSUES is empty.
* scripts/guix.in: Add comment about 'exit'.
* doc/guix.texi (Invoking guix challenge): Mention the behavior and exit
code.
  • Loading branch information
civodul committed Apr 6, 2016
1 parent 7b9a66e commit 7cffaeb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
7 changes: 6 additions & 1 deletion doc/guix.texi
Expand Up @@ -5582,14 +5582,19 @@ $ guix challenge @var{package}

@noindent
where @var{package} is a package specification such as
@code{guile-2.0} or @code{glibc:debug}.
@code{guile@@2.0} or @code{glibc:debug}.

The general syntax is:

@example
guix challenge @var{options} [@var{packages}@dots{}]
@end example

When a difference is found between the hash of a locally-built item and
that of a server-provided substitute, or among substitutes provided by
different servers, the command displays it as in the example above and
exits with a non-zero return code.

The one option that matters is:

@table @code
Expand Down
4 changes: 3 additions & 1 deletion guix/scripts/challenge.scm
Expand Up @@ -233,9 +233,11 @@ Challenge the substitutes for PACKAGE... provided by one or more servers.\n"))

(run-with-store store
(mlet* %store-monad ((items (mapm %store-monad
ensure-store-item files))
ensure-store-item files))
(issues (discrepancies items urls)))
(for-each summarize-discrepancy issues)
(unless (null? issues)
(exit 1))
(return (null? issues)))
#:system system)))))))

Expand Down
5 changes: 5 additions & 0 deletions scripts/guix.in
Expand Up @@ -64,4 +64,9 @@
(apply guix-main (command-line))))

(maybe-augment-load-paths!)

;; XXX: It would be more convenient to change it to:
;; (exit (run-guix-main))
;; but since the 'guix' command is not updated by 'guix pull', we cannot
;; really do it now.
(run-guix-main))

0 comments on commit 7cffaeb

Please sign in to comment.