djcb / mu

maildir indexer/searcher + emacs mail client + guile bindings
http://www.djcbsoftware.nl/code/mu
GNU General Public License v3.0
1.62k stars 391 forks source link

[rfe] mu4e-icalendar.elc sometimes varies across builds #2570

Closed bmwiedemann closed 1 year ago

bmwiedemann commented 1 year ago

Describe the bug While working on reproducible builds for openSUSE, I found that our maildir-utils (mu-1.10.7) package sometimes varied in its mu4e/mu4e-icalendar.elc file.

How to Reproduce I run my test script to do two fresh builds with meson in a 1-core and 4-core VM with clocks set to different date+time. For some reason it produced identical results in 6 tries and then produced variations twice. It may be a low-entropy or rare race that might be hard to reproduce. Maybe the diff below can give a hint to the source.

Environment openSUSE Tumbleweed with emacs-29.1

Checklist

You can find the differing files in https://rb.zq1.de/temp/maildir-utils-elc.tar.gz

Here is the output of filterdiff strings $FILES

--- strings RPMS.2017/usr/share/emacs/site-lisp/mu4e/mu4e-icalendar.elc
+++ strings RPMS/usr/share/emacs/site-lisp/mu4e/mu4e-icalendar.elc
@@ -95,10 +95,10 @@
        \202
 \305\206
 \211?\205
-\306\307!\207" [major-mode mu4e--view-message #s(hash-table size 2 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (mu4e-headers-mode 6 mu4e-view-mode 13)) get-text-property msg nil mu4e-warn "No message at point"] 4 ("/home/abuild/rpmbuild/BUILD/mu-1.10.7/x86_64-suse-linux/mu4e/mu4e-message.elc" . 3107)] noerror #[0 "eb\210\300\301\302\303#\205
+\306\307!\207" [major-mode mu4e--view-message #s(hash-table size 2 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (mu4e-headers-mode 6 mu4e-view-mode 13)) get-text-property msg nil mu4e-warn "No message at point"] 4 "Get the message s-expression for the message at point.\nEither the headers buffer or the view buffer, or nil if there is\nno such message. If optional NOERROR is non-nil, do not raise an\nerror when there is no message at point.\n\n(fn &optional NOERROR)"] noerror #[0 "eb\210\300\301\302\303#\205
 \304\305!\210\306 b\210\202
 \207" [re-search-forward "^\\(.\\{72\\}\\)\\(.+\\)$" nil t replace-match "\\1\n \\2" line-beginning-position] 4] get-buffer-create utf-8 nil mu4e--icalendar-delete-citation delete sender cl-copy-list gnus-icalendar-event:organizer plist-get :reply-to :from :name "" mu4e--icalendar-has-email plist-put :email :subject capitalize symbol-name ": " gnus-icalendar-event:summary mu4e~compose-handler reply :buffer-name (:mime-type "text/calendar; method=REPLY; charset=utf-8") message-goto-body set-buffer-modified-p add-hook message-sent-hook mu4e--icalendar-trash-message-hook 90 make-local-variable gnus-icalendar-reply-status gnus-icalendar-find-org-event-file gnus-icalendar--update-org-event gnus-icalendar:org-event-save mu4e--icalendar-insert-diary mu4e-icalendar-trash-after-reply gnus-icalendar-org-enabled-p mu4e-icalendar-diary-file] 25 (#$ . 2078)])#@73 Function passed to `mu4e-compose-cite-function' to remove the citation.
