Hmm, interesting. So it looks like the Xymon command is written to support
multi-line input, such as this sort of thing:
echo "status $HOST.test\\" > $TMPFILE # continued
echo "green \\" >> $TMPFILE # continued
echo "`date`\\" >> $TMPFILE # continued
echo "Test X is OK" >> $TMPFILE # not continued
echo "The test X was tested and found to be OK" >> $TMPFILE
$XYMON $XYMSRV < $TMPFILE
so that a single (eg status) line can be split over multiple input lines by
using backslash at EOL.
The code in stackio.c that joins lines due to a trailing backslash seems to
skip over any spaces immediately after the backslash (eg "first
line...\<sp><sp><sp><lf>...first line continued").
I note that "ps" displays the multi-line "sed" command with a trailing
space.
$ $ ps -f | sed '1i\
'|grep '[s]ed'|tr ' ' '.'
jeremyl...3104..2448..0.10:31.pts/3....00:00:00.sed.1i\.
There is no trailing space in the process args, so ps must be adding it.
Perhaps this is to de-fang any backslashes, precisely to avoid what seems
to be happening with the xymon client.
So perhaps "escaping" a "\<sp>" sequence at the end of a line would fix
this. Something like:
ps -Aww f -o pid,ppid,user,start,state,pri,pcpu,time:12,pmem,rsz:10,vsz:10,cmd
| sed 's/\\ *$/\\./'
J
On Sat, 23 Mar 2024 at 02:34, John Horne <user-e95f1ec2f147@xymon.invalid> wrote:
On Fri, 2024-03-22 at 13:04 +0000, John Horne wrote:
On Fri, 2024-03-22 at 10:10 +1100, Jeremy Laidman wrote:
This seems to be an artefact of the "xymon" command, perhaps sanitising
input.
I would agree.
Interestingly in the source lib/stackio.c (line 58) is the input comment:
=====
* Simultaneously, lines ending with a '\' character are
* merged into one line, allowing for transparent handling
* of very long lines.
=====
Unfortunately I've got to leave work in a minute, but I would say this
could be
where the lines are merged. The comment comes from the 'unlimfgets'
routine,
which is used by the xymon command (common/xymon.c) to read input.
John.
--
John Horne | Senior Operations Analyst | Technology and Information
Services
University of Plymouth | Drake Circus | Plymouth | Devon | PL4 8AA | UK
[https://www.plymouth.ac.uk/images/email_footer.gif]<
http://www.plymouth.ac.uk/worldclass>
This email and any files with it are confidential and intended solely for
the use of the recipient to whom it is addressed. If you are not the
intended recipient then copying, distribution or other use of the
information contained is strictly prohibited and you should not rely on it.
If you have received this email in error please let the sender know
immediately and delete it from your system(s). Internet emails are not
necessarily secure. While we take every care, University of Plymouth
accepts no responsibility for viruses and it is your responsibility to scan
emails and their attachments. University of Plymouth does not accept
responsibility for any changes made after it was sent. Nothing in this
email or its attachments constitutes an order for goods or services unless
accompanied by an official order form.