[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add 'guix hash'.
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH] Add 'guix hash'. |
Date: |
Fri, 05 Apr 2013 18:15:42 +0200 |
User-agent: |
Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.3 (gnu/linux) |
Nikita Karetnikov <address@hidden> skribis:
>> + (if (file-exists? file)
>> + (format #t "~a~%"
>> + (call-with-input-file file
>> + (compose fmt sha256 get-bytevector-all)))
>
> Oh, Mark warned me about 'file-exists?' some time ago.
>
> How can I do the same but avoid a race condition?
Ah, TOCTTOU, right.
You could do:
(let ((hash (catch 'system-error
(lambda ()
(call-with-input-file ...))
(lambda args
(leave (_ "error ..." (strerror (system-error-errno
args))))))))
...)
Ludo’.
- [PATCH] Add 'guix hash'., Nikita Karetnikov, 2013/04/01
- Re: [PATCH] Add 'guix hash'., Ludovic Courtès, 2013/04/03
- Re: [PATCH] Add 'guix hash'., Nikita Karetnikov, 2013/04/05
- Re: [PATCH] Add 'guix hash'., Nikita Karetnikov, 2013/04/05
- Re: [PATCH] Add 'guix hash'.,
Ludovic Courtès <=
- Re: [PATCH] Add 'guix hash'., Nikita Karetnikov, 2013/04/10
- Re: [PATCH] Add 'guix hash'., Ludovic Courtès, 2013/04/10
- Re: [PATCH] Add 'guix hash'., Nikita Karetnikov, 2013/04/10
- Re: [PATCH] Add 'guix hash'., Ludovic Courtès, 2013/04/10
- Re: [PATCH] Add 'guix hash'., Ludovic Courtès, 2013/04/05
- Re: [PATCH] Add 'guix hash'., Nikita Karetnikov, 2013/04/09
- Re: [PATCH] Add 'guix hash'., Ludovic Courtès, 2013/04/11
- master: FAIL: tests/guix-package.sh (was: [PATCH] Add 'guix hash'.), Nikita Karetnikov, 2013/04/12
- Re: master: FAIL: tests/guix-package.sh, Nikita Karetnikov, 2013/04/12
- Re: master: FAIL: tests/guix-package.sh, Ludovic Courtès, 2013/04/12