9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] [Bug] Mail fails to send attachments
@ 2021-02-19 19:56 theinicke
  2021-02-19 20:13 ` sirjofri
  0 siblings, 1 reply; 15+ messages in thread
From: theinicke @ 2021-02-19 19:56 UTC (permalink / raw)
  To: 9front

Today I have noticed that since the rewrite Mail fails to send attachments.
That is if one includes an "Attach: /some/file" line and posts it,
(if file exists) marshal suicides like so: 66286: marshal 66286: sys: write on closed pipe pc=0x25e04
leaving us with a sent mail without the attachments.

I have not been able to track down the cause yet.
Have reproduced it on a clean install updated to latest HEAD
to make sure it is not caused by any of my modifications.
Here are the symptoms:

If in /sys/src/cmd/upas/marshal/marshal.c:421 attachment function is called, then
in /sys/src/cmd/upas/marshal/marshal.c:430 the error occurs.

--
Tobias Heinicke


^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: [9front] [Patch] Mail fails to send attachments
@ 2021-02-20 14:35 sirjofri
  2021-02-20 21:02 ` ori
  0 siblings, 1 reply; 15+ messages in thread
From: sirjofri @ 2021-02-20 14:35 UTC (permalink / raw)
  To: 9front

Somehow this mail wasn't sent. Here it is:

20.02.2021 14:29:59 joel@sirjofri.de:

Quoth sirjofri <sirjofri+ml-9front@sirjofri.de>:

> We should still check the returned file descriptor, just in case the
> user has no mailbox directory.

This patch includes that check.

I adjusted the tee function so that the second destination is ignored
if it's invalid.

sirjofri

.
diff -r 297026d9dc30 sys/src/cmd/upas/marshal/marshal.c
--- a/sys/src/cmd/upas/marshal/marshal.c  Thu Feb 18 21:40:30 2021 +0100
+++ b/sys/src/cmd/upas/marshal/marshal.c  Sat Feb 20 14:27:35 2021 +0100
@@ -985,10 +985,12 @@
  int n;
  char buf[8*1024];

- while ((n = read(in, buf, sizeof buf)) > 0)
-   if (write(out1, buf, n) != n ||
-       write(out2, buf, n) != n)
+ while ((n = read(in, buf, sizeof buf)) > 0){
+   if (write(out1, buf, n) != n)
      break;
+   if (out2 >= 0 && write(out2, buf, n) != n)
+     break;
+ }
}

/* print the unix from line */
@@ -1086,11 +1088,14 @@
      case 0:
        close(pfd[0]);
        /* BOTCH; "From " time gets changed */
-       b = openfolder(foldername(nil, user, rcvr), time(0));
-       fd = b? Bfildes(b): -1;
-       printunixfrom(fd);
-       tee(0, pfd[1], fd);
-       write(fd, "\n", 1);
+       b = openfolder(foldername(nil, login, rcvr), time(0));
+       if (b){
+         fd = Bfildes(b);
+         printunixfrom(fd);
+         tee(0, pfd[1], fd);
+         write(fd, "\n", 1);
+       } else
+         tee(0, pfd[1], -1);
        closefolder(b);
        exits(0);
      default:

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-02-20 21:07 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-19 19:56 [9front] [Bug] Mail fails to send attachments theinicke
2021-02-19 20:13 ` sirjofri
2021-02-19 20:54   ` Romano
2021-02-19 21:13   ` ori
2021-02-19 23:47     ` sirjofri
2021-02-20  0:28       ` sirjofri
2021-02-20  0:49         ` ori
2021-02-20 13:02           ` sirjofri
2021-02-19 23:27   ` ori
2021-02-20 13:16     ` [9front] [Patch] " sirjofri
2021-02-20 13:37       ` hiro
2021-02-20 14:03         ` [9front] bad headers in mail (was: Mail attachment bug) sirjofri
2021-02-20 14:10           ` hiro
2021-02-20 14:35 [9front] [Patch] Mail fails to send attachments sirjofri
2021-02-20 21:02 ` ori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).