Bogus file copy for onlyIfModified=true
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 65/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- java
- Domain
- build-system
Research direction
Start with AbstractWarPackagingTask.copyFile, which the issue identifies as comparing the source and destination modification times when onlyIfModified is true. Check the existing tests for this copy behavior and reproduce the case with files whose contents differ but modification times match. Done when changed content is copied despite equal timestamps and the relevant tests pass.
Written by the indexing model from the issue text.
Description
Affected version
3.5.1, possibly others
Bug description
While analysing a weird race-condition during WAR packaging, I might have discovered the responsible cause.
Symptom: On some builds, the WAR is badly packaged because modified files are not copied from the overlay to the target directory.
This seems to happen, when the overlay file has the same modify time as the target, although having been changed in the build process.
Analysis showed, that the modified overlay file is sometimes not copied, because the modification time is the same as the target file, although the file content differs.
Digging deeper revealed, that the modification timestamp has a granularity of 1 sec on the underlying filesystem (Apple HFS). So when the file modification and packaging actually run within a second, the file copy might be surpressed!
Responsible for that seems this method in AbstractWarPackagingTask:
protected boolean copyFile(
WarPackagingContext context, File source, File destination, String targetFilename, boolean onlyIfModified)
throws IOException {
context.addResource(targetFilename);
BasicFileAttributes readAttributes = Files.readAttributes(source.toPath(), BasicFileAttributes.class);
if (onlyIfModified
&& destination.lastModified()
>= readAttributes.lastModifiedTime().toMillis()) {
context.getLog().debug(" * " + targetFilename + " is up to date.");
return false;
} else {
...
Although the lastModifiedTime attribute is compared in millis, it effectively only compares in seconds, when the underlying FS hasn't that granularity. This even disregards a difference in file size.
- Dominant language
- Java
- Stars
- 48
- Forks
- 103
- Avg merge
- 11h 20m
- Merged PRs (30d)
- 15
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/maven-war-plugin
-
help wanted maintenance
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
apache/maven-war-plugin#694 ·
Maintainers usually reply within 1 day
-
OverlayManager.compareOverlayWithArtifact() treats null classifier as literal "null" stringPossibly taken @elharo claimed this 146 days ago. Openbug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
apache/maven-war-plugin#621 ·
Maintainers usually reply within 1 day
-
DependencyInfo.hashCode() violates equals/hashCode contractPossibly taken @elharo claimed this 146 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/maven-war-plugin#620 · 1 comment ·
Maintainers usually reply within 1 day
-
war:exploded should have an explicit incremental optionPossibly taken @efegokdemir claimed this 64 days ago. Openenhancement
Difficulty 2/5 Half a day Newbie friendliness 68/100
apache/maven-war-plugin#556 · 1 comment ·
Maintainers usually reply within 1 day
-
Multibyte UTF-8 character split by newline in MANIFEST. MFPossibly taken A pull request linked to this issue is open or already merged. Openbug
Difficulty 4/5 3-5 days Newbie friendliness 50/100
apache/maven-war-plugin#654 · 3 comments ·
Maintainers usually reply within 1 day
All issues in apache/maven-war-plugin
Similar issues
-
Android Bug Core Drape
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
organicmaps/organicmaps#14449 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
openhab/openhab-addons#22512 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
objectionary/lints#1871 ·
Maintainers usually reply within 1 day
-
help wanted maintenance
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/maven-resolver-ant-tasks#219 ·
Maintainers usually reply within 1 day
-
help wanted maintenance
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/maven-project-info-reports-plugin#704 ·
Maintainers usually reply within 1 day