#988678 mgetty-fax: @DATE +format@ in fax header not working due to escaped plus sign?

Package:
mgetty-fax
Source:
mgetty
Description:
Faxing tools for mgetty
Submitter:
Björn Wiberg
Date:
2025-06-11 18:51:00 UTC
Severity:
normal
#988678#5
Date:
2021-05-17 19:07:12 UTC
From:
To:
Dear Andreas,

I tried using @DATE +format@ in my fax header (~/.faxheader), but always got the default 'date' output instead.

It appears that the escaping of a plus sign in /usr/bin/faxspool, in conjunction with GNU sed, might be causing this.

My ~/.faxheader looks like this:

  @DATE +%m/%d %Y %R@ @ID@  @N@ (@U@) -> @D@ (@T@)  PAGE @P@/@M@

Expected FDATE variable contents (see below) would be something like:

05/17 2021 20:54

Instead I got an empty FDATE variable, and hence, the default output of the 'date' command instead; something like:

mån 17 maj 2021 20:57:40 CEST

Suggested change (unified diff):
--- /usr/bin/faxspool   2018-10-06 22:17:07.000000000 +0200
+++ ./faxspool.NEW      2021-05-17 20:48:40.110235800 +0200
@@ -938,7 +938,7 @@
     if [ -n "$FAX_HEADER" ]
     then
        # flexible DATE format
-       FDATE=`sed -n -e '\!@DATE \+[0-9a-zA-Z: \./%\-]*@!s!.*@DATE \(\+[0-9a-zA-Z: \./%\-]*\)@.*!\1!p' $FAX_HEADER`
+       FDATE=`sed -n -e '\!@DATE +[0-9a-zA-Z: \./%\-]*@!s!.*@DATE \(\+[0-9a-zA-Z: \./%\-]*\)@.*!\1!p' $FAX_HEADER`
        if [ -n "$FDATE" ] ; then
            DATE_OUT=`date "$FDATE"`
        else

Some searching yielded this:
https://stackoverflow.com/a/63940155

Might this be the explanation?
And, would the removal of the escaping cause problems for those not using GNU sed?

Many thanks in advance!

Best regards
Björn

#988678#10
Date:
2025-06-11 18:48:59 UTC
From:
To:
Hello again,

This also appears to work (having sed:amd64/bookworm 4.9-1):

DATE=`sed -E -n -e '\!@DATE \+[0-9a-zA-Z: \./%\-]*@!s!.*@DATE \+([0-9a-zA-Z: \./%\-]*)@.*!\1!p' $FAX_HEADER`

Best regards
Björn