Re: branch master updated: remote-server: Fix fetch worker crash.

2021-12-06 Thread Mathieu Othacehe


Hey Ludo,

> I think it’s be safer (less prone to TOCTTOU races) to write it as:
>
>   (catch 'system-error
> (lambda ()
>   (register-gc-roots drv))
> (lambda args
>   (unless (= ENOENT (system-error-errno args)) ;collected in the meantime
> (apply throw args

Oh, indeed! Fixed with 6dcf2f65cea920b9b1c265de3e2b0abe0048a08e.

Thanks,

Mathieu



Re: branch master updated: remote-server: Fix fetch worker crash.

2021-12-05 Thread Ludovic Courtès
Hi,

m.othac...@gmail.com (Mathieu Othacehe) skribis:

> --- a/src/cuirass/scripts/remote-server.scm
> +++ b/src/cuirass/scripts/remote-server.scm
> @@ -376,7 +376,10 @@ directory."
>  (when (> duration 60)
>(log-message "fetching '~a' took ~a seconds."
> drv duration)
> -   (register-gc-roots drv)
> +   ;; The derivation may have been GC'ed by that time. Do not try to
> +   ;; register its outputs in that case.
> +   (when (file-exists? drv)
> + (register-gc-roots drv))

I think it’s be safer (less prone to TOCTTOU races) to write it as:

  (catch 'system-error
(lambda ()
  (register-gc-roots drv))
(lambda args
  (unless (= ENOENT (system-error-errno args)) ;collected in the meantime
(apply throw args

Ludo’.