Re: search: exit code 1 when running as www-data user

Subject: Re: search: exit code 1 when running as www-data user

Date: Sat, 24 Oct 2026 15:19:31 +0200

To: notmuch@notmuchmail.org

Cc:

From: Christian Weiske


Hello David,


>> I setup notmuch in my user account "cweiske" and now want to use the
>> browser-based "notmore" UI for it.
>> I setup notmore on Apache + PHP, and it runs as www-data user.
>>
>> The directory permissions should be fine; I changed via "su -s
>> /bin/bash
>> - www-data" to the user and executed "notmuch --config
>> /home/cweiske/... search test" and it returned results.
>>
>> When "notmuch search" is run via apache's mod_php, it exits with
>> status code 1, and no output in stdout nor stderr.
>>
>> What could the reason be for that?
>>
>> ----
>>
>> Running "notmuch config list" via apache works.
>> There are no selinux/apparmor errors in jourctl or dmesg.
>>
>> "strace -f" output it not really helpful, but is attached.  
>
>One thing you can try is setting NOTMUCH_DEBUG_QUERY to some nonempty
>value. That should generate some output if it gets as far as parsing
>the query.


I finally had time to debug this and compared "strace" output when
running it locally vs. inside Apache as www-data.

The difference began when notmuch tried to access the following folders:
- /home/cweiske/.config/notmuch/default/hooks
- /home/cweiske/.local/share/notmuch/default/backups
It did not try that under Apache.

Then I set the two XDG environment variables and it started to work:
XDG_CONFIG_HOME=/home/cweiske/.config XDG_DATA_HOME=/home/cweiske/tmp

Should notmuch require them?

-- 
Regards/Mit freundlichen Grüßen
Christian Weiske

-=≡ Geeking around in the name of science since 1982 ≡=-
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: