Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packit adds missing trailing newline to the end of the spec file #348

Closed
2 tasks
hroncok opened this issue Feb 6, 2024 · 1 comment · Fixed by #353
Closed
2 tasks

Packit adds missing trailing newline to the end of the spec file #348

hroncok opened this issue Feb 6, 2024 · 1 comment · Fixed by #353
Labels
area/fedora Related to Fedora ecosystem gain/low This doesn't bring that much value to users. impact/low This issue impacts only a few users. kind/bug Something isn't working.

Comments

@hroncok
Copy link
Contributor

hroncok commented Feb 6, 2024

What happened? What is the problem?

When the spec file is not terminated by \n, packit adds \n to the end of the specfile. This mixes in "cleanups" with actual changes, thus it exceeds the scope of the commit.

What did you expect to happen?

Only related changes should be included in an update commit.

Example URL(s)

https://src.fedoraproject.org/rpms/ini2toml/pull-request/6

Steps to reproduce

  1. Have a specfile that is not terminated by a newline character.
  2. Let packit update it.
  3. A newline character is added to the end of the specfile.

Workaround

  • There is an existing workaround that can be used until this issue is fixed.

Participation

  • I am willing to submit a pull request for this issue. (Packit team is happy to help!)
@lbarcziova
Copy link
Member

hi @hroncok ! Thanks for reporting this.

I was able to reproduce it only with:

from specfile import Specfile
s = Specfile(path_to_specfile, autosave=True)
# some change to specfile
s.version = version

So we should probably fix this in specfile library to preserve the original end of the specfile.

@lbarcziova lbarcziova added area/fedora Related to Fedora ecosystem kind/bug Something isn't working. gain/low This doesn't bring that much value to users. impact/low This issue impacts only a few users. labels Feb 7, 2024
@lbarcziova lbarcziova transferred this issue from packit/packit Feb 8, 2024
@nforro nforro moved this from priority-backlog to in-review in Packit Kanban Board Mar 15, 2024
softwarefactory-project-zuul bot added a commit that referenced this issue Mar 15, 2024
Do not always add a trailing newline upon saving

Fixes #348.
RELEASE NOTES BEGIN
A trailing newline is no longer added to spec files without one upon saving.
RELEASE NOTES END

Reviewed-by: Laura Barcziová
@github-project-automation github-project-automation bot moved this from in-review to done in Packit Kanban Board Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/fedora Related to Fedora ecosystem gain/low This doesn't bring that much value to users. impact/low This issue impacts only a few users. kind/bug Something isn't working.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants