Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Files being listed as directories when mapping is directoryIncluded and recurseDirectories #118

Open
bokken opened this issue Dec 6, 2019 · 1 comment

Comments

@bokken
Copy link
Member

bokken commented Dec 6, 2019

We want to be able to have the spec file to explicitly define every directory and sub-directory with specific permissions. We have historically accomplished this by having a top level mapping defining the top level directory with no sources, directoryIncluded set to true and recurse directories set to true.

<mapping>
  <directory>/usr/myuser/appDir</directory>
  <filemode>775</filemode>
  <directoryIncluded>true</directoryIncluded>
  <recurseDirectories>true</recurseDirectories>
</mapping>

This is then followed by various mappings which land files and directories under /usr/myuser/appDir, all of which have directoryIncluded set to false. I am pretty certain this worked when directoryIncluded and recurseDirectories were originally added.
Now, however, it appears[1] that if recurseDirectories is true, all of the files will be listed explicitly. Not only is this not desired (by virtue of fact that no sources were defined), it is also incorrectly defining the files as directories. This latter point is because the baseFileString[2] is obtained from the Mapping[3], which (rightly) believes it is only describing directories.

So if we take the above example, and then have another mapping which attempts to land someFile into /usr/myuser/appDir with 644 permissions, the result is the following in the spec file:

%dir %attr(775,cps,cps)  "/usr/myuser/appDir/"
%dir %attr(775,cps,cps)  "/usr/myuser/appDir/someFile"
%attr(644,cps,cps)  "/usr/myuser/appDir/someFile"

[1] - https://github.com/mojohaus/rpm-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/rpm/SpecWriter.java#L275
[2] - https://github.com/mojohaus/rpm-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/rpm/SpecWriter.java#L179
[3] - https://github.com/mojohaus/rpm-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/rpm/Mapping.java#L413

bokken pushed a commit that referenced this issue Dec 6, 2019
Do not write out files for mappings with no source definitions.
bokken pushed a commit that referenced this issue Dec 6, 2019
This reverts commit d2ced9c.
bokken pushed a commit that referenced this issue Dec 6, 2019
Do not write out files for mappings with no source definitions.
dantran added a commit that referenced this issue Jan 20, 2020
@JasonWThompson
Copy link

Since this has been merged, is this still an open issue?

This issue is impacting newer versions of rpmbuild. If a file in the spec is incorrectly marked as a directory, newer versions of rpmbuild will fail. For my projects, this is causing builds to fail in our automation.

When can we expect a new release of the plugin with this fix in it? Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants