Hello,

It seems that using a non-absolute MH variable doesn't work when an MH
program chdir's and exec's a child that needs to read the
profile. (Example below involving show and mhshow.)

By inspection, setting MH to the resolved, absolute pathname inside
context_read suffices to solve the problem I've encountered, but I don't
know the overall codebase well enough to understand if it goofs up
something elsewhere.

Thank you,
Richard

$ pwd
/home/me/test
$ cat mh-profile
Path: test/Mail
Unseen-Sequence: unseen
$ export PATH=/usr/local/nmh/bin:$PATH MH=mh-profile; scan cur > /dev/null
$ echo $?
0
$ export PATH=/usr/local/nmh/bin:$PATH MH=mh-profile; show cur > /dev/null
mhshow: unable to read the `/home/me/test/Mail/inbox/mh-profile' profile 
specified by your MH environment variable
$ echo $?
1

diff --git a/sbr/context_read.c b/sbr/context_read.c
index 8f63fed..b0ec313 100644
--- a/sbr/context_read.c
+++ b/sbr/context_read.c
@@ -65,6 +65,7 @@ context_read (void)
     if ((cp = getenv("MH")) && *cp != '\0') {
 	defpath = path(cp, TFILE);
 
+	setenv("MH", defpath, 1);
 	if (stat(defpath, &st) != -1 && (st.st_mode & S_IFREG) == 0)
 		adios((char *)0, "`%s' specified by your MH environment variable is not a normal file", cp);
 
_______________________________________________
Nmh-workers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/nmh-workers

Reply via email to