#104 rpmdev-bumpspec converts CR/LF line endings to LF in the entire spec
Opened a year ago by churchyard. Modified a year ago

I've noticed recently that one of my Fedora distgit Pull Requests that I sent contains a completely unrelated whitespace change in an older changelog entry. As a person who cannot stand mixing unrelated fixups (trimming trailing whitespace, converting line endings, fixing bogus changelog dates etc.) I tracked down the cause to rpmdev-bumpsec.

To reproduce, let's use the same spec I have used.

fedpkg clone packit
cd packit
git switch -d ff114570363fcc88cc4ec7f4d2ab0d5f3576f2e7

Or alternatively just downsload the spec, but using git makes it easier to see the changes.

[packit ((ff11457...))]$ rpmdev-bumpspec packit.spec 
[packit ((ff11457...) *)]$ git diff
diff --git a/packit.spec b/packit.spec
index cdbfa10..047b8a2 100644
--- a/packit.spec
+++ b/packit.spec
@@ -3,7 +3,7 @@

 Name:           %{real_name}
 Version:        0.59.0
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        A tool for integrating upstream projects with Fedora operating system

 License:        MIT
@@ -102,9 +102,12 @@ cp files/bash-completion/packit %{buildroot}%{_datadir}/bash-completion/completi
 %{python3_sitelib}/*

 %changelog
+* Mon Jan 30 2023 Miro Hrončok <mhroncok@redhat.com> - 0.59.0-2
+- rebuilt
+
 * Thu Aug 25 2022 Packit <hello@packit.dev> - 0.59.0-1
-- Packit CLI can now submit VM images in Red Hat Image Builder.
-  All build-related commands have now consistent `--wait`/`--no-wait` options. (#1666)
+- Packit CLI can now submit VM images in Red Hat Image Builder.
+  All build-related commands have now consistent `--wait`/`--no-wait` options. (#1666)
 - No more annoying issues will be created after a successfull propose downstream. (#1693)

 * Fri Aug 05 2022 Packit <hello@packit.dev> - 0.57.0-1

Upon examination of the original spec, I see it had CR/LF line endings in the latest changelog message. rpmdev-bumpspec converted them to the correct LF line endings.

In my opinion, rpmdev-bumpspec should not do that, as the command is for bumping release and adding changelog entries, not to "fix" older changelog entries.


Upon further investigation, I've realized rpmdev-bumpspec converts CR/LF line endings to LF in the entire spec file, not only in existing changelog entries.


I'm using rpmdevtools-9.6-2.fc37.noarch


Opening the file in text mode and iterating the lines via readlines() is probably the reason for this behavior. I am not sure it's worth fixing, but maybe it should bail out or scream loudly when the spec file has other line endings?

I don't think this is worth fixing, as CRLF formatted files can cause unexpected problems when parsing spec files anyway.

Wouldn't rpmdev-bumpspec convert all spec files in Fedora to LF line endings at least twice a year with the mass rebuild anyway? So at this point, I assume this is an isolated incident with that one spec file ...

yes. I belive it's because it was on epel8 branch which has no mass rebuilds.

Login to comment on this ticket.

Metadata