Re: Standardize BROWSER and MAILER environment variables.

2023-11-28 Thread Slatian

Hello again,


There's also sensible-browser from the sensible-utils project.

   https://salsa.debian.org/debian/sensible-utils


Thanks for the pointer to the sensible-utils which point to the 
[environ(7) manpage]:


> The user's preferred utility to {do something}. Any string acceptable 
> as a command_string operand to the `sh -c` command shall be valid.


This already describes pretty well the correct way to use EDITOR and 
PAGER variables which seems to be compatible with how sensible-utils 
(and many others) interpret the BROWSER variable.


```
sh -c "$BROWSER \"\$@\"" BROWSER "$@"
```

For trying other openers the sensible-utils solution is to only do that 
on a 127 or 126 exit code meaning that the command was not found or not 
executable.


For more complex use-cases previously covered by %s or `:`-fallback a 
specification should recommend wrapper scripts as naive implementations 
may not even interpret the shell syntax correctly.


---

As for the MAILER … E-Mail is a mess on this level too.

The most though probably went into the [LibreOffice senddoc.sh script].

All of them have in common, that they either directly or some
`--compose` (or similar) option accept a mailto: URI and are probably 
well off by being treated like described for the BROWSER variable.


Which illustrates that most mailers do one of the following:

* Accept an `attach[ment]=` option for the `mailto:` URI
  (Which is a security problem)
* Have an `--attach` option for their cli (kmail,sylpheed,claws)
* Have a `-a` option for their cli (dtmail, mutt)
* Have a proprietary interface for doing attachments (thunderbird)
* Don't have an interface for attachments at all

My favorite here is the `--attach` option as it seems to be one of the 
more common options while not being very ambiguous (opposed to `-a`).

