shell: add preceding newline to delimiter

at uses heredoc redirection to pass the script being executed
into user's defined $SHELL. However, the heredoc delimiter
is directly concatenated to the script's contents;
if these contents do not end with a newline,
the delimiter is attached to the last line of the script.

This patch adds a single newline to be always emmited before the
delimiter. This guarantees the delimiter is always on it's own
line. In case a newline is already present at the end of the original
script, this simply adds a single empty line; I cannot think of any
complication that could result from that.

Resolves: rhbz#2070858
Signed-off-by: Jan Staněk <jstanek@redhat.com>
This commit is contained in:
Jan Staněk 2022-03-31 12:13:56 +02:00
parent 87b5a1f62a
commit 55072d7e68
No known key found for this signature in database
GPG Key ID: 2972F2037B243B6D
2 changed files with 6 additions and 2 deletions

View File

@ -41,7 +41,7 @@ diff -up at-3.1.20/at.c.shell at-3.1.20/at.c
fprintf(stderr, "<EOT>\n");
}
- fprintf(fp, "\n");
+ fprintf(fp, "marcinDELIMITER%08lx\n", i);
+ fprintf(fp, "\nmarcinDELIMITER%08lx\n", i);
if (ferror(fp))
panic("Output error");
fflush(fp);

View File

@ -3,7 +3,7 @@
Summary: Job spooling tools
Name: at
Version: 3.1.23
Release: 10%{?dist}
Release: 11%{?dist}
# http://packages.debian.org/changelogs/pool/main/a/at/current/copyright
# + install-sh is MIT license with changes under Public Domain
License: GPLv3+ and GPLv2+ and ISC and MIT and Public Domain
@ -166,6 +166,10 @@ chown root:root %{_localstatedir}/spool/at/.SEQ
%attr(0644,root,root) /%{_unitdir}/atd.service
%changelog
* Fri Apr 01 2022 Jan Staněk <jstanek@redhat.com> - 3.1.23-10
- Add preceding newline to delimiter in at-3.1.20-shell.patch
Resolves: rhbz#2070858
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com>
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688