bsmtp strips first newline?

10 views
Skip to first unread message

wizh...@gmail.com

unread,
Mar 11, 2025, 12:14:56 PM3/11/25
to bareos-users
Given the following file

# 10-Mar-2025 22:44:02 - BackupCatalog.2025-03-10_21.10.00_20 - Full
Volume="Full-0387"
MediaType="File"
VolSessionId=196
VolSessionTime=1740423781
VolAddr=211-615837750
FileIndex=1-124

If you pipe it to bsmtp the first newline is strip in the email body resulting in

# 10-Mar-2025 22:44:02 - BackupCatalog.2025-03-10_21.10.00_20 - Full Volume="Full-0387"
MediaType="File"
VolSessionId=196
VolSessionTime=1740423781
VolAddr=211-615837750
FileIndex=1-124

Is this expected? Seams odd to modify the input at all.

I have a script that uses tee to send the bootstrap to both a file and bsmtp and they contents do not match. 

I can manually correct if I ever need the emailed bootstrap but it feels wrong.

 

Bruno Friedmann (bruno-at-bareos)

unread,
Mar 12, 2025, 9:48:25 AM3/12/25
to bareos-users
I'm not sure at 100% (can't reproduce that with using mailx instead of bsmtp for my own config) 
but I remember a similar case few time ago, which was more a missing \n on the first line that should have been fixed in the meantime.

you didn't indicate with this is a current version of Bareos nor the system on which you're running that.
What happen if you stop using tee ? 

For example here's how I handle writing the file to storage + sending a mail afterwards

in backup catalog job

WriteBootstrap = "/var/lib/bareos/storage/bsr/%c.%n.bsr"
  RunScript {
    Command = "/usr/bin/mailx -s \"Bareos: bootstrap for Job %j\" -a /var/lib/bareos/storage/bsr/%c.%n.bsr root@host"
    RunsWhen = "after"
    RunsOnClient = No
  }

I found better the way mailx is sending the bsr, as it is really an attached file, easier to download and reuse if it needs to be pickup from mail.
(also easier to extract if handled by programs)

For reference how to use mailx
Reply all
Reply to author
Forward
0 new messages