RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2070858 - at job that does not contain trailing newline gets mangled incorrectly [centos-stream]
Summary: at job that does not contain trailing newline gets mangled incorrectly [cento...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: at
Version: CentOS Stream
Hardware: Unspecified
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Jan Staněk
QA Contact: Jan Houska
URL:
Whiteboard:
Depends On:
Blocks: 2070450
TreeView+ depends on / blocked
 
Reported: 2022-04-01 08:33 UTC by Jan Staněk
Modified: 2022-11-15 13:01 UTC (History)
6 users (show)

Fixed In Version: at-3.1.23-11.el9
Doc Type: Bug Fix
Doc Text:
Cause: at wraps the job definition (script) in heredoc in order to be able to launch that job in a user's $SHELL. The end marker of the heredoc construct was attached without a newline at the start. Consequence: If the job definition (script) did not end with a newline symbol, the marker would not get recognized as such and the job would be mangled. Fix: The end marker now always include initial newline (it is always added at a dedicated separate line). Result: The marker is now always recognized as a marker and the job is no longer mangled if not ending with a new line.
Clone Of: 2070450
Environment:
Last Closed: 2022-11-15 11:15:21 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-117593 0 None None None 2022-04-01 08:39:13 UTC
Red Hat Product Errata RHBA-2022:8294 0 None None None 2022-11-15 11:15:23 UTC

Description Jan Staněk 2022-04-01 08:33:05 UTC
+++ This bug was initially created as a clone of Bug #2070450 +++

Description of problem:
Scheduling at jobs in python using subprocess does not give expected result.
Somewhere something goes wrong with a `marcinDELIMITER`.


Version-Release number of selected component (if applicable):
- at 3.1.20
- Python 3.6.8


How reproducible:
Very


Steps to Reproduce:
1. open python3 console
2. paste code:
```
import subprocess
p = subprocess.Popen(
    ['/bin/at', 'now'],
    stdin=subprocess.PIPE,
)
stdout, stderr = p.communicate(
    input=b'echo something > test',
)
```

Actual results:
File created named: `testmarcinDELIMITER31aa8a18` with contents: `something`


Expected results:
File created named `test` with contents: `something` 


Additional info:
Running at from the command line works just fine e.g.: `at now <<<'echo something > test'`
Also `input=b'echo something > test\n'` works too.


So my question is this, is this a "bug" in AT, or should python subprocess code always include the newline (\n) character.

--- Additional comment from Jan Staněk on 2022-03-31 09:00:13 UTC ---

Hi, thanks for the report. You are not the only one with that problem, I found this salt issue that seems to stem from the same bug: https://github.com/saltstack/salt/issues/58510
That issue points me to an old at bug#486844. From quick glance, it seems like an at issue (missing newline before the delimiter), but I will have to investigate further.

In the mean time, the suggested workaround is to always include the trailing newline in your Python input field.

--- Additional comment from Jan Staněk on 2022-03-31 09:16:08 UTC ---

This issue is currently present in Fedora 36 Beta too.

Minimal reproducer: `$ echo -n 'touch test.txt'|at now`
Current result: File `test.txtmarcinDELIMITERxxxxxxxx` is touched/created, where `xxxxxxxx` is soime random hexadecimal number (grep basic regex: `marcinDELIMITER[[:xdigit:]]\{8\}$`).
Expected result: File `test.txt` is touched/created.

--- Additional comment from Onmeac on 2022-03-31 12:13:45 UTC ---

> https://github.com/saltstack/salt/issues/58510

Yes that was "us" too, almost a year ago, but that ticket never got anywhere and at the time we had not yet migrated to EL8.

Now we are migrating and in doing so it is becoming more noticeable (in our situation) with using salt.

Thanks for taking the time to investigate this issue.

Comment 9 errata-xmlrpc 2022-11-15 11:15:21 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (at bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:8294


Note You need to log in before you can comment on or make changes to this bug.