Github messages for mblaze
 help / color / mirror / Atom feed
* [PR PATCH] mrep: fix subject not populating when pager stdout is not tty
@ 2023-07-17  4:41 Parasrah
  2023-07-17 13:33 ` leahneukirchen
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Parasrah @ 2023-07-17  4:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 784 bytes --]

There is a new pull request by Parasrah against master on the mblaze repository

https://github.com/Parasrah/mblaze master
https://github.com/leahneukirchen/mblaze/pull/243

mrep: fix subject not populating when pager stdout is not tty
If the pager is set to something where stdout is not a TTY, such as a text editor, it causes non-interactive calls to `mscan` to fail with the error: `Fatal error: stdout is not a tty`. When building the subject, `mrep` fetches the subject from the email being replied to using `mscan`, causing this error to manifest and the subject line to end up as: "Re: ". Explicitly setting the pager to `cat` when fetching the email subject in `mrep` prevents this error.

A patch file from https://github.com/leahneukirchen/mblaze/pull/243.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-243.patch --]
[-- Type: text/x-diff, Size: 1256 bytes --]

From 0279b94f0e13ff40a633559e39c1ba5355abe812 Mon Sep 17 00:00:00 2001
From: parasrah <dev@parasrah.com>
Date: Sun, 16 Jul 2023 22:35:05 -0600
Subject: [PATCH] mrep: fix subject not populating when pager stdout is not tty

If the pager is set to something where stdout is not a TTY, such as a
text editor, it causes non-interactive calls to mscan to fail with the
error: `Fatal error: stdout is not a tty`. When building the subject,
`mrep` fetches the subject from the email being replied to using
`mscan`, causing this error to manifest and the subject line to end up
as: "Re: ". Explicitly setting the pager to `cat` when fetching the
email subject in `mrep` prevents this error.
---
 mcom | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mcom b/mcom
index 4e834c6..90c7a56 100755
--- a/mcom
+++ b/mcom
@@ -373,7 +373,7 @@ fi
 			printf '%s\n' "$hdrs" | awk '{ print }' |
 				msed "/body/d" -
 		fi | sed '/^$/d'
-		printf 'Subject: Re: %s\n' "$(COLUMNS=10000 mscan -f '%S' "$1")"
+		printf 'Subject: Re: %s\n' "$(MBLAZE_PAGER=cat COLUMNS=10000 mscan -f '%S' "$1")"
 		if ! printf '%s\n' "$hdrs" | awk '{ print }' |
 		     mhdr -h from: - >/dev/null; then
 			addr=$(maddr -a -h delivered-to:to:cc:bcc: "$1" | replyfrom | head -n1)

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

* Re: mrep: fix subject not populating when pager stdout is not tty
  2023-07-17  4:41 [PR PATCH] mrep: fix subject not populating when pager stdout is not tty Parasrah
@ 2023-07-17 13:33 ` leahneukirchen
  2023-07-18  4:11 ` Parasrah
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: leahneukirchen @ 2023-07-17 13:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 175 bytes --]

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/243#issuecomment-1638155446

Comment:
Does adding `< /dev/null` also fix it?

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

* Re: mrep: fix subject not populating when pager stdout is not tty
  2023-07-17  4:41 [PR PATCH] mrep: fix subject not populating when pager stdout is not tty Parasrah
  2023-07-17 13:33 ` leahneukirchen
@ 2023-07-18  4:11 ` Parasrah
  2023-07-18 12:05 ` [PR PATCH] [Closed]: " leahneukirchen
  2023-07-18 12:05 ` leahneukirchen
  3 siblings, 0 replies; 5+ messages in thread
From: Parasrah @ 2023-07-18  4:11 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 366 bytes --]

New comment by Parasrah on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/243#issuecomment-1639364275

Comment:
It does not seem to:

```sh
$ export MBLAZE_PAGER=kak
$ echo "$(COLUMNS=10000 mscan -f '%S' "$file" </dev/null)"
Fatal error: stdout is not a tty
$ echo "$(MBLAZE_PAGER=cat COLUMNS=10000 mscan -f '%S' "$file")"
Test Subject
```

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

* Re: [PR PATCH] [Closed]: mrep: fix subject not populating when pager stdout is not tty
  2023-07-17  4:41 [PR PATCH] mrep: fix subject not populating when pager stdout is not tty Parasrah
  2023-07-17 13:33 ` leahneukirchen
  2023-07-18  4:11 ` Parasrah
@ 2023-07-18 12:05 ` leahneukirchen
  2023-07-18 12:05 ` leahneukirchen
  3 siblings, 0 replies; 5+ messages in thread
From: leahneukirchen @ 2023-07-18 12:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 644 bytes --]

There's a closed pull request on the mblaze repository

mrep: fix subject not populating when pager stdout is not tty
https://github.com/leahneukirchen/mblaze/pull/243

Description:
If the pager is set to something where stdout is not a TTY, such as a text editor, it causes non-interactive calls to `mscan` to fail with the error: `Fatal error: stdout is not a tty`. When building the subject, `mrep` fetches the subject from the email being replied to using `mscan`, causing this error to manifest and the subject line to end up as: "Re: ". Explicitly setting the pager to `cat` when fetching the email subject in `mrep` prevents this error.

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

* Re: mrep: fix subject not populating when pager stdout is not tty
  2023-07-17  4:41 [PR PATCH] mrep: fix subject not populating when pager stdout is not tty Parasrah
                   ` (2 preceding siblings ...)
  2023-07-18 12:05 ` [PR PATCH] [Closed]: " leahneukirchen
@ 2023-07-18 12:05 ` leahneukirchen
  3 siblings, 0 replies; 5+ messages in thread
From: leahneukirchen @ 2023-07-18 12:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 195 bytes --]

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/243#issuecomment-1640088061

Comment:
I fixed it in mscan directly, no need for workarounds now.

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

end of thread, other threads:[~2023-07-18 12:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-17  4:41 [PR PATCH] mrep: fix subject not populating when pager stdout is not tty Parasrah
2023-07-17 13:33 ` leahneukirchen
2023-07-18  4:11 ` Parasrah
2023-07-18 12:05 ` [PR PATCH] [Closed]: " leahneukirchen
2023-07-18 12:05 ` leahneukirchen

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).