9front - general discussion about 9front
 help / color / mirror / Atom feed
* Re: [9front] [Patch] Mail fails to send attachments
@ 2021-02-20 14:35 sirjofri
  2021-02-20 21:02 ` ori
  0 siblings, 1 reply; 4+ 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] 4+ messages in thread

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

Quoth sirjofri <sirjofri+ml-9front@sirjofri.de>:
> 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.
>

Committed with some nitpicky style tweaks. Thanks. 


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

* Re: [9front] [Patch] Mail fails to send attachments
  2021-02-20 13:16 ` [9front] [Patch] " sirjofri
@ 2021-02-20 13:37   ` hiro
  0 siblings, 0 replies; 4+ messages in thread
From: hiro @ 2021-02-20 13:37 UTC (permalink / raw)
  To: 9front

gmail still displays your mails weirdly, might be unrelated but not sure:

In-Reply-To: <E07C376E4275255C9E2473CC13E5C94B@eigenstate.org>
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="upas-kbnxydoadswlscajpsgakobprj" <<< this seems to be
ignored by my gmail that displays the message. is it too early?
shouldn't it be the last line in the headers?
List-ID: <9front.9front.org> <<< obviously this got added by 9front
mailing list... might be a harmful interaction with your header... ?
List-Help: <http://lists.9front.org>
X-Glyph: ➈
X-Bullshit: encrypted interface-aware base high-performance frontend
Subject: Re: [9front] [Patch] Mail fails to send attachments
Reply-To: 9front@9front.org
Precedence: bulk
<< this empty line marks the beginning of the message...
This is a multi-part message in MIME format. << ...which is why gmail
displays this
--upas-kbnxydoadswlscajpsgakobprj <<<and ignores this, displaying this
and the rest of the body as plain text including those headers.
Content-Disposition: inline
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit


On 2/20/21, sirjofri <sirjofri+ml-9front@sirjofri.de> wrote:
> This is a multi-part message in MIME format.
> --upas-kbnxydoadswlscajpsgakobprj
> Content-Disposition: inline
> Content-Type: text/plain; charset="US-ASCII"
> Content-Transfer-Encoding: 7bit
>
> Save outgoing files in user mailbox, fixes closed pipe bug
>
> I noticed it is no closed pipe, but the constructed foldername for the
> save location was built using the upasname variable, which can be set
> to an alias.
>
> This patch fixes that and uses the logged in username instead.
> Therefore it opens the file correctly and the write works.
>
> For example, before:
>
> 	upasname: joel@sirjofri.de
> 	foldername: /mail/box/joel@sirjofri.de/outgoing
>
> after:
>
> 	upasname: joel@sirjofri.de
> 	foldername: /mail/box/sirjofri/outgoing
>
> If an attachment is here, then the patch works (on my machine, at
> least).
>
> We should still check the returned file descriptor, just in case the
> user has no mailbox directory.
>
> sirjofri
>
> .
> --upas-kbnxydoadswlscajpsgakobprj
> Content-Disposition: inline
> Content-Type: text/plain; charset="US-ASCII"
> Content-Transfer-Encoding: 7bit
>
> 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:09:26 2021 +0100
> @@ -1086,7 +1086,7 @@
>  			case 0:
>  				close(pfd[0]);
>  				/* BOTCH; "From " time gets changed */
> -				b = openfolder(foldername(nil, user, rcvr), time(0));
> +				b = openfolder(foldername(nil, login, rcvr), time(0));
>  				fd = b? Bfildes(b): -1;
>  				printunixfrom(fd);
>  				tee(0, pfd[1], fd);
> --upas-kbnxydoadswlscajpsgakobprj--
>

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

* Re: [9front] [Patch] Mail fails to send attachments
  2021-02-19 23:27 [9front] [Bug] " ori
@ 2021-02-20 13:16 ` sirjofri
  2021-02-20 13:37   ` hiro
  0 siblings, 1 reply; 4+ messages in thread
From: sirjofri @ 2021-02-20 13:16 UTC (permalink / raw)
  To: 9front

This is a multi-part message in MIME format.
--upas-kbnxydoadswlscajpsgakobprj
Content-Disposition: inline
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

Save outgoing files in user mailbox, fixes closed pipe bug

I noticed it is no closed pipe, but the constructed foldername for the
save location was built using the upasname variable, which can be set
to an alias.

This patch fixes that and uses the logged in username instead.
Therefore it opens the file correctly and the write works.

For example, before:

	upasname: joel@sirjofri.de
	foldername: /mail/box/joel@sirjofri.de/outgoing

after:

	upasname: joel@sirjofri.de
	foldername: /mail/box/sirjofri/outgoing

If an attachment is here, then the patch works (on my machine, at
least).

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

sirjofri

.
--upas-kbnxydoadswlscajpsgakobprj
Content-Disposition: inline
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

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:09:26 2021 +0100
@@ -1086,7 +1086,7 @@
 			case 0:
 				close(pfd[0]);
 				/* BOTCH; "From " time gets changed */
-				b = openfolder(foldername(nil, user, rcvr), time(0));
+				b = openfolder(foldername(nil, login, rcvr), time(0));
 				fd = b? Bfildes(b): -1;
 				printunixfrom(fd);
 				tee(0, pfd[1], fd);
--upas-kbnxydoadswlscajpsgakobprj--

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-20 14:35 [9front] [Patch] Mail fails to send attachments sirjofri
2021-02-20 21:02 ` ori
  -- strict thread matches above, loose matches on Subject: below --
2021-02-19 23:27 [9front] [Bug] " ori
2021-02-20 13:16 ` [9front] [Patch] " sirjofri
2021-02-20 13:37   ` hiro

9front - general discussion about 9front

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/9front

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 9front 9front/ http://inbox.vuxu.org/9front \
		9front@9front.org
	public-inbox-index 9front

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.9front


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git