-(defalias 'mu4e--icalendar-delete-citation #[0 "\300 \210\301ed\"\207" [message-cite-original-without-signature kill-region] 3 (#$ . 4581)])#@77 Trash the message ORIGINAL-MSG and move to the next one.
+(defalias 'mu4e--icalendar-delete-citation #[0 "\300 \210\301ed\"\207" [message-cite-original-without-signature kill-region] 3 (#$ . 4749)])#@77 Trash the message ORIGINAL-MSG and move to the next one.
 (fn ORIGINAL-MSG)
 (defalias 'mu4e--icalendar-trash-message #[257 "\300\301
 \"\207" [make-closure #[514 "\302
@@ -115,11 +115,11 @@
 \"\266\202\202
 \301\302!\266\202\211\203
 \207
-\303\267\207\304\207\207\305\207\207" [plist-get mu4e-error "Message must be non-nil" #s(hash-table size 9 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (:subject 29 :message-id 29 :path 29 :maildir 29 :in-reply-to 29 :body-html 31 :body-txt 31 :docid 32 :size 32)) "" 0] 7 ("/home/abuild/rpmbuild/BUILD/mu-1.10.7/x86_64-suse-linux/mu4e/mu4e-message.elc" . 1878)] :docid trash plist-get :action mu4e-get-trash-folder mu4e-get-headers-buffer run-hook-with-args mu4e-mark-execute-pre-hook mu4e~headers-view-this-message-p buffer-live-p mu4e-get-view-buffer mu4e-display-buffer mu4e-view-headers-next kill-buffer-and-window] 10 "See `mu4e-sent-handler' for DOCID and PATH.\n\n(fn DOCID PATH)"]] 4 (#$ . 4799)])#@62 Trash the icalender message ORIGINAL-MSG.
+\303\267\207\304\207\207\305\207\207" [plist-get mu4e-error "Message must be non-nil" #s(hash-table size 9 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (:subject 29 :message-id 29 :path 29 :maildir 29 :in-reply-to 29 :body-html 31 :body-txt 31 :docid 32 :size 32)) "" 0] 7 "Retrieve FIELD from message plist MSG.\nLike `mu4e-message-field-nil', but will sanitize nil values:\n- all string field except body-txt/body-html: nil -> \"\"\n- numeric fields + dates                    : nil -> 0\n- all others                                : return the value\nThus, function will return nil for empty lists, non-existing body-txt\nor body-html.\n\n(fn MSG FIELD)"] :docid trash plist-get :action mu4e-get-trash-folder mu4e-get-headers-buffer run-hook-with-args mu4e-mark-execute-pre-hook mu4e~headers-view-this-message-p buffer-live-p mu4e-get-view-buffer mu4e-display-buffer mu4e-view-headers-next kill-buffer-and-window] 10 "See `mu4e-sent-handler' for DOCID and PATH.\n\n(fn DOCID PATH)"]] 4 (#$ . 4967)])#@62 Trash the icalender message ORIGINAL-MSG.
 (fn ORIGINAL-MSG)
 (defalias 'mu4e--icalendar-trash-message-hook #[257 "\300\301
 \"\207" [make-closure #[0 "\302\300!\211
-\207" [V0 mu4e-sent-func mu4e--icalendar-trash-message] 2]] 4 (#$ . 5960)])#@222 Insert a diary entry for the EVENT in file named FILENAME.
+\207" [V0 mu4e-sent-func mu4e--icalendar-trash-message] 2]] 4 (#$ . 6425)])#@222 Insert a diary entry for the EVENT in file named FILENAME.
 REPLY-STATUS is the status of the reply.  The possible values are
 given in the doc of `gnus-icalendar-event-reply-from-buffer'.
 (fn EVENT REPLY-STATUS FILENAME)
@@ -153,5 +153,5 @@
 \323\261
 \210\326ed
 \316$*\207" [gnus-icalendar-event:start-time format-time-string "%d/%m/%Y" "%H:%M" gnus-icalendar-event:end-time gnus-icalendar-event:summary gnus-icalendar-event:location capitalize symbol-name format "%s (%s)\n %s " "%s (%s)" generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205
-\302\300!\207" [V0 buffer-name kill-buffer] 2] " " "-" "\n" " Start of: " " End of: " write-region] 22 (#$ . 6206)])
+\302\300!\207" [V0 buffer-name kill-buffer] 2] " " "-" "\n" " Start of: " " End of: " write-region] 22 (#$ . 6671)])
 (provide 'mu4e-icalendar)
bmwiedemann commented 1 year ago

Since mu4e-message.elc is mentioned in the diff, I checked the build-log diff and saw that the relative position varied:

- [137/154] /usr/bin/emacs --no-init-file --batch --directory /home/abuild/rpmbuild/BUILD/mu-1.10.7/x86_64-suse-linux/mu4e --directory /home/abuild/rpmbuild/BUILD/mu-1.10.7/mu4e --eval '(setq load-prefer-newer t)' --eval '(setq byte-compile-warnings '"'"'(not obsolete))' --eval '(setq byte-compile-dest-file-function(lambda(_) "/home/abuild/rpmbuild/BUILD/mu-1.10.7/x86_64-suse-linux/mu4e/mu4e-icalendar.elc"))' --funcall batch-byte-compile ../mu4e/mu4e-icalendar.el
  [141/154] /usr/bin/emacs --no-init-file --batch --directory /home/abuild/rpmbuild/BUILD/mu-1.10.7/x86_64-suse-linux/mu4e --directory /home/abuild/rpmbuild/BUILD/mu-1.10.7/mu4e --eval '(setq load-prefer-newer t)' --eval '(setq byte-compile-warnings '"'"'(not obsolete))' --eval '(setq byte-compile-dest-file-function(lambda(_) "/home/abuild/rpmbuild/BUILD/mu-1.10.7/x86_64-suse-linux/mu4e/mu4e-message.elc"))' --funcall batch-byte-compile ../mu4e/mu4e-message.el
+ [142/154] /usr/bin/emacs --no-init-file --batch --directory /home/abuild/rpmbuild/BUILD/mu-1.10.7/x86_64-suse-linux/mu4e --directory /home/abuild/rpmbuild/BUILD/mu-1.10.7/mu4e --eval '(setq load-prefer-newer t)' --eval '(setq byte-compile-warnings '"'"'(not obsolete))' --eval '(setq byte-compile-dest-file-function(lambda(_) "/home/abuild/rpmbuild/BUILD/mu-1.10.7/x86_64-suse-linux/mu4e/mu4e-icalendar.elc"))' --funcall batch-byte-compile ../mu4e/mu4e-icalendar.el

So it could be a race in the parallel compilation, because some dependency is not specified.

bmwiedemann commented 1 year ago

Now I saw that there is a todo in the meson.build that says, it should use depfile there - that is a file listing output: dep1 dep2 . It can be autocreated as in https://github.com/mesonbuild/meson/tree/master/test%20cases/common/49%20custom%20target/depfile

I guess, that can help to always have the mu4e-icalendar.elc created after mu4e-message.elc

djcb commented 1 year ago

Can you reproduce with the master branch? A non-intrusive PR would be welcome.

bmwiedemann commented 1 year ago

I could not reproduce it with master in 20 tries (it produced 2 identical results each time). So maybe some change between 1.10.7 and master fixed it?

djcb commented 1 year ago

Yeah, the build setup changed a bit in master. Thanks, closing this.