It is also used by the LibreOffice wrapper itself and
xdg-email (though xdg-email isn't very smart about using it).
It is unfortunately not supported by any implementation of
`/usr/bin/mail` I could find.

---

[environ(7) manpage]:
https://manpages.debian.org/bookworm/manpages/environ.7.en.html

[libreoffice senddoc script]:

https://sources.debian.org/src/libreoffice/4:7.6.3-2/shell/source/unix/misc/senddoc.sh

---

To summarize:

Both BROWSER and MAILER should follow the definition from the environ(7) 
manpage:
> The user's preferred utility to {do something}. Any string acceptable 
> as a command_string operand to the `sh -c` command shall be valid.


The MAILER in addition SHOULD support an `--attach` option that is 
followed by one file path or `file:` URI, multiple instances should be 
possible after the `mailto:` URI.


```
$MAILER mailto:… [--attach …]...
```

---

Looking forward to feedback on this take.

Greetings!

- Slatian


Re: Standardize BROWSER and MAILER environment variables. __ FollowUp-2

2023-10-18 Thread Steven Kucharzyk
I would like also to point out that if I try to print an email that is
longer than (1) One Page it "Left Justifies" the remaining pages to the
point of loosing characters. I have adjusted both the browser
magnification and the printer scale to no avail ... first page prints
correct and the rest not. 

I only found this out today, when attempting to make copies for mailing
to the IG over issues I have with the VA facility, so I can show the
correspondence that we have had. Any suggestions would be Appreciated.

Steven Kucharzyk

--

On Tue, 17 Oct 2023 23:41:58 +0200
Guillem Jover  wrote:

> Hi!
> 
> On Mon, 2023-10-16 at 20:14:03 +0200, Slatian wrote:
> > So a specification would have to include:
> > * When are those supposed to be called
> > * What are possible arguments
> > * Fancy %s syntax (or clearly state that it isn't possible)
> > * Quoting and escaping (or clearly state a lack of it)
> > * How fallbacks are supposed to be handled
> > 
> > I'm in favor of having as few features as possible to make it easy
> > to implement correctly without any libraries or helpers.
> > 
> > Before writing a draft, Id like to collect already existing
> > implementations of those variables.
> > 
> > The ones I currently know about are:
> > * xdg-utils (as described above)
> > * newsboat (BROWSER, with %u instead of %s, no fallback)
> 
> There's also sensible-browser from the sensible-utils project.
> 
>   https://salsa.debian.org/debian/sensible-utils
> 
> But doing a couple of quick queries:
> 
>   https://codesearch.debian.net/search?q=%24BROWSER=1=1=1
>   https://codesearch.debian.net/search?q=%22BROWSER%22=1=1
> 
> there seems to be lots of usage for the BROWSER env variable. You
> might want to check there.
> 
> Thanks,
> Guillem



-- 
MAIL DELIVERY CONFIRMATION REQUESTS:
Confirmation Requests, are sent to verify:
* Transmission *
* Verification of delivery by the local mail delivery system *
DOES NOT - Imply:
* The message was actually read or understood by the intended
recipient(s) *
* Indiscriminate confirmations may jeopardize your privacy *

This e-mail message may contain privileged and/or confidential
information, and is intended to be received only by persons entitled to
receive such information. If you have received this e-mail in error,
please notify the sender immediately. Please delete it and all
attachments from any servers, hard drives or any other media. Other use
of this e-mail by you is strictly prohibited.

The information contained in this email may be subject to the export
control laws and regulations of the United States, potentially
including but not limited to the Export Administration Regulations
(EAR) and sanctions regulations issued by the U.S. Department of
Treasury, Office of Foreign Asset Controls (OFAC). As a recipient of
this information you are obligated to comply with all applicable U.S.
export laws and regulations.


Re: Standardize BROWSER and MAILER environment variables.

2023-10-17 Thread Guillem Jover
Hi!

On Mon, 2023-10-16 at 20:14:03 +0200, Slatian wrote:
> So a specification would have to include:
> * When are those supposed to be called
> * What are possible arguments
> * Fancy %s syntax (or clearly state that it isn't possible)
> * Quoting and escaping (or clearly state a lack of it)
> * How fallbacks are supposed to be handled
> 
> I'm in favor of having as few features as possible to make it easy to
> implement correctly without any libraries or helpers.
> 
> Before writing a draft, Id like to collect already existing implementations
> of those variables.
> 
> The ones I currently know about are:
> * xdg-utils (as described above)
> * newsboat (BROWSER, with %u instead of %s, no fallback)

There's also sensible-browser from the sensible-utils project.

  https://salsa.debian.org/debian/sensible-utils

But doing a couple of quick queries:

  https://codesearch.debian.net/search?q=%24BROWSER=1=1=1
  https://codesearch.debian.net/search?q=%22BROWSER%22=1=1

there seems to be lots of usage for the BROWSER env variable. You
might want to check there.

Thanks,
Guillem


Standardize BROWSER and MAILER environment variables.

2023-10-16 Thread Slatian

Hello!

Trying to fix issues with the xdg-utils I've noticed, that neither the 
BROWSER nor the MAILER environment variables are properly standardized 
anywhere. There should be a specification on such variables.


I've already opened an issue over on the freedesktop gitlab,
with a rough description of how both are currently handled in xdg-utils:
https://gitlab.freedesktop.org/xdg/xdg-specs/-/issues/119

What both currently have in common is that:
* They are colon separated lists of commands that may have arguments.
* The URI or file-path argument is passed after the other arguments.
* Bad/broken support for quoting.
* When a command exits with an error exit code, the next one is tried.

In addition to that the BROWSER variable can have a %s somewhere in it 
that will get replaced with the URL instead of the URL being appended.


Example: BROWSER="fancy-browser --open-url=%s --fancy-option"

For both the fallback mechanism is known to cause trouble i.e. when a 
program was closed less gently (oom-killer, manual kill, crash) it 
causes an error code that triggers a second opener, even if if hours or 
days have passed. (Current proposed solution for xdg-utils are timeouts)


So a specification would have to include:
* When are those supposed to be called
* What are possible arguments
* Fancy %s syntax (or clearly state that it isn't possible)
* Quoting and escaping (or clearly state a lack of it)
* How fallbacks are supposed to be handled

I'm in favor of having as few features as possible to make it easy to 
implement correctly without any libraries or helpers.


Before writing a draft, Id like to collect already existing 
implementations of those variables.


The ones I currently know about are:
* xdg-utils (as described above)
* newsboat (BROWSER, with %u instead of %s, no fallback)

Greetings!

- Slatian